How to run javascript from robotics automation

How to execute the below mentioned javascript on button click

function myFunction() {"");

I tried to run the below mentioned c# code, but i am not able to add referrence for ScriptManager



Keep up to date on this post and subscribe to comments

September 19, 2019 - 5:29pm

I would use the ExecuteScript method of a web page.

Pass it the code for the function;

function myFunction() {"");


After that, call the InvokeScript function of the web page and pass it the name of the function you just created (myFunction is what you have above). Since there are no parameters, you can leave them empty. If your function did take in parameters, you could pass them in from the InvokeScript method call.


September 26, 2019 - 1:59pm

We have to run the script on windows forms button click. We dont have webpage to call executeScript method.

September 26, 2019 - 5:40pm
Response to VivekA

JavaScript is executed against a Web Page and not on any other control. In order to execute JavaScript, you must have a web page.