org.openqa.selenium.remote.CapabilityType Java Examples

The following examples show how to use org.openqa.selenium.remote.CapabilityType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutomationRunContextTest.java    From SeleniumGridScaler with GNU General Public License v2.0 6 votes vote down vote up
@Test
// Tests that for an old run, the in progress tests are counted
public void testOldRunInProgress() {
    String uuid = "testUuid";
    AutomationRunContext runContext = new AutomationRunContext();
    runContext.setTotalNodeCount(10);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.PLATFORM,"linux");
    capabilities.put(CapabilityType.BROWSER_NAME,"chrome");
    capabilities.put(AutomationConstants.UUID,uuid);
    AutomationRunRequest request = new AutomationRunRequest(uuid,10,"chrome","23","linux", AutomationUtils.modifyDate(new Date(),-5,Calendar.MINUTE));
    runContext.addRun(request);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    testSlot.getNewSession(capabilities);
    int inProgressTests = 5;
    proxy.setMultipleTestSlots(testSlot,inProgressTests);
    proxySet.add(proxy);
    int freeThreads = runContext.getTotalThreadsAvailable(proxySet);
    Assert.assertEquals("Free threads should reflect in progress test count",inProgressTests,freeThreads);
}
 
Example #2
Source File: SugarAndroidTest.java    From candybean with GNU Affero General Public License v3.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    // set up appium
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "Selendroid");

    capabilities.setCapability(CapabilityType.VERSION, "4.2.2");

    capabilities.setCapability("device", "Android");
    capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
    capabilities.setCapability("app", "https://s3.amazonaws.com/voodoo2/SugarCRM.apk.zip");
    capabilities.setCapability("app-package", "com.sugarcrm.nomad");
    capabilities.setCapability("app-activity", "NomadActivity");

    driver = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    values = new ArrayList<>();
}
 
Example #3
Source File: AutomationRequestMatcherTest.java    From SeleniumGridScaler with GNU General Public License v2.0 6 votes vote down vote up
@Test
// Tests that a node in the Terminated state without an instance id is still considered a valid resource
public void testRequestNodeTerminatedNoInstanceId() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),10);
    node.updateStatus(AutomationDynamicNode.STATUS.TERMINATED);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    proxy.setMaxNumberOfConcurrentTestSessions(5);
    Map<String,Object> config = new HashMap<>();
    proxy.setConfig(config);
    List<TestSlot> testSlots = new ArrayList<TestSlot>();
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,browser);
    testSlots.add(new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities));
    proxy.setTestSlots(testSlots);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    AutomationRequestMatcher requestMatcher = new AutomationRequestMatcher();
    int freeThreads = requestMatcher.getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("Node should be available since instance id was not on the node", 1, freeThreads);
}
 
Example #4
Source File: JsonOutputTest.java    From selenium with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldConvertAProxyCorrectly() {
  Proxy proxy = new Proxy();
  proxy.setHttpProxy("localhost:4444");

  MutableCapabilities caps = new DesiredCapabilities("foo", "1", Platform.LINUX);
  caps.setCapability(CapabilityType.PROXY, proxy);
  Map<String, ?> asMap = ImmutableMap.of("desiredCapabilities", caps);
  Command command = new Command(new SessionId("empty"), DriverCommand.NEW_SESSION, asMap);

  String json = convert(command.getParameters());

  JsonObject converted = new JsonParser().parse(json).getAsJsonObject();
  JsonObject capsAsMap = converted.get("desiredCapabilities").getAsJsonObject();

  assertThat(capsAsMap.get(CapabilityType.PROXY).getAsJsonObject().get("httpProxy").getAsString())
      .isEqualTo(proxy.getHttpProxy());
}
 
