I am using JavaScript for my code.
I used an object of JavaScriptExecutor, but executeScript() method is not present. It shows error when I use executeScript() method.
Below is my code:
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.JavascriptExecutor;
public class NewDemo{
public static void main(String[] args) {
WebDriver driver=new FirefoxDriver();
driver.get("http://google.com");
driver.manage().window().maximize();
System.out.println(driver.getCurrentUrl());
JavaScriptExecutor js=(JavaScriptExecutor) driver;
String domain_name=(String) js.executeScript("return document.domain");
System.out.println(doamin_name);
}
}