List of usage examples for org.openqa.selenium.firefox FirefoxProfile setAssumeUntrustedCertificateIssuer
public void setAssumeUntrustedCertificateIssuer(boolean untrustedIssuer)
From source file:jp.co.nssol.h5.test.selenium.base.DriverFactory.java
License:Apache License
/** * FireFox????/*w w w. j a va 2s. c o m*/ * * @return */ private static WebDriver setupFireFoxDriver() { FirefoxProfile profile = null; try { File file = new File(SettingsReader.getProperty(PKEY_FIREBUG_PATH)); profile = new FirefoxProfile(); profile.addExtension(file); profile.setAcceptUntrustedCertificates(true); profile.setAssumeUntrustedCertificateIssuer(false); profile.setPreference("extensions.firebug.currentVersion", "1.9.1"); } catch (IOException e) { e.printStackTrace(); } return new FirefoxDriver(profile) { @Override public String toString() { return "FireFox"; } }; }
From source file:net.continuumsecurity.web.drivers.DriverFactory.java
License:Open Source License
public WebDriver createFirefoxDriver(DesiredCapabilities capabilities) { if (capabilities != null) { return new FirefoxDriver(capabilities); }/*www . ja v a 2 s. c o m*/ ProfilesIni allProfiles = new ProfilesIni(); FirefoxProfile myProfile = allProfiles.getProfile("WebDriver"); if (myProfile == null) { File ffDir = new File(System.getProperty("user.dir") + File.separator + "ffProfile"); if (!ffDir.exists()) { ffDir.mkdir(); } myProfile = new FirefoxProfile(ffDir); } myProfile.setAcceptUntrustedCertificates(true); myProfile.setAssumeUntrustedCertificateIssuer(true); myProfile.setPreference("webdriver.load.strategy", "unstable"); if (capabilities == null) { capabilities = new DesiredCapabilities(); } capabilities.setCapability(FirefoxDriver.PROFILE, myProfile); return new FirefoxDriver(capabilities); }
From source file:org.cerberus.engine.execution.impl.SeleniumServerService.java
License:Open Source License
/** * Instanciate DesiredCapabilities regarding the browser * @param capabilities/*from ww w . j ava 2s .c om*/ * @param browser * @param tCExecution * @return * @throws CerberusException */ private DesiredCapabilities setCapabilityBrowser(DesiredCapabilities capabilities, String browser, TestCaseExecution tCExecution) throws CerberusException { try { if (browser.equalsIgnoreCase("firefox")) { capabilities = DesiredCapabilities.firefox(); FirefoxProfile profile = new FirefoxProfile(); profile.setAcceptUntrustedCertificates(true); profile.setAssumeUntrustedCertificateIssuer(true); profile.setPreference("app.update.enabled", false); profile.setEnableNativeEvents(true); try { Invariant invariant = this.invariantService.findInvariantByIdValue("COUNTRY", tCExecution.getCountry()); if (invariant.getGp2() == null) { LOG.warn("Country selected (" + tCExecution.getCountry() + ") has no value of GP2 in Invariant table, default language set to English (en)"); profile.setPreference("intl.accept_languages", "en"); } else { profile.setPreference("intl.accept_languages", invariant.getGp2()); } } catch (CerberusException ex) { LOG.warn("Country selected (" + tCExecution.getCountry() + ") not in Invariant table, default language set to English (en)"); profile.setPreference("intl.accept_languages", "en"); } capabilities.setCapability("acceptInsecureCerts", true); capabilities.setCapability("acceptSslCerts", true); //capabilities.setCapability("marionette", true); capabilities.setCapability(FirefoxDriver.PROFILE, profile); } else if (browser.equalsIgnoreCase("IE")) { capabilities = DesiredCapabilities.internetExplorer(); } else if (browser.equalsIgnoreCase("chrome")) { capabilities = DesiredCapabilities.chrome(); } else if (browser.contains("android")) { capabilities = DesiredCapabilities.android(); } else if (browser.contains("ipad")) { capabilities = DesiredCapabilities.ipad(); } else if (browser.contains("iphone")) { capabilities = DesiredCapabilities.iphone(); } else if (browser.contains("opera")) { capabilities = DesiredCapabilities.opera(); } else if (browser.contains("safari")) { capabilities = DesiredCapabilities.safari(); } else { LOG.warn("Not supported Browser : " + browser); MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM); mes.setDescription( mes.getDescription().replace("%MES%", "Browser '" + browser + "' is not supported")); mes.setDescription("Not supported Browser : " + browser); throw new CerberusException(mes); } } catch (CerberusException ex) { MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM); mes.setDescription(mes.getDescription().replace("%MES%", "Failed to set capability on the browser '" + browser + "' due to " + ex.getMessageError().getDescription())); throw new CerberusException(mes); } return capabilities; }
From source file:org.kitodo.selenium.testframework.Browser.java
License:Open Source License
private static void provideGeckoDriver() throws IOException { String driverFileName = "geckodriver"; if (SystemUtils.IS_OS_WINDOWS) { driverFileName = driverFileName.concat(".exe"); }/*from w w w .jav a 2 s . c o m*/ File driverFile = new File(DRIVER_DIR + driverFileName); if (!driverFile.exists()) { WebDriverProvider.provideGeckoDriver(GECKO_DRIVER_VERSION, DOWNLOAD_DIR, DRIVER_DIR); } FirefoxProfile profile = new FirefoxProfile(); profile.setAssumeUntrustedCertificateIssuer(false); profile.setPreference("browser.helperApps.alwaysAsk.force", false); profile.setPreference("browser.download.dir", DOWNLOAD_DIR); FirefoxOptions options = new FirefoxOptions(); options.setProfile(profile); webDriver = new FirefoxDriver(options); }
From source file:org.securitytests.cisecurity.drivers.DriverFactory.java
License:Open Source License
public WebDriver createFirefoxDriver(DesiredCapabilities capabilities) { if (capabilities != null) { return new FirefoxDriver(capabilities); }/*from www . jav a2 s .c o m*/ ProfilesIni allProfiles = new ProfilesIni(); FirefoxProfile myProfile = allProfiles.getProfile("WebDriver"); if (myProfile == null) { File ffDir = new File(System.getProperty("user.dir") + File.separator + "ffProfile"); if (!ffDir.exists()) { ffDir.mkdir(); } myProfile = new FirefoxProfile(ffDir); } myProfile.setAcceptUntrustedCertificates(true); myProfile.setAssumeUntrustedCertificateIssuer(true); myProfile.setPreference("webdriver.load.strategy", "unstable"); if (capabilities == null) { capabilities = new DesiredCapabilities(); } capabilities.setCapability(FirefoxDriver.PROFILE, myProfile); return new FirefoxDriver(capabilities); }
From source file:test.firefox.FirefoxTest.java
License:Open Source License
public static void firefox(String baseurl, boolean useKeycloak) { WebDriver driver = null;/*w ww.jav a 2 s . co m*/ try { ProfilesIni allProfiles = new ProfilesIni(); FirefoxProfile myProfile = allProfiles.getProfile("default"); myProfile.setAcceptUntrustedCertificates(true); myProfile.setAssumeUntrustedCertificateIssuer(false); FirefoxDriverManager.getInstance().setup(); driver = new FirefoxDriver(myProfile); driver.manage().window().setSize(new Dimension(Utils.WINDOW_WIDTH, Utils.WINDOW_HEIGHT)); driver.manage().timeouts().implicitlyWait(Utils.DEFAULT_WAITING_TIME, TimeUnit.SECONDS); TestScenario.useKeycloak = useKeycloak; TestScenario.test(driver, baseurl); } finally { if (driver != null) { driver.quit(); } } }