Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenide - How to run it with a headless Chrome?

We are trying to developer an automation test, and we found Selenide an interesting and easy framework for running the UI tests.

Selenide needs as an input the browser to use.

So we are passing 2 arguments to the program:

selenide.browser=Chrome
webdriver.chrome.driver=C:\\chromedriver_win32\\chromedriver.exe

And the code looks something like that:

System.setProperty("webdriver.chrome.driver",inputParams.get("webdriver.chrome.driver"));
System.setProperty("selenide.browser", inputParams.get("selenide.browser"));

open("http://example.com:8080/myPages");

All works fine, but we also need it to run in headless mode.

We tried several ways to run it in headless mode, (different param in the selenide.browser, PhantomJs and some other combinations, but with not success till now.

like image 291
riorio Avatar asked Sep 06 '25 03:09

riorio


2 Answers

It turned out that in order to run Selenide in headless mode we need to add system property selenide.headless=true

like image 123
riorio Avatar answered Sep 09 '25 18:09

riorio


You could do also:

 Configuration.headless = true;
like image 42
silver_mx Avatar answered Sep 09 '25 16:09

silver_mx