Codota Logo
org.openqa.selenium.chrome
Code IndexAdd Codota to your IDE (free)

How to use org.openqa.selenium.chrome

Best Java code snippets using org.openqa.selenium.chrome (Showing top 20 results out of 1,017)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: stackoverflow.com

 System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions");
driver = new ChromeDriver(options);
origin: selenide/selenide

@Override
WebDriver create(Config config, Proxy proxy) {
 ChromeOptions options = createChromeOptions(config, proxy);
 return new ChromeDriver(options);
}
origin: apache/geode

private void setUpWebDriver() {
 ChromeOptions options = new ChromeOptions();
 options.addArguments("headless");
 options.addArguments("no-sandbox");
 options.addArguments("window-size=1200x600");
 driver = new ChromeDriver(options);
 driver.manage().window().maximize();
 driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
 driver.manage().timeouts().pageLoadTimeout(300, TimeUnit.SECONDS);
}
origin: cloudfoundry/uaa

@Bean(destroyMethod = "quit")
public ChromeDriver webDriver() {
  System.setProperty("webdriver.chrome.logfile", "/tmp/chromedriver.log");
  System.setProperty("webdriver.chrome.verboseLogging", "true");
  ChromeOptions options = new ChromeOptions();
  options.addArguments(
   "--verbose",
   "--headless",
   "--disable-web-security",
   "--ignore-certificate-errors",
   "--allow-running-insecure-content",
   "--allow-insecure-localhost",
   "--no-sandbox",
   "--disable-gpu"
  );
  LoggingPreferences logs = new LoggingPreferences();
  logs.enable(LogType.PERFORMANCE, Level.ALL);
  options.setCapability(CapabilityType.LOGGING_PREFS, logs);
  options.setAcceptInsecureCerts(true);
  ChromeDriver driver = new ChromeDriver(options);
  driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
  driver.manage().timeouts().pageLoadTimeout(20, TimeUnit.SECONDS);
  driver.manage().timeouts().setScriptTimeout(15, TimeUnit.SECONDS);
  driver.manage().window().setSize(new Dimension(1024, 768));
  return driver;
}
origin: selenide/selenide

ChromeOptions createChromeOptions(Config config, Proxy proxy) {
 ChromeOptions options = new ChromeOptions();
 options.setHeadless(config.headless());
 if (!config.browserBinary().isEmpty()) {
  log.info("Using browser binary: " + config.browserBinary());
  options.setBinary(config.browserBinary());
 }
 options.merge(createCommonCapabilities(config, proxy));
 options = transferChromeOptionsFromSystemProperties(options);
 log.config("Chrome options:" + options.toString());
 return options;
}
origin: galenframework/galen

public static DesiredCapabilities getBrowserCapabilities(String driverParameter, boolean headless) {
  DesiredCapabilities capabilities = null;
  if (driverParameter == null || driverParameter.equalsIgnoreCase(FIREFOX)) {
    capabilities = DesiredCapabilities.firefox();
    FirefoxOptions options = new FirefoxOptions();
    options.setHeadless(headless);
    capabilities.merge(options);
  }
  else if (driverParameter.equalsIgnoreCase(IE)) {
    capabilities = DesiredCapabilities.internetExplorer();
    capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
    capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
  }
  else if (driverParameter.equalsIgnoreCase(CHROME)) {
    capabilities = DesiredCapabilities.chrome();
    ChromeOptions options = new ChromeOptions();
    options.setHeadless(headless);
    options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
    capabilities.merge(options);
  }
  return capabilities;
}
origin: stackoverflow.com

 ChromeDriver driver = new ChromeDriver();
driver.get("file://empty-page.html");
String innerHtml = "<head>...</head><body onload="...">...</body>";
driver.executeScript("document.innerHTML = " + innerHtml);
origin: testcontainers/testcontainers-java

  @Test
  public void testAdditionalStartupString() {
    try (BrowserWebDriverContainer chrome = new BrowserWebDriverContainer("selenium/standalone-chrome-debug:" + tag)
        .withCapabilities(new ChromeOptions())) {
      chrome.start();
    }
  }
}
origin: selenide/selenide

Capabilities getBrowserBinaryCapabilities(Config config, Browser browser) {
 log.info("Using browser binary: " + config.browserBinary());
 if (browser.isChrome()) {
  ChromeOptions options = new ChromeOptions();
  options.setBinary(config.browserBinary());
  return options;
 } else if (browser.isFirefox()) {
  FirefoxOptions options = new FirefoxOptions();
  options.setBinary(config.browserBinary());
  return options;
 } else {
  log.warning("Changing browser binary on remote server is only supported for Chrome/Firefox, setting will be ignored.");
 }
 return new DesiredCapabilities();
}
origin: selenide/selenide

