Question

1
Replies
1596
Views
AshokO07 Member since 2017 11 posts
TCS
Posted: 3 years ago
Last activity: 3 years 1 month ago
Closed

Need sample code of using ExecuteScript and InvokeScript

Hi,

Can you please give a sample code of using ExecuteScript and InvokeScript.

I want to print the content of the DIV; I am using ExecuteScript (containing the following javascript code) on the webpage but it is not working.

Image removed.

function printDiv()
{
var content = document.getElementById('ctl00_MainContentPlaceHolder_panelFrame').innerHTML;
var mywindow = window.open('', 'Print', 'height=600,width=800');

mywindow.document.write('<html><head><title>Print</title>');
mywindow.document.write('</head><body >');
mywindow.document.write(content);
mywindow.document.write('</body></html>');

mywindow.document.close();
mywindow.focus()
mywindow.print();
mywindow.close();
return true;
}

***Updated by moderator: Lochan to branch reply and create new post***

Robotic Process Automation
Moderation Team has archived post
Share this page LinkedIn