Package org.openqa.selenium.chrome

Examples of org.openqa.selenium.chrome.ChromeOptions


        } 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();
          }
View Full Code Here


      } 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 a warning in chrome. See:
      // https://code.google.com/p/chromedriver/issues/detail?id=799
      options.addArguments("--test-type");

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

      // 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");

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

    }
    return wrapper;
  }

  protected WebDriver createChromeDriver() {
    ChromeOptions options = new ChromeOptions();
    if (startMaximized) {
      // Due do bug in ChromeDriver we need this workaround
      // http://stackoverflow.com/questions/3189430/how-do-i-maximize-the-browser-window-using-webdriver-selenium-2
      options.addArguments("chrome.switches", "--start-maximized");
    }
    return new ChromeDriver(options);
  }
View Full Code Here

            if (!new File(executable).canExecute())
                throw new IllegalArgumentException("Missing ChromeDriver: " + executable);
            System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, executable);
        }
        ChromeDriverService service = CustomChromeDriverService.createService(driverOptions.getEnvVars());
        ChromeOptions options = new ChromeOptions();
        if (driverOptions.has(PROXY))
            options.addArguments("--proxy-server=http://" + driverOptions.get(PROXY));
        if (driverOptions.has(CLI_ARGS))
            options.addArguments(driverOptions.getCliArgs());
        caps.setCapability(ChromeOptions.CAPABILITY, options);
        caps.merge(driverOptions.getCapabilities());
        ChromeDriver driver = new ChromeDriver(service, caps);
        setInitialWindowSize(driver, driverOptions);
        return driver;
View Full Code Here

          long crawlWaitReload, long crawlWaitEvent) {
    ChromeDriver driverChrome;

    if (configuration.getProxyConfiguration() != null
            && configuration.getProxyConfiguration().getType() != ProxyType.NOTHING) {
      ChromeOptions optionsChrome = new ChromeOptions();
      optionsChrome.addArguments("--proxy-server=http://"
              + configuration.getProxyConfiguration().getHostname() + ":"
              + configuration.getProxyConfiguration().getPort());
      driverChrome = new ChromeDriver(optionsChrome);
    } else {
      driverChrome = new ChromeDriver();
View Full Code Here

    return null;
  }

  private static WebDriver createDriver(String browser) {
    if ("chrome".equalsIgnoreCase(browser)) {
      ChromeOptions options = new ChromeOptions();
      options.addArguments("chrome.switches", "--start-maximized");
      return new ChromeDriver(options);
    }
    else if ("ie".equalsIgnoreCase(browser)) {
      DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
      ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
View Full Code Here

    if (chromeDriverService != null)
    {
      chromeDriverService.start();
   
   
    ChromeOptions options = new ChromeOptions();

// Appears you can only load one unpacked extensions this way...
// list doesn't do it
//    List<String> arguments = new LinkedList<String>();
//    arguments.add("load-extension=" + System.getProperty(MOOLTIPASS_DIR) + File.separator + "authentication_clients" + File.separator + "chrome.hid-app");
View Full Code Here

  private EmbeddedBrowser newChromeBrowser(ImmutableSortedSet<String> filterAttributes,
          long crawlWaitReload, long crawlWaitEvent) {
    ChromeDriver driverChrome;
    if (configuration.getProxyConfiguration() != null
            && configuration.getProxyConfiguration().getType() != ProxyType.NOTHING) {
      ChromeOptions optionsChrome = new ChromeOptions();
      String lang = configuration.getBrowserConfig().getLangOrNull();
      if (!Strings.isNullOrEmpty(lang)) {
        optionsChrome.addArguments("--lang=" + lang);
      }
      optionsChrome.addArguments("--proxy-server=http://"
              + configuration.getProxyConfiguration().getHostname() + ":"
              + configuration.getProxyConfiguration().getPort());
      driverChrome = new ChromeDriver(optionsChrome);
    } else {
      driverChrome = new ChromeDriver();
View Full Code Here

  private static WebDriver createDriver() {
    if (remote != null) {
      return createRemoteDriver(remote, browser);
    } else if (CHROME.equalsIgnoreCase(browser)) {
      ChromeOptions options = new ChromeOptions();
      if (startMaximized) {
        // Due do bug in ChromeDriver we need this workaround
        // http://stackoverflow.com/questions/3189430/how-do-i-maximize-the-browser-window-using-webdriver-selenium-2
        options.addArguments("chrome.switches", "--start-maximized");
      }
      return new ChromeDriver(options);
    } else if (ie()) {
      DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
      ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
View Full Code Here

        }
        return SELENIUM_VERSION;
    }

    public static synchronized ChromeOptions addChromeOptions(DesiredCapabilities capabilities, Dimension windowSize) {
        ChromeOptions options = new ChromeOptions();
        List<String> arguments = Lists.newArrayList();
        arguments.add("--ignore-gpu-blacklist");
        if (windowSize != null) {
            arguments.add("window-size=" + windowSize.width + ',' + windowSize.height);
        }
        options.addArguments(arguments);
        // To remove message "You are using an unsupported command-line flag: --ignore-certificate-errors.
        // Stability and security will suffer."
        // Add an argument 'test-type'
        options.addArguments("test-type");
        capabilities.setCapability(ChromeOptions.CAPABILITY, options);
        return options;
    }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.chrome.ChromeOptions

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.