Execute JavaScript using Selenium WebDriver in Java

Execute JavaScript using Selenium WebDriver in Java

The following script shows how to use Java's JavaScriptExecutor class, to execute JavaScript code.

String title = (String) js.executeScript("return document.title");

Leave a reply

Your email address will not be published. Required fields are marked*

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
2 + 1 =

Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.