Prashant Palve
Prashant Palve

Reputation: 178

How to run chrome driver in headless mode or in background

I've been using chrome driver (with selenium webdriver), so far it never caused any issue, now for some requirement i want to run test cases in background. How can I do this?

Upvotes: 3

Views: 7647

Answers (2)

Anjan Mondal
Anjan Mondal

Reputation: 27

Currently Chrome 59 supports headless mode. You just need to use those chromeOptions to use headless chrome in selenium.

chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--disable-gpu"); 

You can refer below link for more details:
https://www.automation99.com/2017/07/how-to-use-chrome-headless-using.html

Upvotes: 3

StrikerVillain
StrikerVillain

Reputation: 3776

According to this post Any way to start Google Chrome in headless mode?, a new flag --headless is available in Chromium but Selenium is still to catch up as far as my limited googling skills tell me.

In the mean time you can explore HTMLUnitDriver for headless testing.

WebDriver driver = new HtmlUnitDriver((BrowserVersion.CHROME), true);

Upvotes: 1

Related Questions