0

Hey i'm working in c# winform with Selenium Web Driver FireFox. I need to execute a .js file in code. I tried this but it didn't work :(

((IJavaScriptExecutor)driver).ExecuteScript(@"AppWatcherControl.js");

And i got an error saying could not execute AppWatcherControl.

Anyone know? Please and Thank you.

Programerszz
  • 391
  • 1
  • 5
  • 15
  • http://stackoverflow.com/questions/7675492/load-an-external-js-file-containing-useful-test-functions-in-selenium – Pandiyan Cool Nov 26 '14 at 07:10
  • Looks good but it didn't have an examples for me to look at so i'm still a little confussed – Programerszz Nov 26 '14 at 07:12
  • You will either need to pass the entire thing (i.e the entire contents) of that JS file into the `ExecuteScript` method or have it already loaded on the page as a function and have the `ExecuteScript` call that function. – Arran Nov 26 '14 at 16:17
  • So i need to grab the entire inside and put in inside the () ? So say it was var macro; var code; i would set it up like ExecuteScript("var macro; var code") – Programerszz Nov 26 '14 at 19:46

0 Answers0