Cómo usar JavaScriptExecutor para bucle en Selenium C#
String script3 = "return document.getElementsByTagName('g')[" + f9 + "].textContent";
n = (String) ((JavascriptExecutor) driver).executeScript(script3, hiddenDiv);
Helpless Hamerkop