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

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

Introduction

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

Prototype

public FirefoxBinary(File pathToFirefoxBinary) 

Source Link

Usage

From source file:com.googlesites.CaptchaTest.java

@Test(groups = "sikuli")
public void createSite() {

    FirefoxProfile profile = new FirefoxProfile();
    driver = new FirefoxDriver(new FirefoxBinary(new File(Config.getPropertyValue("firefoxLocation"))),
            profile);/*from w ww .j  a va  2s . c o m*/
    WebDriverInstance wdi = new WebDriverInstance();
    wdi.setCurrentDriver(driver);
    driver.manage().window().maximize();
    sitesURLs.add("blanksitezzz");
    sitesURLs.add("intranetlintranetl111");
    sitesURLs.add("alf12opitds");
    sitesURLs.add("soccttttttttttttttttttttt");
    overview = new Overview(driver);
    overview.navigateToOverviewPage();
    loginPage = overview.navigateToLogin();
    sites = loginPage.logIn("johnjjones02@gmail.com", "MyPasswordIsC0@l");
    sites.verifyTheOnlySitesAre(sitesURLs);
    createSite = sites.clickOnCreateButton();
    createSite.createSite("Gollum1124", "siteyy1");
    driver.close();
}

From source file:com.googlesites.IntranetTests.java

@Test(groups = "sikuli", enabled = false)
public void intranetTest() {
    driver = new FirefoxDriver(new FirefoxBinary(new File(Config.getPropertyValue("firefoxLocation"))),
            profile);//from w  ww  .ja  v a 2s .  c  om
    driver.manage().window().maximize();
    WebDriverInstance wdi = new WebDriverInstance();
    wdi.setCurrentDriver(driver);
    overview = new Overview(driver);
    overview.navigateToOverviewPage();
    loginPage = overview.navigateToLogin();
    sites = loginPage.logIn("johnjjones02@gmail.com", "MyPasswordIsC0@l");
    site = sites.navigateToSite("intranetlintranetl111");
    intranet = new IntranetPage(driver);
    intranet.navigateTo("Documents");
    sikuli.find("Documents.png", "Documents page", 0.7);
    intranet.navigateTo("Directory");
    sikuli.find("Directory.png", "Directory page", 0.7);
    intranet.navigateTo("Discussion");
    sikuli.find("Discussion.png", "Discussion page", 0.7);
    intranet.navigateTo("Announcements");
    sikuli.find("Announcements.png", "Announcements page", 0.7);
    intranet.navigateTo("Sitemap");
    sikuli.find("Sitemap.png", "Sitemap page", 0.7);
    driver.close();
}

From source file:com.googlesites.IntranetTests.java

@Test(groups = "sikuli", priority = 1)
public void navigateToIntranet() {

    driver = new FirefoxDriver(new FirefoxBinary(new File(Config.getPropertyValue("firefoxLocation"))),
            profile);//from w ww. j av a 2 s . co m
    driver.manage().window().maximize();
    WebDriverInstance wdi = new WebDriverInstance();
    wdi.setCurrentDriver(driver);
    overview = new Overview(driver);
    overview.navigateToOverviewPage();
    loginPage = overview.navigateToLogin();
    sites = loginPage.logIn("johnjjones02@gmail.com", "MyPasswordIsC0@l");
    site = sites.navigateToSite("intranetlintranetl111");
    intranet = new IntranetPage(driver);
}

From source file:com.googlesites.MapsTests.java

@Test(priority = 1, groups = "sikuli")
public void navigateToMaps() {
    driver = new FirefoxDriver(new FirefoxBinary(new File(Config.getPropertyValue("firefoxLocation"))),
            profile);//from w w w.  j  a  v a  2s . c  o m
    driver.manage().window().maximize();
    WebDriverInstance wdi = new WebDriverInstance();
    wdi.setCurrentDriver(driver);
    overview = new Overview(driver);
    overview.navigateToOverviewPage();
    loginPage = overview.navigateToLogin();
    sites = loginPage.logIn("johnjjones02@gmail.com", "MyPasswordIsC0@l");
    maps = sites.navigateToMaps();

}

From source file:com.googlesites.SanityTests.java

@BeforeClass
public void before() {

    driver = new FirefoxDriver(new FirefoxBinary(new File(Config.getPropertyValue("firefoxLocation"))),
            profile);//from w  w w  .ja  v a2 s . c  o  m
    driver.manage().window().maximize();
    WebDriverInstance wdi = new WebDriverInstance();
    wdi.setCurrentDriver(driver);
}

From source file:com.googlesites.WebDriverInstance.java

public static WebDriver startDriver() {
    driver = new FirefoxDriver(new FirefoxBinary(new File(Config.getPropertyValue("firefoxLocation"))),
            profile);//from   w w w. j  av a  2 s  .c  om
    return driver;
}

From source file:com.liferay.cucumber.selenium.WebDriverUtil.java

License:Open Source License

private WebDriver _getFirefoxDriver() {
    FirefoxProfile firefoxProfile = new FirefoxProfile();

    firefoxProfile.setPreference("browser.download.folderList", 2);
    firefoxProfile.setPreference("browser.download.manager.showWhenStarting", false);
    firefoxProfile.setPreference("browser.download.useDownloadDir", true);
    firefoxProfile.setPreference("browser.helperApps.alwaysAsk.force", false);
    firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
            "application/excel,application/msword,application/pdf,"
                    + "application/zip,audio/mpeg3,image/jpeg,image/png,text/plain");
    firefoxProfile.setPreference("dom.max_chrome_script_run_time", 300);
    firefoxProfile.setPreference("dom.max_script_run_time", 300);

    if (Validator.isNotNull(PropsValues.BROWSER_FIREFOX_BIN_FILE)) {
        File file = new File(PropsValues.BROWSER_FIREFOX_BIN_FILE);

        FirefoxBinary firefoxBinary = new FirefoxBinary(file);

        return new FirefoxDriver(firefoxBinary, firefoxProfile);
    } else {/*  ww w.  j  a  v  a  2 s  .c o  m*/
        return new FirefoxDriver(firefoxProfile);
    }
}

