List of usage examples for org.openqa.selenium.firefox FirefoxDriver FirefoxDriver
public FirefoxDriver(FirefoxDriverService service)
From source file:com.crawljax.plugins.testilizer.generated.claroline_EXND.GeneratedTestCase11.java
@Before public void setUp() throws Exception { // Setting the JavaScript code coverage switch getCoverageReport = com.crawljax.plugins.testilizer.Testilizer.getCoverageReport(); if (getCoverageReport) driver = new FirefoxDriver(getProfile()); else//w w w. j a v a 2s. c om driver = new FirefoxDriver(); url = "http://localhost:8888/claroline-1.11.7/index.php?logout=true"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); }
From source file:com.crawljax.plugins.testilizer.generated.photogallery_EXND.GeneratedTestCase38.java
@Before public void setUp() throws Exception { // Setting the JavaScript code coverage switch getCoverageReport = com.crawljax.plugins.testilizer.Testilizer.getCoverageReport(); if (getCoverageReport) driver = new FirefoxDriver(getProfile()); else/*from www.j a va 2 s. c o m*/ driver = new FirefoxDriver(); url = "http://localhost:8888/phormer331/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); }
From source file:com.crawljax.plugins.testilizer.generated.photogallery_RAND.GeneratedTestCase1.java
@Before public void setUp() throws Exception { // Setting the JavaScript code coverage switch getCoverageReport = com.crawljax.plugins.testilizer.Testilizer.getCoverageReport(); if (getCoverageReport) driver = new FirefoxDriver(getProfile()); else/*from w w w.j a v a 2 s. co m*/ driver = new FirefoxDriver(); url = "http://localhost:8888/phormer331/admin.php"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); }
From source file:com.dhenton9000.screenshots.ScreenShotLauncher.java
/** * set up the webdriver/*from w w w . ja v a 2 s . c o m*/ * * @return */ private WebDriver configureDriver() { WebDriver driver = null; LoggingPreferences logs = new LoggingPreferences(); logs.enable(LogType.BROWSER, Level.SEVERE); logs.enable(LogType.CLIENT, Level.SEVERE); logs.enable(LogType.DRIVER, Level.SEVERE); logs.enable(LogType.PERFORMANCE, Level.SEVERE); logs.enable(LogType.PROFILER, Level.SEVERE); logs.enable(LogType.SERVER, Level.SEVERE); DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox(); desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, logs); LOG.debug("creating firefox driver"); driver = new FirefoxDriver(desiredCapabilities); LOG.debug("got firefox driver"); driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS); LOG.debug("driver is loaded via config " + driver.toString()); return driver; }
From source file:com.dhenton9000.selenium.generic.GenericAutomationRepository.java
/** * set up the driver with configuration parameters * */// ww w . j a v a2 s.com private void configureDriver() { LoggingPreferences logs = new LoggingPreferences(); logs.enable(LogType.BROWSER, Level.SEVERE); logs.enable(LogType.CLIENT, Level.SEVERE); logs.enable(LogType.DRIVER, Level.SEVERE); logs.enable(LogType.PERFORMANCE, Level.SEVERE); logs.enable(LogType.PROFILER, Level.SEVERE); logs.enable(LogType.SERVER, Level.SEVERE); String driverTypeString = this.config.getString("test.selenium.browser"); if (driverTypeString == null) { throw new RuntimeException("must specify 'test.selenium.browser' in prop file"); } DRIVER_TYPES driverType = DRIVER_TYPES.valueOf(driverTypeString); LOG.debug(" found driver type " + driverType.toString()); if (driverType == null) { throw new RuntimeException("cannot find driver type of " + driverTypeString); } switch (driverType) { case FireFox: default: DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox(); desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, logs); // sets the driver to automatically skip download dialog // and save csv,xcel files to a temp directory // that directory is set in the constructor and has a trailing // slash FirefoxProfile firefoxProfile = new FirefoxProfile(); firefoxProfile.setPreference("browser.download.folderList", 2); firefoxProfile.setPreference("browser.download.manager.showWhenStarting", false); String target = this.getTempDownloadPath(); firefoxProfile.setPreference("browser.download.dir", target); firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv,application/vnd.ms-excel"); desiredCapabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile); LOG.debug("creating firefox driver"); driver = new FirefoxDriver(desiredCapabilities); LOG.debug("got firefox driver"); break; case InternetExplorer: break; case Opera: break; case Safari: break; case Chrome: break; } driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS); LOG.debug("driver is loaded via config " + driver.toString()); }
From source file:com.ecofactor.qa.automation.util.HttpsUtil.java
License:Open Source License
/** * Load driver.// ww w . j a v a 2 s . co m */ public static void loadDriver() { /*driver = LocalDriverFactory.createInstance(LocalDriverFactory.FIREFOX); driver.manage().window().maximize(); WaitUtil.veryHugeWait();*/ ProfilesIni firefoxProfile = new ProfilesIni(); FirefoxProfile profile = firefoxProfile.getProfile("default"); driver = new FirefoxDriver(profile); driver.manage().window().maximize(); largeWait(); /*WebDriver driver = LocalDriverFactory.createInstance(LocalDriverFactory.FIREFOX); LocalDriverManager.setWebDriver(driver); LocalDriverManager.getDriver().manage().window().maximize(); DriverConfig.setLogString("Wait for few seconds after driver initialize", true);*/ }
From source file:com.elastica.browserfactory.FirefoxDriverFactory.java
License:Apache License
/** * create native driver instance, designed for unit testing. * * @return//from w w w. j a v a 2s. c om */ protected WebDriver createNativeDriver() { return new FirefoxDriver(new FirefoxCapabilitiesFactory().createCapabilities(webDriverConfig)); }
From source file:com.epam.jdi.uitests.web.selenium.driver.SeleniumDriverFactory.java
License:Open Source License
protected String registerLocalDriver(DriverTypes driverType) { switch (driverType) { case CHROME:/*from w ww . j a v a2 s .co m*/ return registerDriver(driverType, () -> { if (getLatestDriver) { return webDriverSettings.apply(initChrome()); } else { setProperty("webdriver.chrome.driver", getChromeDriverPath(driversPath)); return webDriverSettings.apply(new ChromeDriver(defaultChromeOptions())); } }); case FIREFOX: return registerDriver(driverType, () -> { if (getLatestDriver) { return webDriverSettings.apply(initFirefox()); } else { setProperty("webdriver.gecko.driver", getFirefoxDriverPath(driversPath)); return webDriverSettings.apply(new FirefoxDriver(defaultFirefoxOptions())); } }); case IE: return registerDriver(driverType, () -> { if (getLatestDriver) { return webDriverSettings.apply(initIE()); } else { setProperty("webdriver.ie.driver", getIEDriverPath(driversPath)); return webDriverSettings.apply(new InternetExplorerDriver(defaultIEOptions())); } }); } throw exception("Unknown driver: " + driverType); }
From source file:com.epam.jdi.uitests.web.selenium.driver.SeleniumDriverFactory.java
License:Open Source License
private WebDriver initFirefox() { FirefoxDriverManager.getInstance().arch32().setup(); return new FirefoxDriver(defaultFirefoxOptions()); }
From source file:com.evidon.areweprivateyet.Crawler.java
License:Open Source License
public Crawler(String namedProfile) throws Exception { loadSiteList();/*from w w w . ja va 2s .com*/ int sleepTime = (namedProfile.equals("baseline") ? 10 : 5); boolean started = false; String baseWindow = ""; FirefoxProfile profile = new ProfilesIni().getProfile(namedProfile); //profile.setPreference("webdriver.load.strategy", "fast"); WebDriver driver = new FirefoxDriver(profile); driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS); driver.manage().timeouts().setScriptTimeout(40, TimeUnit.SECONDS); // figure out where the fucking profile is. wow! String profileDir = getDriverProfile(); log("Crawling started for " + namedProfile); int count = 0; for (String url : urls) { if (!started) { // Original window handle to be used as base. Used so we can close all other popups. baseWindow = driver.getWindowHandle(); started = true; } count++; log("\t" + count + ". navigating to: " + url); CrawlusInterruptus ci = new CrawlusInterruptus(60); try { ci.start(); try { // Confirm handling for one of those super fucking annoying "Are you sure you wonna go anywhere else?" driver.switchTo().alert().accept(); log("\tAccepted a navigate away modal"); } catch (Exception e) { } driver.get("http://" + url); // WTF, why would their own fucking wait not work?!? // new WebDriverWait(driver, 5 * 1000); } catch (TimeoutException te) { handleTimeout(baseWindow, url, driver); } catch (org.openqa.selenium.UnhandledAlertException me) { log("\tModal exception caused by previous site?"); // Retry current site. try { driver.get("http://" + url); } catch (TimeoutException te) { handleTimeout(baseWindow, url, driver); } } finally { ci.interrupt(); } try { Thread.sleep(sleepTime * 1000); } catch (InterruptedException e) { } killPopups(baseWindow, driver); } // 4th party does not know when the crawl is over, so we send a trip signal by navigating to the "last" domain try { driver.get("http://www.josesignanini.com"); } catch (TimeoutException te) { } try { Thread.sleep(60 * 1000); } catch (InterruptedException e) { } // copy the fourthparty database out. FileUtils.copyFile(new File(profileDir + "/fourthparty.sqlite"), new File(path + "/fourthparty-" + namedProfile + ".sqlite")); driver.quit(); log("Crawling completed for " + namedProfile); recordLog(namedProfile); }