This blog is for Automation Test Engineers

Saturday, 2 September 2017

How do you use JavaScript in selenium

 Javascript is one of the programming language of web. All HTML pages are using Javascript.
To execute Javascript in our webdriver script which can use JavascriptExecutor.

JavascriptExecutor in interface which is available in package org.openqa.selenium.JavascriptExecutor.

Eg:
WebDriver driver=new FirefoxDriver();
driver.get("https://www.facebook.com/");
//this will execute Javascript in your script
((JavascriptExecutor)driver).executescript("document.getElementById("email").value="zyt@gmail.com");






0

0 comments:

Post a Comment