Headless Browser | Headless execution of automation test | Pros and Cons of Headless execution

preview_player
Показать описание
In this video we will discuss about headless execution and will see that how can we execute our script on headless browser.

Headless browser is basically a web browser without a GUI. There are some pros and cons of headless browser testing.

Pros:
Execution Speed

Avoid Setup
Website scraping

Cons:
Can not mimic real users
Difficult to debug code

Below are some popular headless browsers:

Google Chrome

Google Puppeteer

HtmlUnit

PhantomJS
Firefox

Now lets see that how can we run our automation test on headless browser.

To run the headless execution on chrome, please use below code.
ChromeOptions options = new ChromeOptions();
driver = new ChromeDriver(options);

To run the headless execution through HtmlUnit, please use below code.

WebDriver driver = new HtmlUnitDriver();

To run the headless execution through HtmlUnit, please use below code.

WebDriver driver = new PhantomJSDriver();
**********Please comment in case of any query*************

Also please watch other videos as well.

n

Рекомендации по теме
Комментарии
Автор

Thank you for sharing your knowledge. I am very grateful for watching your videos. I have a question: How do I set the screen size of browsers in Jenkins? While executing on my local Windows, all my test cases passed, but on Jenkins, they failed because the screen size did not change. In my Java Selenium code, I have set the dimensions as follows:
Dimension newSize = new Dimension(1936, 1048);.

JeyasankarA