Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor Test cases execution fails when try to run on Headless Chrome V71

I'm using protractor for my e2e tests. Recently we updated to Chrome 71 and Webdriver 2.45 and now we constantly get the error: "chrome not reachable" when running headless.

If we do not run headless our tests pass. Because headless tests are more consistent en faster I still want to use headless mode.

On chrome 70 and webdriver 2.44 we had no problems at all.

        args: [
            '--disable-gpu',
            '--disable-impl-side-painting',
            '--disable-gpu-sandbox',
            '--disable-accelerated-2d-canvas',
            '--disable-accelerated-jpeg-decoding',
            '--disable-popup-blocking',
            '--no-sandbox',
            '--test-type=ui',
            '--start-maximized',
            '--window-size=1800,1000',
            '--headless'
        ]

WebDriverError: chrome not reachable (Session info: headless chrome=71.0.3578.80) (Driver info: chromedriver=2.45.615355 (d5698f682d8b2742017df6c81e0bd8e6a3063189),platform=Mac OS X 10.14.1 x86_64)

Any thoughts?

like image 820
Tijs Avatar asked Dec 12 '18 07:12

Tijs


People also ask

What is headless browser automation in protractor?

Headless Browser automation in protractor A headless browser is a browser simulation program that does not have a user interface (UI less). Headless browser programs operate like any other browser but do not display any UI. Protractor executes it's tests in the background.

Which protractor config file should I use for each browser?

We’ll use the existing protractor.conf.js to hold the common code that each browser will use. In order to run these default tests, new Edge and old Edge can actually just use the same config file.

Can I run protractor E2E tests in chrome or edge?

We’ll adapt this setup so that it can run its Protractor E2E tests in Chrome, old Edge, and new Edge. Each browser requires some unique code, of course, but a lot of it can be consolidated into a shared file.

When should we use headless testing?

We can use headless testing once the cross-browser testing is completed and want to run regression test cases in subsequent releases and with continuous integration. You have no option other than using headless testing when your machine does not have a GUI, for instance, if you want to run your tests in Unix.


1 Answers

The cause in our case is most likely to be this bug in either ChromeDriver or Chrome headless:

  • Unable to download a file when using in headless mode (selenium, chromedriver)

Some of our tests trigger file downloads, and it appears that ChromeDriver or Chrome headless freezes from that point onward, responding to any further requests with "chrome not reachable".

like image 71
bart Avatar answered Oct 10 '22 16:10

bart