Selenium With Java and Python For Mobile Apps & Web Apps......!

Thursday, 9 April 2015

How to Run Java Script using Selenium Webdriver.

WebDriver driver=new AnyDriverYouWant()

JavascriptExecutor js = (JavascriptExecutor) driver;

js.executeScript("write ur java script here ");


OR

WebDriver driver = new AnyDriverYouWant();
if (driver instanceof JavascriptExecutor) {
    ((JavascriptExecutor)driver).executeScript("yourScript();");
}

0 comments:

Post a Comment

Translate

Popular Posts

Total Pageviews