Headless testing display error - maven

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.
Firefox: 39
Maven: 3.3.3
Java: 1.7.0_79
Selenium: 2.46 & 2.47(currently 2.47)
Jenkins: 1.622
Xvnc: 1.3.9
ubuntu 14
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

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 &

Related

Server agent not opening in JMeter

I installed serverAgent 2.2.3
When I run it in cmd I get this error.
enter image description here
I tried starting the startAgent. bat. It automatically closes.
Thanks for looking.
That's very weird because the error states that sl4j library cannot be found in CLASSPATH and ServerAgent doesn't use this library at all.
Try downloading it from Github and unpacking it somewhere else. Also if you have CLASSPATH environment variable set - try clearing/unsetting it.
set CLASSPATH= && startAgent.bat
More information: How to Monitor Your Server Health & Performance During a JMeter Load Test
Alternatively you can try downloading sl4j.jar and dropping it near ServerAgent.jar but it is not a part of normal ServerAgent installation procedure.

Nightwatch starts selenium and then hangs indefinitely

I'm running a simple nightwatch test on a Windows 10.1 machine. The tests starts up selenium server (e.g., selenium server... started - PID: 12784), but it never gets to the test code. I can use a browser to get to the localhost server page that is spawned from the "node nightwatch.js -t test.js" command, so I know the server is working properly. I've also tried running nightwatch with different browsers, e.g., -e chrome, firefox, IE, and phantomjs, and none of them work. Putting --verbose on the command doesn't provide any more console spew, so not sure how to debug this. I'm running with selenium-server-standalone v2.53.0.
Any suggestions?
Solved my own problem. Turns out the problem was with incompatible versions of node, nightwatch, and python. I figured it out by creating a totally separate clone of my repository and reinstalling all the node/nightwatch/selenium dependencies. Would be nice if there was a debug feature that could be enabled to indicate more details about where a node or nightwatch application is during application startup. I learned of node-inspector, so I'll check it out as a possible debug tool.

Selenium Web Driver does not work on xvfb

I want to run my Robot Framework tests which include Selenium2Library keywords on an Ubuntu remote machine so they should be run without a display. At first I just tried to run a simple test and get following result:
WebDriverException: Message: The browser appears to have exited before we could connect. If you specified a log_file in the FirefoxBinary constructor, check it for details.
I installed xvfb in order the run headless tests and run these lines on remote shell:
sudo Xvfb :10 -ac
export DISPLAY=:10
Now i am getting the following error and I can't get rid of it
test | FAIL |
WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details.
I checked nearly all questions here about Selenium on xvfb and this specific error.
Since some mentioned about Selenium - Firefox incompability, I tried updating selenium (it is up to date, version 2.46.0), my Firefox was latest and i has not worked.
Then I tried using an old firefox relase (35.0) which is also not worked
Now I'm trying a solution for this problem and I am almost sure it is about fireofx.
Thanks for your answers and advices
EDIT:
->Runing tests with chrome works just fine
->Also i checked my iptables if there is a rule blocking network to local, it is in default state

Issue with IOS Instruments running from command line on build machine

I've successfully run IOS UI Automation Instruments from command line on my local Mac. When it starts to test, the simulator will automatically pop up and then do the stuff.
However, when I SSH to a build server (with OSX and xcode, will use Jenkins eventually) and try to do the same thing, it doesn't work well.
Building process is fine, but as long as I run instruments, the terminal will then hang there without doing anything. I figure it has something to do with iphone simulator GUI but since it's CLI, I don't know what's going on...
Do you guys have any idea? Thanks!!
.
After executing the command from Jenkins through SSH; in most cases you would see a pop up window as in the screen shot. You will have to get past this screen to execute your tests. This post addresses how to get past that issue Stop "developer tools access needs to take control of another process for debugging to continue" alert
I've had the same issue. instruments -w "$DEVICE" were ignoring parameters.
Same with
DEVICE_TARGET='iPhone 6 (8.1 Simulator)' cucumber --format json -o test-reports/cucumber-8.1-iphone.json
It were ignoring DEVICE_TARGET parameter.
Solved via running Jenkins slave NOT as a SSH slave but as the Slave agent via java web start
http://i.stack.imgur.com/lNlPA.png
As i understand this issue is caused by OS X launchagent that managing sshd and performs scope of restrictions for remote users.
IMPORTANT! Slave agent should be started from OS X desktop, not via ssh! I've connected via VNC and launched slave java web agent on the OS X UI terminal.

Has anybody run Xvfb on EC2 with CentOS?

I am trying to get javascript-enabled cucumber running on CentOS in EC2 by following this tutorial: http://makandra.com/notes/1391-how-to-hide-your-selenium-browser-window-with-headless However, the scenarios that require javascript just fail without any exception message.
In order to debug, I just went to see if Xvfb is working correctly with according to this tutorial: http://blog.kabisa.nl/2010/05/24/headless-cucumbers-and-capybaras-with-selenium-and-hudson/
I tested the command:
Xvfb :99 -ac -screen 0 1024x768x16
I got the error msg like this:
_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/ip-10-116-82-44:99
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6
I googled for solutions about of these errors. I haven't found a good solution for this yet. If I run the same command again, I get:
Fatal server error:
Server is already active for display 99
If this server is no longer running, remove /tmp/.X99-lock
and start again.
So the server is supposed to be up and running already. However, when I tried to run this in followups:
DISPLAY=:99.0 firefox http://www.google.com
The console just hangs there, until I contol + C to kill it.
Is there anyone who knows what's going on here?
Thanks in advance.
It seems that it's okay. Your console didn't hang - it is firefox is working - you just don't see it:)
Edit: I think you can connect there with ssh -X and you'll see firefox window if it is working. (Only if you're running linux/mac on your dev machine)

Resources