Home

Andreas Tolfsen edited this page Jan 6, 2017 · 7 revisions
Clone this wiki locally

Welcome to the geckodriver wiki!

Examples

Selenium Java bindings

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.WebDriverWait;

import static org.openqa.selenium.support.ui.ExpectedConditions.titleContains;

public class GeckoDriver {

    @Test
    public void findMarionetteOnGithub() {
        WebDriver driver = new FirefoxDriver();
        WebDriverWait wait = new WebDriverWait(driver, 10);
        driver.get("https://github.com");
        driver.findElement(By.className("header-search-input")).sendKeys("geckodriver" + Keys.RETURN);
        wait.until(titleContains("Search")); 
        driver.findElement(By.linkText("mozilla/geckodriver")).click();
        wait.until(titleContains("mozilla/geckodriver"));
        System.out.println(driver.findElement(By.cssSelector("article>p")).getText());
        driver.quit();
    }

}

Contributing