Till Google Chrome 59, headless execution has been achieved using third party tools like PhantomJS or HTMLUnitDriver.
Earlier if you want to achieve headless test execution in Chrome, you had to use Xvfb (short for X virtual framebuffer). This is an in-memory display server for Linux which enables you to run graphical applications without a display.
But Google has released updates to chrome to achieve an inbuilt Headless test execution without using Xvfb or any other third party tools using a real browser – Chrome. This is available on Mac and Linux Os from Chrome 59. If you are using Windows, you need up update your Chrome version to 60 or above to achieve headless execution.
How to do Headless Test Execution: Its simple. All you have to do is add a chrome options argument before initializing your driver.
ChromeOptions options = new ChromeOptions(); options.addArguments("headless"); WebDriver driver = new ChromeDriver(options); driver.get("http://seleniumhq.org");