Search in sources :

Example 36 with FirefoxDriver

use of org.openqa.selenium.firefox.FirefoxDriver in project kotlin by JetBrains.

the class SeleniumFireFox method createFirefoxDriver.

public static FirefoxDriver createFirefoxDriver() {
    FirefoxProfile profile = new FirefoxProfile();
    FirefoxDriver answer = new FirefoxDriver(profile);
    return answer;
}
Also used : FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) FirefoxProfile(org.openqa.selenium.firefox.FirefoxProfile)

Example 37 with FirefoxDriver

use of org.openqa.selenium.firefox.FirefoxDriver in project jlineup by otto-de.

the class BrowserUtils method getWebDriverByConfig.

synchronized WebDriver getWebDriverByConfig(Config config, int width) {
    WebDriver driver;
    switch(config.browser) {
        case FIREFOX:
            FirefoxDriverManager.getInstance().setup();
            FirefoxOptions firefoxOptions = new FirefoxOptions();
            firefoxOptions.setProfile(getFirefoxProfileWithDisabledAnimatedGifs());
            driver = new FirefoxDriver(firefoxOptions);
            break;
        case FIREFOX_HEADLESS:
            FirefoxDriverManager.getInstance().setup();
            FirefoxOptions firefoxOptionsForHeadless = new FirefoxOptions();
            // Headless parameter is supported with Firefox >= 55
            firefoxOptionsForHeadless.addArguments("--headless");
            firefoxOptionsForHeadless.addArguments("-width", width + "", "-height", config.windowHeight + "");
            firefoxOptionsForHeadless.setProfile(getFirefoxProfileWithDisabledAnimatedGifs());
            driver = new FirefoxDriver(firefoxOptionsForHeadless);
            break;
        case CHROME:
            ChromeDriverManager.getInstance().setup();
            ChromeOptions options = new ChromeOptions();
            // To work in a headless env, this is needed
            options.addArguments("--no-sandbox");
            driver = new ChromeDriver(options);
            break;
        case CHROME_HEADLESS:
            ChromeDriverManager.getInstance().setup();
            ChromeOptions options_headless = new ChromeOptions();
            // To work in a headless env, this is needed
            options_headless.addArguments("--no-sandbox", "--headless", "--disable-gpu");
            options_headless.addArguments("--window-size=" + width + "," + config.windowHeight);
            driver = new ChromeDriver(options_headless);
            break;
        case PHANTOMJS:
        default:
            PhantomJsDriverManager.getInstance().setup();
            driver = new PhantomJSDriver();
            break;
    }
    driver.manage().timeouts().pageLoadTimeout(config.pageLoadTimeout, TimeUnit.SECONDS);
    return driver;
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxOptions(org.openqa.selenium.firefox.FirefoxOptions) PhantomJSDriver(org.openqa.selenium.phantomjs.PhantomJSDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) ChromeOptions(org.openqa.selenium.chrome.ChromeOptions) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver)

Example 38 with FirefoxDriver

use of org.openqa.selenium.firefox.FirefoxDriver in project syndesis-qe by syndesisio.

the class CustomWebDriverProvider method prepareFirefoxDriver.

/**
 * Method will prepare firefox driver with custom profile
 * @return
 */
private FirefoxDriver prepareFirefoxDriver() {
    // so far we only use firefox and chrome so lets set up firefox here
    log.info("setting firefox profile");
    System.setProperty("webdriver.gecko.driver", findDriverPath());
    FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability("marionette", true);
    firefoxOptions.addArguments("start-maximized");
    firefoxOptions.addPreference("browser.download.folderList", 2);
    firefoxOptions.addPreference("browser.download.manager.showWhenStarting", false);
    firefoxOptions.addPreference("browser.download.panel.shown", false);
    firefoxOptions.addPreference("browser.download.dir", DOWNLOAD_DIR);
    firefoxOptions.addPreference("browser.download.useDownloadDir", true);
    firefoxOptions.addPreference("browser.helperApps.neverAsk.saveToDisk", INTEGRATION_EXPORT_MIME_TYPE);
    firefoxOptions.addPreference("javascript.enabled", true);
    firefoxOptions.addPreference("app.update.enabled", false);
    firefoxOptions.addPreference("app.update.service.enabled", false);
    firefoxOptions.addPreference("app.update.auto", false);
    firefoxOptions.addPreference("app.update.staging.enabled", false);
    firefoxOptions.addPreference("app.update.silent", false);
    firefoxOptions.addPreference("media.gmp-provider.enabled", false);
    firefoxOptions.addPreference("extensions.update.autoUpdate", false);
    firefoxOptions.addPreference("extensions.update.autoUpdateEnabled", false);
    firefoxOptions.addPreference("extensions.update.enabled", false);
    firefoxOptions.addPreference("extensions.update.autoUpdateDefault", false);
    firefoxOptions.addPreference("extensions.logging.enabled", false);
    firefoxOptions.addPreference("lightweightThemes.update.enabled", false);
    return new FirefoxDriver(firefoxOptions);
}
Also used : FirefoxOptions(org.openqa.selenium.firefox.FirefoxOptions) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver)

Example 39 with FirefoxDriver

use of org.openqa.selenium.firefox.FirefoxDriver in project Payara by payara.

the class SeleniumHelper method getSeleniumInstance.

public SeleniumWrapper getSeleniumInstance() {
    if (selenium == null) {
        if (Boolean.parseBoolean(SeleniumHelper.getParameter("debug", "false"))) {
            logger.log(Level.INFO, "Creating new selenium instance");
        }
        String browser = getParameter("browser", "firefox");
        if ("firefox".equals(browser)) {
            driver = new FirefoxDriver();
        } else if ("chrome".equals(browser)) {
            driver = new ChromeDriver();
        } else if ("ie".contains(browser)) {
            driver = new InternetExplorerDriver();
        }
        elementFinder = new ElementFinder(driver);
        selenium = new SeleniumWrapper(driver, getBaseUrl());
        selenium.setTimeout("90000");
        // Make sure the server has started and the user logged in
        (new BaseSeleniumTestClass()).openAndWait("/", BaseSeleniumTestClass.TRIGGER_COMMON_TASKS, 480);
    }
    selenium.windowFocus();
    selenium.windowMaximize();
    selenium.setTimeout("90000");
    return selenium;
}
Also used : FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) InternetExplorerDriver(org.openqa.selenium.ie.InternetExplorerDriver) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver) BaseSeleniumTestClass(org.glassfish.admingui.devtests.BaseSeleniumTestClass)

Example 40 with FirefoxDriver

use of org.openqa.selenium.firefox.FirefoxDriver in project Payara by payara.

the class BaseSeleniumTestClass method setUp.

@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    driver.manage().timeouts().implicitlyWait(90, TimeUnit.SECONDS);
}
Also used : FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Before(org.junit.Before)

Aggregations

FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)82 WebDriver (org.openqa.selenium.WebDriver)61 WebElement (org.openqa.selenium.WebElement)47 Actions (org.openqa.selenium.interactions.Actions)18 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)10 File (java.io.File)8 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)7 FirefoxBinary (org.openqa.selenium.firefox.FirefoxBinary)6 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)5 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)5 URL (java.net.URL)4 Before (org.junit.Before)4 PhantomJSDriver (org.openqa.selenium.phantomjs.PhantomJSDriver)4 Test (org.junit.Test)3 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)3 PublicAtsApi (com.axway.ats.common.PublicAtsApi)2 FileReader (java.io.FileReader)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2