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?
Asked
Active
Viewed 7,044 times
2 Answers
3
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

taras
- 6,566
- 10
- 39
- 50

Anjan Mondal
- 27
- 4
1
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);

Community
- 1
- 1

StrikerVillain
- 3,719
- 2
- 24
- 41
-
Thanks, but i don't want to use HtmlUnitDriver because all the test cases cant run ,if changes only drivers.it gives an error. like **org.openqa.selenium.NoSuchElementException: Unable to locate a node and so on.** – Prashant Palve Mar 15 '17 at 10:27