Example #5
Source File: UiTestBase.java    From cloud-personslist-scenario with Apache License 2.0 6 votes vote down vote up
private static void setupFirefox() {
	final DesiredCapabilities capabilities = new DesiredCapabilities();
	final String proxyHost = System.getProperty("http.proxyHost");
	final String proxyPort = System.getProperty("http.proxyPort");
	if (proxyHost != null) {
		System.out
				.println("Configuring Firefox Selenium web driver with proxy "
						+ proxyHost
						+ (proxyPort == null ? "" : ":" + proxyPort)
						+ " (requires Firefox browser)");
		final Proxy proxy = new Proxy();
		final String proxyString = proxyHost
				+ (proxyPort == null ? "" : ":" + proxyPort);
		proxy.setHttpProxy(proxyString).setSslProxy(proxyString);
		proxy.setNoProxy("localhost");
		capabilities.setCapability(CapabilityType.PROXY, proxy);
	} else {
		System.out
				.println("Configuring Firefox Selenium web driver without proxy (requires Firefox browser)");
	}

	driver = new FirefoxDriver(capabilities);
	driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
 
Example #6
Source File: AutomationRequestMatcherTest.java    From SeleniumGridScaler with GNU General Public License v2.0 6 votes vote down vote up
@Test
// Test to make sure an in progress counts against the free node count
public void testRequestNewRunNotStarted() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    String runId = "runId";
    AutomationContext.getContext().addRun(new AutomationRunRequest(runId,10,"firefox"));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("No nodes should be free since existing run hasn't started",0,freeThreads);
}
 
Example #7
Source File: Browser.java    From coteafs-selenium with Apache License 2.0 6 votes vote down vote up
private static WebDriver setupIeDriver() throws MalformedURLException {
    LOG.i("Setting up Internet Explorer driver...");
    setupDriver(iedriver());
    final InternetExplorerOptions ieOptions = new InternetExplorerOptions();
    ieOptions.destructivelyEnsureCleanSession();
    ieOptions.setCapability("requireWindowFocus", true);
    ieOptions.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    final InternetExplorerDriverService ieService = InternetExplorerDriverService.createDefaultService();
    if (!OS.isWindows()) {
        Assert.fail("IE is not supported.");
    }
    if (appSetting().isHeadlessMode()) {
        LOG.w("IE does not support headless mode. Hence, ignoring the same...");
    }
    return new InternetExplorerDriver(ieService, ieOptions);
}
 
Example #8
Source File: AutomationRunRequestTest.java    From SeleniumGridScaler with GNU General Public License v2.0 6 votes vote down vote up
@Test
// Tests that a platform of 'ANY' matches another otherwise non-matching OS
public void testOsMatchesAnyRequests() {
    String uuid = "testUuid";
    String browser = "firefox";
    String browserVersion = "25";
    String os = "ANY";
    Map<String,Object> map = new HashMap<>();
    map.put(CapabilityType.BROWSER_NAME,browser);
    map.put(CapabilityType.VERSION,browserVersion);
    map.put(CapabilityType.PLATFORM,os);
    AutomationRunRequest first = new AutomationRunRequest(uuid,null,browser,browserVersion,"linux");
    AutomationRunRequest second = AutomationRunRequest.requestFromCapabilities(map);
    Assert.assertTrue("Requests should be equal", first.matchesCapabilities(second));
    Assert.assertTrue("Requests should be equal", second.matchesCapabilities(first));
}
 
Example #9
Source File: FirefoxDriverTest.java    From selenium with Apache License 2.0 6 votes vote down vote up
@Test
@NotYetImplemented(value = MARIONETTE, reason = "https://bugzilla.mozilla.org/show_bug.cgi?id=1415067")
public void testFirefoxCanNativelyClickOverlappingElements() {
  FirefoxOptions options = new FirefoxOptions();
  options.setCapability(CapabilityType.OVERLAPPING_CHECK_DISABLED, true);
  localDriver = new FirefoxDriver(options);
  localDriver.get(appServer.whereIs("click_tests/overlapping_elements.html"));
  localDriver.findElement(By.id("under")).click();
  assertThat(localDriver.findElement(By.id("log")).getText())
      .isEqualTo("Log:\n"
               + "mousedown in over (handled by over)\n"
               + "mousedown in over (handled by body)\n"
               + "mouseup in over (handled by over)\n"
               + "mouseup in over (handled by body)\n"
               + "click in over (handled by over)\n"
               + "click in over (handled by body)");
}
 
Example #10
Source File: ProxyBasedIT.java    From Mastering-Selenium-WebDriver-3.0-Second-Edition with MIT License 6 votes vote down vote up
@Test
public void usingAProxyToTrackNetworkTrafficStep2() {
    BrowserMobProxy browserMobProxy = new BrowserMobProxyServer();
    browserMobProxy.start();
    Proxy seleniumProxyConfiguration = ClientUtil.createSeleniumProxy(browserMobProxy);

    FirefoxOptions firefoxOptions = new FirefoxOptions();
    firefoxOptions.setCapability(CapabilityType.PROXY, seleniumProxyConfiguration);
    driver = new FirefoxDriver(firefoxOptions);
    browserMobProxy.newHar();
    driver.get("https://www.google.co.uk");

    Har httpArchive = browserMobProxy.getHar();

    assertThat(getHTTPStatusCode("https://www.google.co.uk/", httpArchive))
            .isEqualTo(200);
}
 
