how to instantiate javascriptexecutor in selenium code example
Example 1: how to cast to javascript executor
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript(Script,Arguments);
Example 2: how to use javascriptexecutor for loop in selenium c#
String script3 = "return document.getElementsByTagName('g')[" + f9 + "].textContent";
n = (String) ((JavascriptExecutor) driver).executeScript(script3, hiddenDiv);