I usually using headless to run automation script because it's a very useful mode for automated testing. Today i will introduce to you Headless mode.
So what is headless mode? It 's a mode that operates without displaying the screen which was delivered from Google Chrome 59. It means you can run auto script and don't need to launch a browser and I think it makes your script run faster, avoid to face some challenges such as slow rendering on the browser, interference of other applications running on the system.
Benefits of headless browser for test execution
- Useful in CI pipeline: When we need to execute automated test cases remotely on server and release pipelines for continuous integration server like Jenkin, it is not always possible to install real browsers on remote machines.
- Beneficial in web scraping: When you want to write a web scraper or data extractor that needs to visit some websites and collect data, headless browsers are a perfect choice.Because we are not concerned about functionality in these case, we just want to visit web pages and get data.
- Support for multiple browser versions: Sometimes, the tester would like to simulate browser version on the same machine. In that case, you would want to use headless mode because most of them support the simulation of different versions of browsers.
- Multi Tasking: You can use your browser of your machine to do anything else while tests are running in the background.
Using Headless Chrome from Selenium
Using Headless doesn't have too much difference than using regular Chrome. Operate Chrome from Selenium through Chrome Driver. Pass ChromeOptions as an argument when creating Chrome's WebDriver and specify the path, argument of Chrome to execution.
Understanding headless mode and getting used to it will be very useful with scriptors.
If you want to become a master automation engineer you need to have deep understanding how to use test management tools and settings to make your test execution become easier. So now you got the knowledge about headless mode and you can research more anything else about other mode. Thank you for your reading.