Search in sources :

Example 1 with ProfileFactory

use of org.asqatasun.sebuilder.tools.ProfileFactory in project Asqatasun by Asqatasun.

the class WebDriverFactory method getFirefoxDriver.

/**
     * This methods creates a firefoxDriver instance and set a DISPLAY 
     * environment variable
     * @param display
     * @return an instance of firefoxDriver 
     */
public FirefoxDriver getFirefoxDriver(String display) {
    if (webDriver == null) {
        FirefoxBinary ffBinary = new FirefoxBinary();
        if (StringUtils.isNotBlank(display)) {
            Logger.getLogger(this.getClass()).info("Setting Xvfb display with value " + display);
            ffBinary.setEnvironmentProperty("DISPLAY", display);
        }
        ProfileFactory pf = ProfileFactory.getInstance();
        webDriver = new FirefoxDriver(ffBinary, pf.getOnlineProfile());
        webDriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        webDriver.manage().timeouts().pageLoadTimeout(310, TimeUnit.SECONDS);
    }
    return webDriver;
}
Also used : FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) FirefoxBinary(org.openqa.selenium.firefox.FirefoxBinary) ProfileFactory(org.asqatasun.sebuilder.tools.ProfileFactory)

Aggregations

ProfileFactory (org.asqatasun.sebuilder.tools.ProfileFactory)1 FirefoxBinary (org.openqa.selenium.firefox.FirefoxBinary)1 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)1