enp4yne
enp4yne

Reputation: 646

Selenium (Java) with Headless Chrome on Windows 7

I can get the Selenium Test running without a window popping up, however it always fails at the first step saying it can't find the element I am looking for.

The Driver setup code looks like this:

ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
options.addArguments("window-size=1200x600");

I have my Selenium Tests set up to take a screenshot on failure. The screenshot always shows a white empty screen (which is exactly as large as the window-size I provide).

In this question it is said that headless chrome should work fine on Windows.

I have tried the disable-gpu argument as well which has no effect. Any other ideas where I could be going wrong?

Upvotes: 2

Views: 830

Answers (1)

Darth
Darth

Reputation: 1467

I had the same problem and it was caused by chrome complaining about my self-signed dev certificate on https pages. Obviously a white page in your screenshot isn't very intuitive lol The fix was to add the certificate as a trusted certificate to the trusted root certs.

Note: as of chrome 58 identifying the host using only ‘commonName’ is being removed so if you're getting the Err_cert_common_name_invalid error just re-generate your certificate with whatever method and make sure you include the 'subjectAltName' with proper DNS and IP entry.

Upvotes: 1

Related Questions