1

I'm trying to set up a Selenium tests on a CI server (Jenkins). It runs on Centos 5 and has no monitor. For Selenium tests I need a way to run Firefox so I've had Xvfb installed. I'm using selenium-maven-plugin to start the Xvfb.

<profile> <id>xvfb-selenium</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>selenium-maven-plugin</artifactId> <version>2.0</version> <executions> <execution> <id>xvfb</id> <phase>pre-integration-test</phase> <goals> <goal>xvfb</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> 

It is inside a profile because I want to run it on CI, but development machines don't need that.

Again I use selenium-maven-plugin to run my selenese tests

<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>selenium-maven-plugin</artifactId> <version>2.0</version> <executions> <execution> <id>nessos-selenium-tests</id> <phase>integration-test</phase> <configuration> <browser>*firefox</browser> <suite>src/test/resources/test-suite.html</suite> <startURL>${selenium.startURL}</startURL> </configuration> <goals> <goal>selenese</goal> </goals> </execution> </executions> </plugin> 

Now when I try to run this, I get this error in Jenkins:

message : Selenium is already running on port 4444. Or some other service is. Stack trace : java.net.BindException: Selenium is already running on port 4444. Or some other service is. at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:410) 

This doesn't tell me much so I investigated more. In target/selenium/xvfb.log I've got this error:

(EE) config/hal: NewInputDeviceRequest failed (2) (EE) config/hal: NewInputDeviceRequest failed (2) (EE) config/hal: NewInputDeviceRequest failed (2) (EE) config/hal: NewInputDeviceRequest failed (2) (EE) config/hal: NewInputDeviceRequest failed (2) 

At this point I'm clueless. From maven logs I can see that xvfb goal runs before selenese with this output:

Created dir: /home/jenkins/workspace/myBuild/target/selenium Launching Xvfb [INFO] Redirecting output to: /home/jenkins/workspace/myBuild/target/selenium/xvfb.log Waiting for Xvfb... Xvfb started 

I've tried following the instructions here: http://mojo.codehaus.org/selenium-maven-plugin/examples/headless-with-xvfb.html

I did the

chmod u+s `which Xvfb` 

thing and the error message changed to:

Fatal server error: PAM authentication failed, cannot start X server. Perhaps you do not have console ownership? 

At the bottom of the headless-with-xvfb page there were instructions to fix that. I did that also and now I get (EE) config/hal: NewInputDeviceRequest failed (2) again.

Does anyone know how I would continue to debug this error? Or does anyone know what that error even means?

1 Answer 1

1

Really embarassing :) It was already working and that error message can be ignored. My final solution is to start xvfb with the plugin in pre-integration-phase, run jUnit tests with WebDriver API in the integration-test phase. Xvfb closes when the maven run is completed

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.