Package org.openqa.selenium.remote

Examples of org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions


      generate(type, variation);
    }
  }

  private static void generate(DeviceType device, DeviceVariation variation) throws Exception {
    RemoteWebDriver driver = null;
    try {
      IOSCapabilities caps = IOSCapabilities.iphone("Safari");
      if (device == DeviceType.ipad) {
        caps.setDevice(DeviceType.ipad);
      }
      caps.setDeviceVariation(variation);

      driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), caps);
      driver.get("http://ebay.ch");
      RemoteIOSDriver d = IOSDriverAugmenter.getIOSDriver(driver);

      dumpCapabilities(device, variation, d);
      for (Orientation o : Orientation.values()) {
        try {
          d.rotate(o);
          // status
          // capabilities
          dumpElementTree(device, variation, o, d);
        } catch (WebDriverException e) {
          if (!e.getMessage()
              .contains("The orientation specified is not supported by the application")) {
            throw e;
          }
        }
      }
    } finally {
      if (driver != null) {
        driver.quit();
      }
    }
  }
View Full Code Here


        Validate.isEmpty(configuration.getBrowserCapabilities(), "The browser capabilities are not set.");

        // construct capabilities
        DesiredCapabilities desiredCapabilities = new DesiredCapabilities(configuration.getCapabilities());

        RemoteWebDriver driver = null;

        if (configuration.isRemoteReusable()) {
            driver = createReusableDriver(remoteAddress, desiredCapabilities);
        } else {
            driver = createRemoteDriver(remoteAddress, desiredCapabilities);
        }

        // ARQ-1351
        // marks the driver instance for augmentation by AugmentingEnhancer
        ((DesiredCapabilities) driver.getCapabilities()).setCapability(AugmentingEnhancer.DRONE_AUGMENTED, driver);

        // ARQ-1206
        // by default, we are clearing Cookies on reusable browsers
        if (!configuration.isReuseCookies()) {
            driver.manage().deleteAllCookies();
        }

        return driver;
    }
View Full Code Here

    protected String getDriverReadableName() {
        return BROWSER_CAPABILITIES;
    }

    protected RemoteWebDriver createRemoteDriver(URL remoteAddress, Capabilities desiredCapabilities) {
        return new RemoteWebDriver(remoteAddress, desiredCapabilities);
    }
View Full Code Here

    private RemoteWebDriver createReusableDriver(URL remoteAddress, Capabilities desiredCapabilities) {
        // construct init params
        InitializationParameter initParam = new InitializationParameter(remoteAddress, desiredCapabilities);

        RemoteWebDriver driver = null;

        // try to reuse the session
        // retrieve the session id
        ReusedSession stored = sessionStore.get().pull(initParam);
        // get all the stored sessions for given initParam
        while (stored != null) {
            SessionId reusedSessionId = stored.getSessionId();
            Capabilities reusedCapabilities = stored.getCapabilities();
            try {
                driver = ReusableRemoteWebDriver.fromReusedSession(remoteAddress, reusedCapabilities, reusedSessionId);
                break;
            } catch (UnableReuseSessionException ex) {
                log.log(Level.WARNING, "Unable to reuse session: {0}", stored.getSessionId());
            }

            stored = sessionStore.get().pull(initParam);
        }

        if (driver == null) {
            // if either browser session isn't stored or can't be reused
            RemoteWebDriver newdriver = createRemoteDriver(remoteAddress, desiredCapabilities);
            driver = ReusableRemoteWebDriver.fromRemoteWebDriver(newdriver);
        }

        initParams.get().put(driver.getSessionId(), initParam);
View Full Code Here

          DesiredCapabilities capabilities = new DesiredCapabilities();
          capabilities.setCapability(FirefoxDriver.PROFILE, profile);
          capabilities.setBrowserName(DesiredCapabilities.firefox()
              .getBrowserName());

          driver = new RemoteWebDriver(new URL("http://"
              + hostAddress + ":" + hubPort + "/wd/hub"),
              capabilities);
        } else {
          driver = new FirefoxDriver(profile);
        }

        if (!usePhysicalCam && video != null) {
          launchFakeCam();
        }

      } else if (driverClass.equals(ChromeDriver.class)) {
        String chromedriver = null;
        if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_LINUX) {
          chromedriver = "chromedriver";
        } else if (SystemUtils.IS_OS_WINDOWS) {
          chromedriver = "chromedriver.exe";
        }
        System.setProperty("webdriver.chrome.driver", new File(
            "target/webdriver/" + chromedriver).getAbsolutePath());
        ChromeOptions options = new ChromeOptions();

        // This flag avoids grant the camera
        options.addArguments("--use-fake-ui-for-media-stream");

        // This flag avoids warning in chrome. See:
        // https://code.google.com/p/chromedriver/issues/detail?id=799
        options.addArguments("--test-type");

        if (!usePhysicalCam) {
          // This flag makes using a synthetic video (green with
          // spinner) in webrtc. Or it is needed to combine with
          // use-file-for-fake-video-capture to use a file faking the
          // cam
          options.addArguments("--use-fake-device-for-media-stream");

          if (video != null) {
            options.addArguments("--use-file-for-fake-video-capture="
                + video);

            // Alternative: lauch fake cam also in Chrome
            // launchFakeCam();
          }
        }

        if (remoteNode != null) {
          DesiredCapabilities capabilities = new DesiredCapabilities();
          capabilities.setCapability(ChromeOptions.CAPABILITY,
              options);
          capabilities.setBrowserName(DesiredCapabilities.chrome()
              .getBrowserName());
          driver = new RemoteWebDriver(new URL("http://"
              + hostAddress + ":" + hubPort + "/wd/hub"),
              capabilities);

        } else {
          driver = new ChromeDriver(options);
View Full Code Here

        Validate.isEmpty(configuration.getBrowser(), "The browser is not set.");

        // construct capabilities
        DesiredCapabilities desiredCapabilities = new DesiredCapabilities(configuration.getCapabilities());

        RemoteWebDriver driver = null;

        if (configuration.isRemoteReusable()) {
            driver = createReusableDriver(remoteAddress, desiredCapabilities);
        } else {
            driver = createRemoteDriver(remoteAddress, desiredCapabilities);
        }

        // ARQ-1351
        // marks the driver instance for augmentation by AugmentingEnhancer
        ((DesiredCapabilities) driver.getCapabilities()).setCapability(AugmentingEnhancer.DRONE_AUGMENTED, driver);

        // ARQ-1206
        // by default, we are clearing Cookies on reusable browsers
        if (!configuration.isReuseCookies()) {
            driver.manage().deleteAllCookies();
        }

        return driver;
    }
