Before Google Chrome 59 the headless execution must be done by 3party headless browsers like PhantomJS, SlimerJS, TrifleJS, Nightmare, and HTMLUnit.
The "problem" is that these headless browsers emulate some engines, but not V8 (Chrome engine).
PhantomJS | QtWebKitSlimerJS | Gecko (Firefox)TrifleJS | Trident (Internet Explorer)Nightmare | Electron
When we talk about testing, and most of the users in various segments use Google Chrome, it's necessary to simulate the real engine.
As Google Chrome shipping headless in version 59 (as you can see here) we can tell to ChromeDriver the options before the execution.
In the code below I added two options through ChromeOptions: headless and the window-size.
The headless option will tell Google Chrome to execute in headless mode.
The window-size is a way to control the responsiveness (may your site be displayed as a mobile site if you not set a window size).
You can see another way to inform the ChromeOptions herehttps://sites.google.com/a/chromium.org/chromedriver/capabilities