0

I am using the following command to run my Serenity test cases using Chrome browser, passing credentials. It is working perfectly.

mvn clean verify -Dwebdriver.driver=chrome -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 ?

PraNuta
  • 629
  • 3
  • 12
  • 33
  • 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. – PraNuta Mar 15 '19 at 19:33
  • 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 ? – PraNuta Mar 15 '19 at 20:29

1 Answers1

1

In your serenity.properties file just add this

chrome.switches=--headless

Or you can run that via cmd line argument -Dchrome.switches=--headless. I run mine out of the properties file.

Also here is a list of chrome command line arguments chrome command line args