private Capabilities getHeadlessCapabilities(Config config, Browser browser) {
 log.info("Starting in headless mode");
 if (browser.isChrome()) {
  ChromeOptions options = new ChromeOptions();
  options.setHeadless(config.headless());
  return options;
 } else if (browser.isFirefox()) {
  FirefoxOptions options = new FirefoxOptions();
  options.setHeadless(config.headless());
  return options;
 } else {
  log.warning("Headless mode on remote server is only supported for Chrome/Firefox, setting will be ignored.");
 }
 return new DesiredCapabilities();
}
origin: stackoverflow.com

 String downloadFilepath = "/path/to/download";
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("download.default_directory", downloadFilepath);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
cap.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(cap);
origin: selenide/selenide

/**
 * This method only handles so-called "arguments" and "preferences"
 * for ChromeOptions (there is also "Extensions" etc.)
 *
 * @param currentChromeOptions
 * @return options updated with args & prefs parameters
 */
private ChromeOptions transferChromeOptionsFromSystemProperties(ChromeOptions currentChromeOptions) {
 if (System.getProperty("chromeoptions.args") != null) {
  Stream<String> params = Arrays.stream(parseCSVhandlingQuotes(System.getProperty("chromeoptions.args")));
  List<String> args = params
   .map(s -> s.replace("\"", ""))
   .collect(Collectors.toList());
  currentChromeOptions.addArguments(args);
 }
 if (System.getProperty("chromeoptions.prefs") != null) {
  Map<String, Object> prefs = parsePreferencesFromString(System.getProperty("chromeoptions.prefs"));
  currentChromeOptions.setExperimentalOption("prefs", prefs);
 }
 return currentChromeOptions;
}
origin: stackoverflow.com

 ChromeOptions options = new ChromeOptions();
options.addArguments("-incognito");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
origin: galenframework/galen

public static WebDriver getDriver(String browserType, boolean headless){
  
  if ( StringUtils.isEmpty(browserType) || FIREFOX.equals(browserType)) {
    return new FirefoxDriver(SeleniumBrowserFactory.getBrowserCapabilities(browserType, headless));
  }
  else if (CHROME.equals(browserType)) {
    return new ChromeDriver(SeleniumBrowserFactory.getBrowserCapabilities(browserType, headless));
  }
  else if (IE.equals(browserType)) {
    return new InternetExplorerDriver(SeleniumBrowserFactory.getBrowserCapabilities(browserType, false));
  }
  else if (PHANTOMJS.equals(browserType)) {
    return new PhantomJSDriver();
  }
  else if (SAFARI.equals(browserType)) {
    return new SafariDriver();
  }
  else if (EDGE.equals(browserType)) {
    return new EdgeDriver();
  }
  else {
    throw new RuntimeException(String.format("Unknown browser type: \"%s\"", browserType));
  }
}
origin: testcontainers/testcontainers-java

} else {
  logger().info("No capabilities provided, falling back to ChromeOptions");
  capabilities = new ChromeOptions();
origin: stackoverflow.com

System.setProperty("webdriver.chrome.driver","<<your chrome path>>");
 // To remove message "You are using an unsupported command-line flag: --ignore-certificate-errors.
 // Stability and security will suffer."
 // Add an argument 'test-type'
 DesiredCapabilities capabilities = DesiredCapabilities.chrome();
 ChromeOptions options = new ChromeOptions();
 options.addArguments("test-type");
 capabilities.setCapability("chrome.binary","<<your chrome path>>");
 capabilities.setCapability(ChromeOptions.CAPABILITY, options);
 driver = new ChromeDriver(capabilities);
origin: code4craft/webmagic

  mDriver = new FirefoxDriver(sCaps);
} else if (driver.equals(DRIVER_CHROME)) {
  mDriver = new ChromeDriver(sCaps);
} else if (driver.equals(DRIVER_PHANTOMJS)) {
  mDriver = new PhantomJSDriver(sCaps);
origin: testcontainers/testcontainers-java

  @Test @Ignore
  public void testCreationOfManyContainers() {
    for (int i = 0; i < 50; i++) {
      BrowserWebDriverContainer container = new BrowserWebDriverContainer()
          .withCapabilities(new ChromeOptions())
          .withRecordingMode(BrowserWebDriverContainer.VncRecordingMode.RECORD_FAILING, new File("build"));

      container.start();
      RemoteWebDriver driver = container.getWebDriver();

      driver.get("http://www.google.com");

      container.stop();
    }
  }
}
origin: stackoverflow.com

 System.setProperty("webdriver.chrome.driver", "<unzip location>/chromedriver");
driver = new ChromeDriver();
origin: stackoverflow.com

 System.setProperty("webdriver.chrome.driver", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome");
driver = new ChromeDriver();
org.openqa.selenium.chrome

Most used classes

  • ChromeDriver
  • ChromeOptions
  • ChromeDriverService$Builder
  • ChromeDriverService
  • ChromeBinary
  • ChromeCommandExecutor$ListeningThread,
  • ChromeCommandExecutor,
  • ChromeDriver$ChromeNavigation,
  • ChromeDriver$ChromeOptions,
  • ChromeDriver$ChromeTargetLocator,
  • ChromeDriverCommandExecutor,
  • ChromeDriverInfo,
  • ChromeResponse,
  • ChromeWebElement,
  • FatalChromeException,
  • Response
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now