Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Chrome headless migration has been my bane for the last two weeks. It's almost ready, but not yet.

The short version of what's wrong: chrome headless does not support extensions. The chromedriver used by selenium works via starting chrome with an automation extension that gives it certain needed functionality. So things like setting the window size, taking screenshots, and a few other important features just cause chromedriver to crash or hang.

There's bugs filed and some clever googlers are trying to fix it all- but it's not ready for our purposes yet. I don't want to rewrite dozens of tests that work with phantomjs to get around chrome's bugs.



Indeed, some features are not supported yet (setting size, alerts, ...). We're lucky not to use too many of them in our actual test suite!


Just implemented headless testing for a rails app today, and discovered that alert support has been worked around in the latest Capybara (2.14.4).

https://github.com/teamcapybara/capybara/commit/12c100597093...


I believe chromedriver 2.30(or maybe an earlier version) fixes these issues.

Certainly it is possible to pass chromeOptions: { args: %w[headless disable-gpu window-size=1920x1080] } to the capabilities object and that works.

Screenshots also work in Rails system tests.


>Screenshots also work in Rails system tests.

Do you have a link or something about how to make that work? About two weeks ago, I was struggling with screenshots and pushed it back to my to-do list.


See the top comment in this issue for my setup: https://github.com/rails/rails/issues/29688

Until the fix is released for Rails(the issue is resolved, but I don't think it's published to rubygems) you'll also need the monkeypatch I added later on in the issue report(or some other code to that effect).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: