Running Automation Script in Chrome Headless with TestNg


Related image

In this blog, we are going to learn how we can execute Selenium Automation Test in Headless mode or browser using Chrome.

Before Going Further let's Understand what is Headless Browser.

As Name Suggest Headless Browser is a browser without any user interface it would execute all our test case like a normal web-browser but we won’t be able to see that execution on our screen.



There are many famous headless driver available in the market like:

Chrome Headless Driver
Firefox Headless Driver
HTML unit Driver
PhantomJs
Ghost Driver
·       
          In this blog, we are going to learn about Chrome Headless Driver.

To use Chrome browser we need to addArguments –headless
in our code.


Please refer below code snippet where I have executed two tests in chrome headless mode along with TestNg.


After executing the Code, Result will be like:




After Reading this the next logical question you would be having how to capture screenshot in Headless Mode. Please Refer this blog for more details.





SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post