Headless chrome with selenium

System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome"); final ChromeOptions chromeOptions = new ChromeOptions(); //chromeOptions.addArguments("headless"); chromeOptions.addArguments("window-size=1200x600"); final DesiredCapabilities desiredCapabilities = new DesiredCapabilities(); desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions); final URL url = new URL("https://the-internet.herokuapp.com/login"); final WebDriver driver = new RemoteWebDriver(url, desiredCapabilities); 

does not work:

Exception in thread "main" org.openqa.selenium.WebDriverException: Unable to parse remote response:

Not found

Any idea why?

Next: How to connect to Chromium Headless using selenium

0
java selenium google-chrome-headless
source share
1 answer

What browser versions are Chrome, chromedriver and Selenium? I tried:

  • Chrome version 62.0.3202.75 (official build) (64-bit)
  • chromedriver 2.33
  • Selenium 3.6.0

The following code:

  System.setProperty("webdriver.chrome.driver", "/pathTo/chromedriver); ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.addArguments("--headless"); ChromeDriver driver = new ChromeDriver(chromeOptions); driver.get("https://the-internet.herokuapp.com/login"); System.out.println(driver.getTitle()); 

Exit:

 The Internet 

See Getting Started with Headless Chrome for browser support versions.

0
source share

All Articles