Package org.openqa.selenium.remote

Examples of org.openqa.selenium.remote.DesiredCapabilities


            return PhantomJSDriverService.createDefaultService(capabilities);
        }

        PhantomJSBinary binary = resolveBinary(configuration);

        DesiredCapabilities newCapabilities = new DesiredCapabilities(capabilities);
        newCapabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, binary.getLocation()
                .getAbsolutePath());
        return PhantomJSDriverService.createDefaultService(newCapabilities);
    }
View Full Code Here


          webDriver = driver;
        } else {
          webDriver = new FirefoxDriver();
        }
      } else {
        DesiredCapabilities cap = null;
        if ("ie".equals(browserName)) {
          cap = DesiredCapabilities.internetExplorer();
        } else if ("chrome".equals(browserName)) {
          cap = DesiredCapabilities.chrome();
        } else if ("safari".equals(browserName)) {
          cap = DesiredCapabilities.safari();
        } else if ("headless".equals(browserName)) {
          cap = DesiredCapabilities.htmlUnit();

        } else {
          cap = DesiredCapabilities.firefox();
        }
        cap.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
        cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
        try {
          webDriver = new RemoteWebDriver(new URL(
              System.getProperty(SELENIUM_HUB)), cap);
          webDriver = new Augmenter().augment(webDriver);
        } catch (MalformedURLException e) {
View Full Code Here

      String driverPath = userDir
          + "/../../../tools/com.ibm.sbtx.ci/selenium/Chrome/chromedriver.exe";
      System.setProperty(PROP_WEBDRIVER_CHROMER_DRIVER, driverPath);
    }
    if (!StringUtil.isEmpty(System.getProperty(PROP_CHROME_BINARY))) {
      DesiredCapabilities capabilities = DesiredCapabilities.chrome();
      capabilities.setCapability("chrome.binary",
          System.getProperty(PROP_CHROME_BINARY));
      webDriver = new ChromeDriver(capabilities);
    } else {
      webDriver = new ChromeDriver();
    }
View Full Code Here

    org.openqa.grid.common.RegistrationRequest req = org.openqa.grid.common.RegistrationRequest
        .build("-role", "webdriver", "-host", "localhost", "-" + RegistrationRequest.HUB_HOST, "localhost");

    req.getCapabilities().clear();

    DesiredCapabilities capability = new DesiredCapabilities();
    capability.setBrowserName("Mobile Safari");
    req.addDesiredCapability(capability);

    Map<String, Object> config = new HashMap<String, Object>();
    config.put(RegistrationRequest.REMOTE_HOST, remoteHost);
    req.setConfiguration(config);
View Full Code Here

      JSONArray caps = status.getJSONArray(ServerStatusNHandler.SUPPORTED_APPS);

      JsonToBeanConverter convertor = new JsonToBeanConverter();
      for (int i = 0; i < caps.length(); i++) {
        Capabilities c = convertor.convert(Capabilities.class, caps.get(i).toString());
        DesiredCapabilities c2 = new DesiredCapabilities(c);
        registrationRequest.addDesiredCapability(c2);
      }

      registrationRequest.getConfiguration()
          .put(org.openqa.grid.common.RegistrationRequest.AUTO_REGISTER, true);
View Full Code Here

                RetentionStrategy.NOOP, new ArrayList<NodeProperty<Node>>());
        hudson.addNode(slave);

        waitForRC();

        DesiredCapabilities dc = DesiredCapabilities.htmlUnit();
        dc.setCapability("jenkins.label", "foo");
        WebDriver wd = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);

        try {
            wd.get("http://www.google.com/");
            new WebDriverWait(wd, 10).until(ExpectedConditions.presenceOfElementLocated(By.tagName("title")));
        } finally {
            wd.quit();
        }

        dc = DesiredCapabilities.htmlUnit();
        System.out.println("jenkins.label=foolabel");
        dc.setCapability("jenkins.label", "foolabel");
        try {
            WebDriver dr = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);
            dr.quit();
        } catch (Exception e) {
            fail(e.getMessage()); // should have passed
        }

        System.out.println("jenkins.nodeName=foo");
        dc = DesiredCapabilities.htmlUnit();
        dc.setCapability("jenkins.nodeName", "foo");
        try {
            WebDriver dr = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);
            dr.quit();
        } catch (Exception e) {
            fail(e.getMessage()); // should have passed
        }

        dc.setCapability("jenkins.label", "foolabel");
        System.out.println("jenkins.label=foolabel & jenkins.nodeName=foo");
        try {
            WebDriver dr = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);
            dr.quit();
        } catch (Exception e) {
            fail(e.getMessage()); // should have passed
        }

        dc = DesiredCapabilities.htmlUnit();
        dc.setCapability("jenkins.label", "bar");
        System.out.println("jenkins.label=bar");
        try {
            new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), dc);
            fail("jenkins.label=bar should not return a valid session"); // should have failed
        } catch (Exception e) {
View Full Code Here

      // legacy methods: Going through the RC server.
      String selBrowserIdentifierString = "*" + Config.inst().BROWSER;

      selenium = new DefaultSelenium("localhost", 4444, selBrowserIdentifierString, Config.inst().TEAMMATES_URL);
      CommandExecutor executor = new SeleneseCommandExecutor(selenium);
      DesiredCapabilities dc = new DesiredCapabilities();
      setDriver(new RemoteWebDriver(executor, dc));

    }

    selenium.windowMaximize();
View Full Code Here

      // legacy methods: Going through the RC server.
      String selBrowserIdentifierString = "*" + Config.inst().BROWSER;

      selenium = new DefaultSelenium("localhost", 4444, selBrowserIdentifierString, Config.inst().TEAMMATES_URL);
      CommandExecutor executor = new SeleneseCommandExecutor(selenium);
      DesiredCapabilities dc = new DesiredCapabilities();
      driver = new RemoteWebDriver(executor, dc);

    }

    selenium.windowMaximize();
View Full Code Here

      String selBrowserIdentifierString = "*" + Config.BROWSER;

      selenium = new DefaultSelenium("localhost", 4444,
          selBrowserIdentifierString, Config.TEAMMATES_URL);
      CommandExecutor executor = new SeleneseCommandExecutor(selenium);
      DesiredCapabilities dc = new DesiredCapabilities();
      driver = new RemoteWebDriver(executor, dc);

    }

    selenium.windowMaximize();
View Full Code Here

        service.stop();
    }

    @Before
    public void startDriver() {
        DesiredCapabilities capabilities = DesiredCapabilities.chrome();
        webDriver = new RemoteWebDriver(service.getUrl(), capabilities);
    }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.remote.DesiredCapabilities

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.