Question
Accenture India PVT Ltd
Accenture India PVT Ltd
IN
Accenture India PVT Ltd
Posted: May 14, 2018
Last activity: Nov 6, 2018
Last activity: 6 Nov 2018 20:02 EST
Closed
Provide procedure to use JavaScript function in Automation
I want to Invoke JavaScript code in automation. Please provide the procedure to do it.
A WebPage object has two methods that are useful here; ExecuteScript (ES) and InvokeScriot (IS). ES cab be used to insert a JS function into the page. I generally use it to create a JS function that I will then call with IS. IS can execute a given script on the page and can supply parameters to it. If you wanted a function that showed a JS dialog;
use ES...
function PegaRobotics_ShowDialog(message) {
alert(message);
return "done";
}
use IS;
A WebPage object has two methods that are useful here; ExecuteScript (ES) and InvokeScriot (IS). ES cab be used to insert a JS function into the page. I generally use it to create a JS function that I will then call with IS. IS can execute a given script on the page and can supply parameters to it. If you wanted a function that showed a JS dialog;
use ES...
function PegaRobotics_ShowDialog(message) {
alert(message);
return "done";
}
use IS;
PegaRobotics_ShowDialog (script name)
pass a string to the next parameter.