NotConnectedException error in WebDriver tests running Jenkins on Linux

I have a WebDriver test using FirefoxDriver that I am trying to run as a Jenkins job.

It works fine on Windows, it also works from the command line on Linux, where my Jenkins server lives.

Unfortunately, during the execution of Jenkins' assignment, I received the following error:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms 

The Jenkins task consists of two steps: a shell step that performs:

 Xvfb :1 -screen 0 1024x768x24 & export DISPLAY=:1 

And then the maven package to run the test class.

Why can't I complete a Jenkins job to launch Firefox?

+4
source share
2 answers

Which finally ended up having to create all of Jenkins work as one step that executed shell commands:

 Xvfb :1 -screen 0 1024x768x24 & export DISPLAY=:1 mvn package 

and it worked. No longer a NotConnectedException.

I originally had Jenkins task as 2 steps, a wrapper for creating a virtual frame buffer, and a maven target.

+5
source

When you run a job from jenkins, it performs the same test as the Jenkins user. You need to add another line in the etc / hosts file for the jenkins user, for example

 your.ip.address.value jenkins 
0
source

All Articles