Example #11
Source File: AutomationRequestMatcherTest.java    From SeleniumGridScaler with GNU General Public License v2.0 6 votes vote down vote up
@Test
// Happy path that browsers matching shows correct free node count
 public void testRequestMatchingBrowsers() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,browser);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));

    Assert.assertEquals("Thread count should be correct due to matching browser", 10, freeThreads);
}
 
Example #12
Source File: WebDriverServletTest.java    From selenium with Apache License 2.0 6 votes vote down vote up
@Test
public void doesNotRedirectForNewSessionsRequestedViaCrossDomainRpc()
    throws IOException, ServletException {
  Map<String, Object> json = ImmutableMap.of(
      "method", "POST",
      "path", "/session",
      "data", ImmutableMap.of(
          "desiredCapabilities", ImmutableMap.of(
              CapabilityType.BROWSER_NAME, BrowserType.FIREFOX,
              CapabilityType.VERSION, true)));
  FakeHttpServletResponse response = sendCommand("POST", "/xdrpc", json);

  assertEquals(HttpServletResponse.SC_OK, response.getStatus());
  assertEquals("application/json; charset=utf-8",
               response.getHeader("content-type"));

  Map<String, Object> jsonResponse = this.json.toType(response.getBody(), MAP_TYPE);
  assertEquals(ErrorCodes.SUCCESS, ((Number) jsonResponse.get("status")).intValue());
  assertNotNull(jsonResponse.get("sessionId"));

  Map<?, ?> value = (Map<?, ?>) jsonResponse.get("value");
  // values: browsername, version, remote session id.
  assertEquals(value.toString(), 3, value.entrySet().size());
  assertEquals(BrowserType.FIREFOX, value.get(CapabilityType.BROWSER_NAME));
  assertTrue((Boolean) value.get(CapabilityType.VERSION));
}
 
Example #13
Source File: EdgeOptionsTest.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Test
public void canMergeWithoutChangingOriginalObject() {
  EdgeOptions options = new EdgeOptions();
  Map<String, Object> before = options.asMap();
  EdgeOptions merged = options.merge(
      new ImmutableCapabilities(CapabilityType.PAGE_LOAD_STRATEGY, PageLoadStrategy.NONE));
  // TODO: assertThat(merged).isNotSameAs(options);
  // TODO: assertThat(options.asMap()).isEqualTo(before);
  assertThat(merged.getCapability(CapabilityType.PAGE_LOAD_STRATEGY)).isEqualTo(PageLoadStrategy.NONE);
}
 
Example #14
Source File: DockerBasedSeleniumServer.java    From just-ask with Apache License 2.0 5 votes vote down vote up
@Override
public int startServer(TestSession session) throws ServerException {
    try {
        String browser = (String) session.getRequestedCapabilities().get(CapabilityType.BROWSER_NAME);
        String image = ConfigReader.getInstance().getMapping().get(browser).getTarget();
        containerInfo = DockerHelper.startContainerFor(image, isPrivileged(), getDeviceInfos());
        return containerInfo.getPort();
    } catch (DockerException | InterruptedException e) {
        throw new ServerException(e.getMessage(), e);
    }
}
 
Example #15
Source File: BaseBrowserFactory.java    From webtester2-core with Apache License 2.0 5 votes vote down vote up
protected void setOptionalProxyConfiguration(DesiredCapabilities capabilities) {
    if (proxyConfiguration != null && !(proxyConfiguration instanceof NoProxyConfiguration)) {
        Proxy proxy = new Proxy();
        proxyConfiguration.configureProxy(proxy);
        capabilities.setCapability(CapabilityType.PROXY, proxy);
    }
}
 
Example #16
Source File: EdgeHtmlOptionsTest.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Test
public void testDefaultOptions() {
  EdgeHtmlOptions options = new EdgeHtmlOptions();
  assertThat(options.asMap())
      .containsEntry(CapabilityType.BROWSER_NAME, BrowserType.EDGE)
      .containsEntry(EdgeHtmlOptions.USE_CHROMIUM, false);
}
 
Example #17
Source File: IosInterface.java    From candybean with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void start() throws CandybeanException {
	logger.info("Starting automation interface with type: " + super.iType);
	capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
       capabilities.setCapability(CapabilityType.VERSION, "6.0");
       capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
       try {
		super.wd = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
	} catch (MalformedURLException mue) {
		throw new CandybeanException(mue);
	} 
       super.start(); // requires wd to be instantiated first
}
 
