List of usage examples for org.openqa.selenium.firefox FirefoxDriver PROFILE
String PROFILE
To view the source code for org.openqa.selenium.firefox FirefoxDriver PROFILE.
Click Source Link
From source file:com.seleniumtests.ut.browserfactory.TestFirefoxCapabilitiesFactory.java
License:Apache License
@Test(groups = { "ut" }) public void testCreateDefaultFirefoxCapabilities() { Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL); Mockito.when(config.isSetAcceptUntrustedCertificates()).thenReturn(true); Mockito.when(config.isSetAssumeUntrustedCertificateIssuer()).thenReturn(true); MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities(); Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), "firefox"); Assert.assertEquals(capa.getCapability(FirefoxDriver.MARIONETTE), false); FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE); // check profile Assert.assertTrue(profile.getBooleanPreference("webdriver_accept_untrusted_certs", false)); Assert.assertTrue(profile.getBooleanPreference("webdriver_assume_untrusted_issuer", false)); Assert.assertEquals(profile.getStringPreference("capability.policy.default.Window.QueryInterface", ""), FirefoxCapabilitiesFactory.ALL_ACCESS); Assert.assertEquals(profile.getStringPreference("capability.policy.default.Window.frameElement.get", ""), FirefoxCapabilitiesFactory.ALL_ACCESS); Assert.assertEquals(// www . j av a 2s.c om profile.getStringPreference("capability.policy.default.HTMLDocument.compatMode.get", ""), FirefoxCapabilitiesFactory.ALL_ACCESS); Assert.assertEquals(profile.getStringPreference("capability.policy.default.Document.compatMode.get", ""), FirefoxCapabilitiesFactory.ALL_ACCESS); Assert.assertEquals(profile.getIntegerPreference("dom.max_chrome_script_run_time", 100), 0); Assert.assertEquals(profile.getIntegerPreference("dom.max_script_run_time", 100), 0); }
From source file:com.seleniumtests.ut.browserfactory.TestFirefoxCapabilitiesFactory.java
License:Apache License
@Test(groups = { "ut" }) public void testCreateFirefoxCapabilitiesOverrideUserAgent() { Mockito.when(config.getUserAgentOverride()).thenReturn("FIREFOX 55"); MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities(); FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE); // check profile Assert.assertEquals(profile.getStringPreference("general.useragent.override", ""), "FIREFOX 55"); }
From source file:com.seleniumtests.ut.browserfactory.TestFirefoxCapabilitiesFactory.java
License:Apache License
@Test(groups = { "ut" }) public void testCreateFirefoxCapabilitiesOverrideNtlmAuth() { Mockito.when(config.getNtlmAuthTrustedUris()).thenReturn("uri://uri.ntlm"); MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities(); FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE); // check profile Assert.assertEquals(profile.getStringPreference("network.automatic-ntlm-auth.trusted-uris", ""), "uri://uri.ntlm"); }
From source file:com.seleniumtests.ut.browserfactory.TestFirefoxCapabilitiesFactory.java
License:Apache License
@Test(groups = { "ut" }) public void testCreateFirefoxCapabilitiesOverrideDownloadDir() { Mockito.when(config.getBrowserDownloadDir()).thenReturn("/home/download"); MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities(); FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE); // check profile Assert.assertEquals(profile.getStringPreference("browser.download.dir", ""), "/home/download"); Assert.assertEquals(profile.getIntegerPreference("browser.download.folderList", 0), 2); Assert.assertEquals(profile.getBooleanPreference("browser.download.manager.showWhenStarting", true), false); Assert.assertEquals(profile.getStringPreference("browser.helperApps.neverAsk.saveToDisk", ""), "application/octet-stream,text/plain,application/pdf,application/zip,text/csv,text/html"); }
From source file:com.seleniumtests.ut.browserfactory.TestMarionetteCapabilitiesFactory.java
License:Apache License
@Test(groups = { "ut" }) public void testCreateDefaultMarionetteCapabilities() { Mockito.when(config.getMode()).thenReturn(DriverMode.LOCAL); Mockito.when(config.isSetAcceptUntrustedCertificates()).thenReturn(true); Mockito.when(config.isSetAssumeUntrustedCertificateIssuer()).thenReturn(true); MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities(); Assert.assertEquals(capa.getCapability(CapabilityType.BROWSER_NAME), "firefox"); Assert.assertEquals(capa.getCapability(FirefoxDriver.MARIONETTE), true); FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE); // check profile Assert.assertTrue(profile.getBooleanPreference("webdriver_accept_untrusted_certs", false)); Assert.assertTrue(profile.getBooleanPreference("webdriver_assume_untrusted_issuer", false)); Assert.assertEquals(profile.getStringPreference("capability.policy.default.Window.QueryInterface", ""), FirefoxCapabilitiesFactory.ALL_ACCESS); Assert.assertEquals(profile.getStringPreference("capability.policy.default.Window.frameElement.get", ""), FirefoxCapabilitiesFactory.ALL_ACCESS); Assert.assertEquals(//from www .j a v a 2 s . c om profile.getStringPreference("capability.policy.default.HTMLDocument.compatMode.get", ""), FirefoxCapabilitiesFactory.ALL_ACCESS); Assert.assertEquals(profile.getStringPreference("capability.policy.default.Document.compatMode.get", ""), FirefoxCapabilitiesFactory.ALL_ACCESS); Assert.assertEquals(profile.getIntegerPreference("dom.max_chrome_script_run_time", 100), 0); Assert.assertEquals(profile.getIntegerPreference("dom.max_script_run_time", 100), 0); }
From source file:com.seleniumtests.ut.browserfactory.TestMarionetteCapabilitiesFactory.java
License:Apache License
@Test(groups = { "ut" }) public void testCreateMarionetteCapabilitiesOverrideUserAgent() { Mockito.when(config.getUserAgentOverride()).thenReturn("FIREFOX 55"); MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities(); FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE); // check profile Assert.assertEquals(profile.getStringPreference("general.useragent.override", ""), "FIREFOX 55"); }
From source file:com.seleniumtests.ut.browserfactory.TestMarionetteCapabilitiesFactory.java
License:Apache License
@Test(groups = { "ut" }) public void testCreateMarionetteCapabilitiesOverrideNtlmAuth() { Mockito.when(config.getNtlmAuthTrustedUris()).thenReturn("uri://uri.ntlm"); MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities(); FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE); // check profile Assert.assertEquals(profile.getStringPreference("network.automatic-ntlm-auth.trusted-uris", ""), "uri://uri.ntlm"); }
From source file:com.seleniumtests.ut.browserfactory.TestMarionetteCapabilitiesFactory.java
License:Apache License
@Test(groups = { "ut" }) public void testCreateMarionetteCapabilitiesOverrideDownloadDir() { Mockito.when(config.getBrowserDownloadDir()).thenReturn("/home/download"); MutableCapabilities capa = new FirefoxCapabilitiesFactory(config).createCapabilities(); FirefoxProfile profile = (FirefoxProfile) capa.getCapability(FirefoxDriver.PROFILE); // check profile Assert.assertEquals(profile.getStringPreference("browser.download.dir", ""), "/home/download"); Assert.assertEquals(profile.getIntegerPreference("browser.download.folderList", 0), 2); Assert.assertEquals(profile.getBooleanPreference("browser.download.manager.showWhenStarting", true), false); Assert.assertEquals(profile.getStringPreference("browser.helperApps.neverAsk.saveToDisk", ""), "application/octet-stream,text/plain,application/pdf,application/zip,text/csv,text/html"); }
From source file:com.worldline.easycukes.selenium.WebDriverFactory.java
License:Open Source License
/** * Allows to customize and configure the options of a Firefox session * * @return DesiredCapabilities//from ww w. j a va 2 s .co m */ private static DesiredCapabilities firefoxCapabilities() { final FirefoxProfile profile = new FirefoxProfile(); // FirefoxProfile profile = new ProfilesIni().getProfile("default"); final DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(FirefoxDriver.PROFILE, profile); return capabilities; }
From source file:edu.samplu.common.WebDriverUtil.java
License:Educational Community License
/** * remote.public.driver set to chrome or firefox (null assumes firefox) * if remote.public.hub is set a RemoteWebDriver is created (Selenium Grid) * if proxy.host is set, the web driver is setup to use a proxy * @return WebDriver or null if unable to create *//*from ww w . ja v a 2 s . c om*/ public static WebDriver getWebDriver() { String driverParam = System.getProperty(ITUtil.HUB_DRIVER_PROPERTY); String hubParam = System.getProperty(ITUtil.HUB_PROPERTY); String proxyParam = System.getProperty(PROXY_HOST_PROPERTY); // setup proxy if specified as VM Arg DesiredCapabilities capabilities = new DesiredCapabilities(); WebDriver webDriver = null; if (StringUtils.isNotEmpty(proxyParam)) { capabilities.setCapability(CapabilityType.PROXY, new Proxy().setHttpProxy(proxyParam)); } if (hubParam == null) { if (driverParam == null || "firefox".equalsIgnoreCase(driverParam)) { FirefoxProfile profile = new FirefoxProfile(); profile.setEnableNativeEvents(false); capabilities.setCapability(FirefoxDriver.PROFILE, profile); return new FirefoxDriver(capabilities); } else if ("chrome".equalsIgnoreCase(driverParam)) { return new ChromeDriver(capabilities); } else if ("safari".equals(driverParam)) { System.out.println("SafariDriver probably won't work, if it does please contact Erik M."); return new SafariDriver(capabilities); } } else { try { if (driverParam == null || "firefox".equalsIgnoreCase(driverParam)) { return new RemoteWebDriver(new URL(ITUtil.getHubUrlString()), DesiredCapabilities.firefox()); } else if ("chrome".equalsIgnoreCase(driverParam)) { return new RemoteWebDriver(new URL(ITUtil.getHubUrlString()), DesiredCapabilities.chrome()); } } catch (MalformedURLException mue) { System.out.println(ITUtil.getHubUrlString() + " " + mue.getMessage()); mue.printStackTrace(); } } return null; }