Good news! You can now use Chrome browser without display… Wait… What? While most users want to actually see the page they load in a web browser, some may want to run their browser in a server without display. Headless mode in web browsers can be used for automated testing requiring loading web pages, extracting metadata, generating bitmaps from page contents, etc…
It’s been possible to do so in the past using Xvfb to emulate a framebuffer tricking the browsers to believe there was a display in Linux. But now headless mode is build-in right into browsers, so you don’t need X server running at all, and beside Linux, it will also work in Windows, and Mac OS.
You can launch headless mode in Chrome 59 (currently in dev channel) as follows:
google-chrome-unstable --headless --remote-debugging-port=9222 http://www.cnx-software.com
You may want to add
--disable gpu option to remove an error message. Then go to http://localhost:9222, or http://IP:9222 is you using an actual server in order to open the DevTools interface.
Google Chrome won’t be the only browser to support headless mode, as Firefox developers have also been working on it, and it might already work (or not) with nightly builds. To enable it, run the command below:
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.