javascriptexecutor in selenium code example

Example 1: @findby selenium

PageFactory.initElements(driver, this);

Example 2: @findby selenium

@FindBy(how = How.CLASS_NAME, using = "classname")
private List<WebElement> singlecriterion;

Example 3: javascriptexecutor in selenium java

JavascriptExecutor js = (JavascriptExecutor) driver;  
js.executeScript(Script,Arguments);

Example 4: how to use javascriptexecutor for loop in selenium c#

String script3 = "return document.getElementsByTagName('g')[" + f9 + "].textContent";
n = (String) ((JavascriptExecutor) driver).executeScript(script3, hiddenDiv);

Example 5: @findby selenium

@FindBy(how = How.ID, using = "elementid")
private WebElement element;

Tags:

Java Example