Example #18
Source File: DefaultModule.java    From bromium with MIT License 5 votes vote down vote up
public DesiredCapabilities createDesiredCapabilities(Proxy proxy) {
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.PROXY, proxy);
    ChromeOptions options = new ChromeOptions();
    options.addArguments("--test-type");
    options.addArguments("--start-maximized");
    options.addArguments("--disable-web-security");
    options.addArguments("--allow-file-access-from-files");
    options.addArguments("--allow-running-insecure-content");
    options.addArguments("--allow-cross-origin-auth-prompt");
    options.addArguments("--allow-file-access");
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);
    return capabilities;
}
 
Example #19
Source File: SetProxyForWebDriver.java    From neodymium-library with MIT License 5 votes vote down vote up
private DesiredCapabilities createCapabilitiesWithProxy()
{
    final DesiredCapabilities capabilities = new DesiredCapabilities();
    if (Neodymium.configuration().useProxy())
    {
        capabilities.setCapability(CapabilityType.PROXY, BrowserRunnerHelper.createProxyCapabilities());
    }
    return capabilities;
}
 
Example #20
Source File: AutomationCapabilityMatcherTest.java    From SeleniumGridScaler with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testTerminatedNode() {
    AutomationCapabilityMatcher matcher = new AutomationCapabilityMatcher();
    Map<String,Object> nodeCapability = new HashMap<String,Object>();
    nodeCapability.put(CapabilityType.BROWSER_NAME,"firefox");
    nodeCapability.put(AutomationConstants.INSTANCE_ID,"foo");
    Map<String,Object> testCapability = new HashMap<String,Object>();
    testCapability.put(CapabilityType.BROWSER_NAME,"firefox");
    AutomationDynamicNode node = new AutomationDynamicNode("uuid","foo","browser","os", new Date(),10);
    AutomationContext.getContext().addNode(node);
    node.updateStatus(AutomationDynamicNode.STATUS.TERMINATED);
    Assert.assertFalse("Capabilities should match as node is not in context",matcher.matches(nodeCapability,testCapability));
}
 
Example #21
Source File: ScreenshotUtils.java    From Selenium-Foundation with Apache License 2.0 5 votes vote down vote up
/**
 * Determine if the specified driver is capable of taking screenshots.
 * 
 * @param optDriver optional web driver object
 * @param logger SLF4J logger object; may be 'null'
 * @return 'true' if driver can take screenshots; otherwise 'false'
 */
public static boolean canGetArtifact(final Optional<WebDriver> optDriver, final Logger logger) {
    if (optDriver.isPresent()) {
        WebDriver driver = optDriver.get();
        if (driver instanceof HasCapabilities) {
            if (((HasCapabilities) driver).getCapabilities().is(CapabilityType.TAKES_SCREENSHOT)) {
                return true;
            }
        }
        if (driver instanceof TakesScreenshot) {
            return true; // for remote drivers, this may be bogus
        }
        if (logger != null) {
            logger.warn("This driver is not able to take screenshots."); //NOSONAR
        }
    }
    return false;
}
 
Example #22
Source File: AutomationNodeCleanupTaskTest.java    From SeleniumGridScaler with GNU General Public License v2.0 5 votes vote down vote up
@Test
// Tests that the node is not automatically shutdown (terminated) because its currently running tests
public void testNodeCantBeShutDown() {
    MockRequestMatcher matcher = new MockRequestMatcher();
    matcher.setThreadsToReturn(4);
    MockAutomationNodeCleanupTask task = new MockAutomationNodeCleanupTask(null,new MockVmManager(),matcher);
    ProxySet proxySet = new ProxySet(false);
    task.setProxySet(proxySet);
    String nodeId = "dummyId";
    AutomationDynamicNode node = new AutomationDynamicNode(nodeId,"dummyId",null,null,AutomationUtils.modifyDate(new Date(),-56, Calendar.MINUTE),10);
    AutomationContext.getContext().addNode(node);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxySet.add(proxy);
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    // Assign a session to the test slot
    testSlot.getNewSession(capabilities);
    proxy.setMultipleTestSlots(testSlot, 5);
    matcher.setInProgressTests("firefox",5);
    task.run();
    Assert.assertEquals("There should not be sufficient free capacity to cause the node to get shut down", AutomationDynamicNode.STATUS.RUNNING,node.getStatus());
}
 
