Joe Lloyd
Joe Lloyd

Reputation: 22453

Headless testing display error

Background

I am running a set of selenium tests using a Maven and Jenkins with Testng. I had them working fine headlessly up until a week ago. Jenkins sits on the server accessible with port 8080. The tests also run fine through eclipse.

Software Versions

I have read lots about Firefox being incomparable with selenium so here is a list of software and versions that I am using.

Error

After I run the tests and the fail I check the console through Jenkins. The error I am getting makes me think it's a problem with Xvnc and firefox but I can't pin point it. I get a NotConnectedException. The firefox console error has changed a few times here is a list of different errors the console has shown me.

Error: cannot open display: :87

firefox: Fatal IO error 11 (Resource temporarily unavailable) on X server :46.

firefox: Fatal IO error 2 (No such file or directory) on X server :78.

Research

I've been on bugzilla but cant find a conclusive answer to the problem.

I've also looked around SO but found no fixes.

Conclution

From what I have gathered it is something to do with Xvnc, Could running

sudo apt-get update 

make changes to how Xvnc operates? I have updated the packages some time last week but our testers didn't check Jenkins properly when adding new tests and as such I've wasted and entire day trying to pin point when and what the problem is.

Question

What would cause Jenkins to return errors like this, how can I fix them and how can I prevent something doing this again?

EDIT 1

The display variable seems to be the issue, upon typing the command

echo $DISPLAY

There is no response just an empty line.

EDIT 2

running the command

export DISPLAY=:0.10

no gives the result

:0.10

when I echo $DISPLAY

Upvotes: 0

Views: 817

Answers (1)

VSK
VSK

Reputation: 469

I think the DISPLAY varibale is not functioning as expected and hence firefox is unable to connect to it. To know more about the $DISPLAY refer this link https://askubuntu.com/questions/432255/what-is-display-environment-variable

Try to run this command on the slave node where the job runs, this should give you the required setting for the tests to connect and run.

nohup /usr/bin/Xvfb :2 –screen 0 1024x768x24 > /dev/null 2>&1 &

Upvotes: 1

Related Questions