Hi;
I am using the following command to run my Serenity test cases using firefox browser, passing user credentials. It is working perfectly.
mvn clean verify -Dwebdriver.driver=firefox -DuserId='xxxx' -Dpasscode='xxxxxxx'
Now I need to integrate with Jenkins which is running on a Redhat Linux machine, which has no GUI. It had been just now only got installed with firefox browser. I had provided geckodriver binary in my code itself. The above command is invoking the browser, but may be because of OS with out GUI, it is not completing the tests and giving in the console the following message: _"timeout waiting for a browser"_.
The solution, I think is to run the browser tests in _head-less mode. How to do that ?_
I saw some thing regarding configuring headless testing using firefox at
Johns Serenity BDD book.
gecko.firefox.options="""
{
args": ["-headless", "-profile", "/path/to/my/profile"],
"prefs": {
"dom.ipc.processCount": 8
},
"log": {
"level": "trace"
}
}
But it is talking about JSON configuration options in the serenity.conf file. Where as I am using serenity.properties and I can't give path to profile, as it is running in Jenkins which is on a corporate Redhat Linux box.
I added the following to the serenity.properties file.
webdriver.driver=firefox
gecko.firefox.options = {"args": ["-headless"]}
It ran well, but gave some weblocator errors like one or two button as stale or not attached to the DOM.
Without headless option, it ran perfectly with out any errors. Why headless is causing weblocator errors to come up ?
Your configuration is correct. However running in headless mode sometimes highlights issues in your tests that don't appear in your browser, so it is most likely a problem that can be fixed by refactoring your test.
Thank you very much John !
Is running Chrome in headless mode is also same ? As I read some where, the headless driver is built in the Chrome Web Driver since version 59. Just providing the ChromeDriver binary as part of the project code should be enough to run the Serenity testing in with Chrome headless mode. Right ?
OR
Should we add any additional configuration in serenity.properties file ?
Some one else where advised me to install XVFB (XVFB STANDS FOR: X VIRTUAL FRAME BUFFER.) to be able to run headless mode xvfb link.
Our preference is to run Chrome in headless mode rather than Firefox. Just to make it known.
Please advice.
Thanks a million.
Just add headless.mode = true to your serenity config file
Closing as answered
Just add
headless.mode = trueto your serenity config file
that param does not work for me
Most helpful comment
Just add
headless.mode = trueto your serenity config file