Example usage for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver

List of usage examples for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver

Introduction

In this page you can find the example usage for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver.

Prototype

public FirefoxDriver() 

Source Link

Usage

From source file:com.github.mfriedenhagen.phantomjstest.FirefoxDriverRule.java

public FirefoxDriverRule() {
    super(new FirefoxDriver());
}

From source file:com.github.terma.gigaspacewebconsole.server.E2ERun.java

License:Apache License

@Before
public void setUp() throws Exception {
    server = new Runner();
    server.start();/*from   w w  w.  j a va2  s. c om*/

    driver = new FirefoxDriver();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:com.github.wiselenium.TestBase.java

License:Open Source License

@BeforeClass
public void initDriver() {
    this.driver = new FirefoxDriver();
    WiseContext.setDriver(this.driver);
}

From source file:com.github.wiselenium.testng.WiseTest.java

License:Open Source License

/**
 * Inits the driver instance for the test. <br/>
 * May be overridden. By default, inits a FirefoxDriver.
 * //from  w ww  .  ja  va 2  s.  c  om
 * @return The instance of the driver for the test.
 * @since 0.3.0
 */
public WebDriver initDriver() {
    return new FirefoxDriver();
}

From source file:com.gmatuella.clinic.pageobjects.LoginPage.java

public LoginPage() {
    localDriver = new FirefoxDriver();
    localDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

From source file:com.google.caja.plugin.DomitaTest.java

License:Apache License

void exerciseFirefox(String pageName) {
    //System.setProperty("webdriver.firefox.bin", "/usr/bin/firefox");
    WebDriver driver = new FirefoxDriver();

    driver.get("http://localhost:8000/" + "ant-lib/com/google/caja/plugin/" + pageName);

    int clickRounds = 0;
    List<WebElement> clickingList = null;
    for (; clickRounds < clickRoundLimit; clickRounds++) {
        clickingList = driver.findElements(By.xpath("//*[contains(@class,'clickme')]/*"));
        if (clickingList.size() == 0) {
            break;
        }/*from  ww w  .  j  a v  a 2  s.co  m*/
        for (WebElement e : clickingList) {
            e.click();
        }
    }
    assertTrue("Too many click rounds. " + "Remaining elements = " + renderElements(clickingList),
            clickRounds < clickRoundLimit);

    int waitRounds = 0;
    List<WebElement> waitingList = null;
    for (; waitRounds < waitRoundLimit; waitRounds++) {
        waitingList = driver.findElements(By.xpath("//*[contains(@class,'waiting')]"));
        if (waitingList.size() == 0) {
            break;
        }
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
    }
    assertTrue("Too many wait rounds. " + "Remaining elements = " + renderElements(waitingList),
            waitRounds < waitRoundLimit);

    // check the title of the document
    String title = driver.getTitle();
    assertTrue("The title shows " + title, title.contains("all tests passed"));

    driver.quit();
}

From source file:com.google.caja.plugin.WebDriverHandle.java

License:Apache License

private static RemoteWebDriver makeDriver() {
    DesiredCapabilities dc = new DesiredCapabilities();

    String browserType = TestFlag.BROWSER.getString("firefox");

    if ("chrome".equals(browserType)) {
        // Chrome driver is odd in that the path to Chrome is specified
        // by a desiredCapability when you start a session. The other
        // browser drivers will read a java system property on start.
        // This applies to both remote Chrome and local Chrome.
        ChromeOptions chromeOpts = new ChromeOptions();
        String chromeBin = TestFlag.CHROME_BINARY.getString(null);
        if (chromeBin != null) {
            chromeOpts.setBinary(chromeBin);
        }//from  w w  w. j  av a 2 s  .co m
        String chromeArgs = TestFlag.CHROME_ARGS.getString(null);
        if (chromeArgs != null) {
            String[] args = chromeArgs.split(";");
            chromeOpts.addArguments(args);
        }
        dc.setCapability(ChromeOptions.CAPABILITY, chromeOpts);
    }

    String url = TestFlag.WEBDRIVER_URL.getString("");

    if (!"".equals(url)) {
        dc.setBrowserName(browserType);
        dc.setJavascriptEnabled(true);
        try {
            return new RemoteWebDriver(new URL(url), dc);
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
    } else if ("chrome".equals(browserType)) {
        return new ChromeDriver(dc);
    } else if ("firefox".equals(browserType)) {
        return new FirefoxDriver();
    } else if ("safari".equals(browserType)) {
        // TODO(felix8a): local safari doesn't work yet
        return new SafariDriver();
    } else {
        throw new RuntimeException("No local driver for browser type '" + browserType + "'");
    }
}

From source file:com.googlecode.ounit.opaque.TestBase.java

License:Open Source License

public static void openBrowser() {
    if (driver == null)
        driver = new FirefoxDriver();
}

From source file:com.googlecode.ounit.selenium.WebDriverFactory.java

License:Open Source License

public static WebDriver newInstance(Browser b) {
    switch (b) {//from ww w.  j a v  a  2s  .  c om
    case FIREFOX:
        return new FirefoxDriver();
    case CHROME:
        return new ChromeDriver();
    case IE:
        return new InternetExplorerDriver();
    case HTMLUNIT:
        /* 
         * Make sure we have a fully capable HtmlUnitDriver and
         * silence the stupid warnings about text/javascript  
         */
        HtmlUnitDriver rv = new HtmlUnitDriver(new DesiredCapabilities("htmlunit", "firefox", Platform.ANY)) {
            @Override
            protected WebClient modifyWebClient(WebClient client) {
                final IncorrectnessListener delegate = client.getIncorrectnessListener();
                client.setIncorrectnessListener(new IncorrectnessListener() {
                    @Override
                    public void notify(String message, Object origin) {
                        if (message.contains("Obsolete") && message.contains("/javascript"))
                            return;

                        delegate.notify(message, origin);
                    }
                });
                return super.modifyWebClient(client);
            }
        };
        return rv;
    default:
        throw new IllegalArgumentException("Invalid browser specified");
    }
}

From source file:com.grupo2s.demo.event2s.CredencialesEventoTest.java

@Before
public void setUp() throws Exception {
    WebDriver driver = new FirefoxDriver();
    String baseUrl = "http://demo.event2s.com/";
    wait = new WebDriverWait(driver, 10);
    selenium = new WebDriverBackedSelenium(driver, baseUrl);
}