Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins running selenium tests without opening browser

I browsed a lot on this topic. There are different variations of this question or no answer to fix my issue. Any help is appreciated.

  1. I have installed firefox on my VM as root in /usr/bin/firefox.
  2. I downloaded the maven project to run selenium tests, and run it manually on my VM using mvn clean install command. This opens the browser and also successfully runs the test.
  3. Now I run Jenkins as myself ( JAVA_HOME is /usr/java/latest and started the service as nohup java -jar jenkins.war --httpPort=-1 --httpsPort=8082; version is 1.522).
  4. Create a new freestyle s/w project; Configure the job to download the maven project and invoke maven target 'clean install';
  5. When I run the job, I can see the steps in the console output but the browser is not opening. It also locks up my AD account.

Why is this happening? What is the fix?

like image 660
user1164061 Avatar asked Nov 02 '22 17:11

user1164061


1 Answers

nohup runs Jenkins in the background (http://en.wikipedia.org/wiki/Nohup), in which case according to this post Jenkins will start the browser in the background as well.

Try starting jenkins without nohup so that it runs in the foreground (java -jar jenkins.war --httpPort=-1 --httpsPort=8082).

Or you can start Jenkins as a daemon (this Jenkins Wiki page contains an example of init script). When Jenkins is started as daemon, the browser started by its job is visible.

like image 116
ikostenko Avatar answered Nov 09 '22 12:11

ikostenko