Any way to start Google Chrome in headless mode?

TL;DR

google-chrome --headless --remote-debugging-port=9222 http://example.com

You’d also need --disable-gpu temporarily.


Tutorial:

https://developers.google.com/web/updates/2017/04/headless-chrome


There’s a work in progress: https://code.google.com/p/chromium/issues/detail?id=546953

The main deliverables are:

  1. A library which headless applications can link to to.
  2. A sample application which demonstrates the use of headless APIs.

So it would be possible to create a simple application that runs in console without connecting to display.

Update Apr 18 ’16: The work is mainly done. There’s a public forum now:

https://groups.google.com/a/chromium.org/forum/#!forum/headless-dev

Documentation is being in progress:

https://chromium.googlesource.com/chromium/src/+/master/headless/README.md

Update Sep 20 ’16: It looks like chrome will eventually get the “–headless” parameter:
https://bugs.chromium.org/p/chromium/issues/detail?id=612904

There was a presentation on BlinkOn 6 (June 16/17, 2016)

Update Nov 29 ’16: Design doc for --headless flag: https://docs.google.com/document/d/1aIJUzQr3eougZQp90bp4mqGr5gY6hdUice8UPa-Ys90/edit#heading=h.qxqfzv2lj12s

Update Dec 13 ’16: --headless flag is expected to be available in Canary builds soon

Update Mar 12 ’17: Chrome 57 has a --headless flag working. Waiting for Selenium and other tools to catch up. User guide: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Leave a Comment