I must admit I am not a fan of headless browsers for a number of reasons:
- Headless browsers aren’t representative of real users: a bug found using a headless browser like PhantomJS may actually not be a bug. For example, running tests against WordPress.com in PhantomJS 2.0 throws an error on the login page – this doesn’t happen in a real browser like Chrome (see screenshot below). Our customers don’t use headless browsers.
- Headless browsers make it harder to write/debug tests: since the browser is invisible, you can’t visually interact with a browser except by taking/saving screenshots . This is a lot easier in a real browser which you can interact with via a REPL.
- Real browsers can run headlessly anyway: Popular CI systems like CircleCI and TravisCI support running real browsers (Chrome, Firefox) on headless Linux slaves with zero configuration. The best of both worlds 🙂
At the end of the day, I much prefer browser automation tools that support driving real browsers for test and development, which are run headlessly through CI. This leads to representative test results and avoidance of ‘phantom’ bugs that aren’t reproducible in real browsers.