Example #23
Source File: ChromeCaps.java    From teasy with MIT License 5 votes vote down vote up
private ChromeOptions getChromeOptions() {
    ChromeOptions options = new ChromeOptions();
    options.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, this.alertBehaviour);
    //To view pdf in chrome
    options.setExperimentalOption("excludeSwitches", Arrays.asList("test-type", "--ignore-certificate-errors"));
    if (this.isHeadless) {
        options.addArguments("headless");
    }
    options.setCapability(ChromeOptions.CAPABILITY, options);
    options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    options.setCapability("platform", platform);
    setLoggingPrefs(options);
    return options;
}
 
Example #24
Source File: EdgeCaps.java    From teasy with MIT License 5 votes vote down vote up
private EdgeOptions getEdgeOptions() {
    EdgeOptions options = new EdgeOptions();
    options.setCapability("platform", Platform.WINDOWS);
    options.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, this.alertBehaviour);
    setLoggingPrefs(options);
    return options;
}
 
Example #25
Source File: FireFoxCaps.java    From teasy with MIT License 5 votes vote down vote up
private FirefoxOptions getFirefoxOptions() {
    FirefoxOptions options = new FirefoxOptions();
    options.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, this.alertBehaviour);
    options.setCapability(FirefoxDriver.MARIONETTE, false);
    options.setCapability(FirefoxDriver.PROFILE, createFirefoxProfile());
    options.setCapability("platform", platform);
    options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    setLoggingPrefs(options);
    return options;
}
 
Example #26
Source File: RemoteFactory.java    From webtester2-core with Apache License 2.0 5 votes vote down vote up
@Override
public Browser createBrowser() {
    String browserName = configuration.getRemoteBrowserName();
    String browserVersion = configuration.getRemoteBrowserVersion();
    DesiredCapabilities capabilities = new DesiredCapabilities(browserName, browserVersion, Platform.ANY);
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    capabilities.setCapability(CapabilityType.HAS_NATIVE_EVENTS, false);
    capabilities.setCapability("marionette", configuration.getRemoteFirefoxMarionette());
    setOptionalProxyConfiguration(capabilities);
    return createBrowser(capabilities);
}
 
Example #27
Source File: AndroidChromeCaps.java    From teasy with MIT License 5 votes vote down vote up
private DesiredCapabilities getAndroidChromeCaps() {
    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("newCommandTimeout", "900");
    caps.setPlatform(Platform.ANDROID);
    caps.setCapability(CapabilityType.BROWSER_NAME, "chrome");
    return caps;
}
 
Example #28
Source File: UtilsTest.java    From selenium with Apache License 2.0 5 votes vote down vote up
@Test
public void providesRemoteAccessToAppCache() {
  DesiredCapabilities caps = new DesiredCapabilities();
  caps.setCapability(CapabilityType.SUPPORTS_APPLICATION_CACHE, true);

  CapableDriver driver = mock(CapableDriver.class);
  when(driver.getCapabilities()).thenReturn(caps);
  when(driver.execute(DriverCommand.GET_APP_CACHE_STATUS, null))
      .thenReturn(AppCacheStatus.CHECKING.name());

  ApplicationCache cache = Utils.getApplicationCache(driver);
  assertEquals(AppCacheStatus.CHECKING, cache.getStatus());
}
 
Example #29
Source File: CustomCapabilityMatcherTest.java    From selenium-grid-extensions with Apache License 2.0 5 votes vote down vote up
private Map<String, Object> nodeCapabilities() {
    Map<String, Object> defaultCapabilities = new HashMap<>();
    defaultCapabilities.put("seleniumProtocol", "WebDriver");
    defaultCapabilities.put("maxInstances", 5);
    defaultCapabilities.put(CapabilityType.BROWSER_NAME, "firefox");
    defaultCapabilities.put(CapabilityType.PLATFORM, Platform.WINDOWS);
    return defaultCapabilities;
}
 
Example #30
Source File: SeleniumTestUtilities.java    From Spring-Security-Third-Edition with MIT License 5 votes vote down vote up
public static WebDriver get64IEDriver()
{
	String path = System.getProperty("user.dir") + "\\Drivers\\IEDriverServer64.exe";
	System.setProperty("webdriver.ie.driver", path);
	DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
	caps.setCapability(CapabilityType.BROWSER_NAME, "IE");
	caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,	true);

	return new InternetExplorerDriver(caps);
}