Java Code Examples for org.openqa.selenium.firefox.FirefoxDriver#executeScript()

The following examples show how to use org.openqa.selenium.firefox.FirefoxDriver#executeScript() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaScriptExamplesIT.java    From Mastering-Selenium-WebDriver-3.0-Second-Edition with MIT License 5 votes vote down vote up
@Test
private void javascriptExample3() {
    FirefoxDriver driver = new FirefoxDriver(new FirefoxOptions());
    String animal = "Lion";
    int seen = 5;

    driver.executeScript("console.log('I have seen a ' + arguments[0] + ' ' + arguments[1] + ' times(s)');", animal, seen);
}
 
Example 2
Source File: JavaScriptExamplesIT.java    From Mastering-Selenium-WebDriver-3.0-Second-Edition with MIT License 4 votes vote down vote up
@Test
private void javascriptExample1() {
    FirefoxDriver driver = new FirefoxDriver(new FirefoxOptions());
    driver.executeScript("console.log('I logged something to the Javascript console');");
}
 
Example 3
Source File: JavaScriptExamplesIT.java    From Mastering-Selenium-WebDriver-3.0-Second-Edition with MIT License 4 votes vote down vote up
@Test
private void javascriptExample2() {
    FirefoxDriver driver = new FirefoxDriver(new FirefoxOptions());
    Object response = driver.executeScript("return console.log('I logged something to the Javascript console');");

}