Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
Introduction
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.
How to do it with Java
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
Running Selenium Tests with Chrome Headless was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.