View Full Code Here

    protected String getDriverReadableName() {
        return BROWSER_CAPABILITIES;
    }

    protected RemoteWebDriver createRemoteDriver(URL remoteAddress, Capabilities desiredCapabilities) {
        return new RemoteWebDriver(remoteAddress, desiredCapabilities);
    }
View Full Code Here

    private RemoteWebDriver createReusableDriver(URL remoteAddress, Capabilities desiredCapabilities) {
        // construct init params
        InitializationParameter initParam = new InitializationParameter(remoteAddress, desiredCapabilities);

        RemoteWebDriver driver = null;

        // try to reuse the session
        // retrieve the session id
        ReusedSession stored = sessionStore.get().pull(initParam);
        // get all the stored sessions for given initParam
        while (stored != null) {
            SessionId reusedSessionId = stored.getSessionId();
            Capabilities reusedCapabilities = stored.getCapabilities();
            try {
                driver = ReusableRemoteWebDriver.fromReusedSession(remoteAddress, reusedCapabilities, reusedSessionId);
                break;
            } catch (UnableReuseSessionException ex) {
                log.log(Level.WARNING, "Unable to reuse session: {0}", stored.getSessionId());
            }

            stored = sessionStore.get().pull(initParam);
        }

        if (driver == null) {
            // if either browser session isn't stored or can't be reused
            RemoteWebDriver newdriver = createRemoteDriver(remoteAddress, desiredCapabilities);
            driver = ReusableRemoteWebDriver.fromRemoteWebDriver(newdriver);
        }

        initParams.get().put(driver.getSessionId(), initParam);
View Full Code Here

  protected WebDriver createRemoteDriver(String remote, String browser) {
    try {
      DesiredCapabilities capabilities = new DesiredCapabilities();
      capabilities.setBrowserName(browser);
      return new RemoteWebDriver(new URL(remote), capabilities);
    } catch (MalformedURLException e) {
      throw new IllegalArgumentException("Invalid 'remote' parameter: " + remote, e);
    }
  }
View Full Code Here

             * Set the selenium driver as remote (selenium grid or hub)
             * @param url the web page to process
             * @throws MalformedURLException
             */
            public void setRemoteDriver(String url) throws MalformedURLException {
                this.driver = new RemoteWebDriver(new URL(url),capabilities);
                setJSDriver();
                this.driver = new Augmenter().augment(this.driver);
                this.driver.manage().timeouts().pageLoadTimeout(MAX_WAIT_S, TimeUnit.SECONDS);
                this.driver.manage().timeouts().implicitlyWait(MAX_WAIT_S, TimeUnit.SECONDS);
            }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions

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.