开发者

Executing Selenium 2 jar with Jenkins as part of a PHPUnit test raises error

开发者 https://www.devze.com 2023-03-23 21:18 出处:网络
I\'ve build a small java application that uses selenium 2 to open a web page and return its result. The application is called as a part of a PHPUnit test which is in turn run as part of an ANT build

I've build a small java application that uses selenium 2 to open a web page and return its result.

The application is called as a part of a PHPUnit test which is in turn run as part of an ANT build.

The problem is when the Jenkins builds the project and runs the test the following error shows

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.开发者_如何学JAVA0.1 on port 7055 after 45000 ms

When I run the build in the command line in the jenkis working directory it all works fine. I think that the problems is that the jenkins service doesn't have enought security permissions.

This is the first line of the console output of the jenkis build

Started by user anonymous

The os is Ubuntu 9

Blockquote


The problem was that the jenkins user wasn't able to connect to a X sessions. The solution was really simple.

First we need to install a vnc server:

sudo apt-get install tightvncserver

Then we need to switch to the jenkins user and start the vncserver for the first time in order to set its password:

sudo su jenkins vncserver

The password I'v set is jenkins and I've answered with N to the do you wan't to create a view only password.

Then I needed to install the Xvnc plugin on the jenkins plugin administration panel and to tick the "Run a vnc server during" builds checkbox.

Everything else worked just fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消