From source file:com.partnet.automation.selenium.AbstractConfigurableDriverProvider.java

License:Apache License

/**
 * Obtains the default firefox web driver.
 * /*from   w  w w.j av  a 2 s.  com*/
 * @return {@link WebDriver} for the Firefox instance
 */
protected WebDriver getFirefoxWebDriver() {

    final FirefoxBinary fb;
    String fireboxBinPath = runConfig.getFirefoxBinaryPath();

    if (fireboxBinPath != null) {
        LOG.info("Using Firefox binary: {}", fireboxBinPath);
        fb = new FirefoxBinary(new File(fireboxBinPath));
    } else {
        LOG.info("Use system default for the Firefox binary");
        fb = new FirefoxBinary();
    }

    final DesiredCapabilities capabilities = getFirefoxCapabilities();
    capabilities.setCapability(FirefoxDriver.BINARY, fb);

    return new FirefoxDriver(capabilities);
}

From source file:com.sebuilder.interpreter.webdriverfactory.Firefox.java

License:Apache License

/**
 * @param config Key/value pairs treated as required capabilities, with the exception of:
 *        <ul>/*from  w w  w .j  a va  2  s.  c  o  m*/
 *         <li>binary: path to Firefox binary to use</li>
 *          <li>profile: path to Firefox profile to use</li>
 *        </ul>
 * @return A FirefoxDriver.
 */
@Override
public RemoteWebDriver make(HashMap<String, String> config) {
    FirefoxBinary fb = config.containsKey("binary") ? new FirefoxBinary(new File(config.get("binary")))
            : new FirefoxBinary();
    FirefoxProfile fp = config.containsKey("profile") ? new FirefoxProfile(new File(config.get("profile")))
            : new FirefoxProfile();
    HashMap<String, String> caps = new HashMap<String, String>(config);
    caps.remove("binary");
    caps.remove("profile");
    return new FirefoxDriver(fb, fp, new DesiredCapabilities(caps));
}

From source file:com.sugarcrm.candybean.automation.VInterface.java

License:Open Source License

private WebDriver getWebDriver(Type iType) throws Exception {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    //        capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.ACCEPT);
    WebDriver wd = null;//from  w w w . ja v  a2  s  . c  o m
    switch (iType) {
    case FIREFOX:
        String profileName = this.config.getValue("browser.firefox_profile", "default");
        File ffBinaryPath = new File(this.config.getPathValue("browser.firefox_binary"));
        FirefoxProfile ffProfile = (new ProfilesIni()).getProfile(profileName);
        //         ffProfile.setEnableNativeEvents(false);
        FirefoxBinary ffBinary = new FirefoxBinary(ffBinaryPath);
        // if (System.getProperty("headless") != null) {
        // FirefoxBinary ffBinary = new FirefoxBinary();//new
        // File("//home//conrad//Applications//firefox-10//firefox"));
        // ffBinary.setEnvironmentProperty("DISPLAY", ":1");
        // webDriver = new FirefoxDriver(ffBinary, ffProfile);
        // }
        candybean.log.info("Instantiating Firefox with profile name: " + profileName + " and binary path: "
                + ffBinaryPath);
        wd = new FirefoxDriver(ffBinary, ffProfile);
        break;
    case CHROME:
        ChromeOptions chromeOptions = new ChromeOptions();
        String chromeDriverLogPath = this.config.getPathValue("browser.chrome_driver_log_path");
        candybean.log.info("chromeDriverLogPath: " + chromeDriverLogPath);
        chromeOptions.addArguments("--log-path=" + chromeDriverLogPath);
        String chromeDriverPath = this.config.getPathValue("browser.chrome_driver_path");
        candybean.log.info("chromeDriverPath: " + chromeDriverPath);
        // chromeOptions.setBinary(new File(chromeDriverPath));
        System.setProperty("webdriver.chrome.driver", chromeDriverPath);
        candybean.log.info("Instantiating Chrome with:\n    log path:" + chromeDriverLogPath
                + "\n    driver path: " + chromeDriverPath);
        wd = new ChromeDriver(chromeOptions);
        break;
    case IE:
        String ieDriverPath = this.config.getPathValue("browser.ie_driver_path");
        candybean.log.info("ieDriverPath: " + ieDriverPath);
        System.setProperty("webdriver.ie.driver", ieDriverPath);
        capabilities = DesiredCapabilities.internetExplorer();
        wd = new InternetExplorerDriver(capabilities);
        break;
    case SAFARI:
        throw new Exception("Selenium: safari browser not yet supported.");
    case ANDROID:
        capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
        capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
        capabilities.setCapability("app", "https://s3.amazonaws.com/voodoo2/ApiDemos-debug.apk");
        wd = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
        break;
    case IOS:
        capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
        capabilities.setCapability(CapabilityType.VERSION, "6.0");
        capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
        capabilities.setCapability("app", "https://s3.amazonaws.com/voodoo2/TestApp.zip");
        wd = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
        break;
    default:
        throw new Exception("Selenium: browser type not recognized.");
    }
    long implicitWait = Long.parseLong(config.getValue("perf.implicit_wait_seconds"));
    if (System.getProperty("headless") == null) {
        java.awt.Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        wd.manage().window().setSize(new Dimension(screenSize.width, screenSize.height));
    }
    wd.manage().timeouts().implicitlyWait(implicitWait, TimeUnit.SECONDS);
    return wd;
}