Can't get my protractor running on remote server on headless mode. I'll be glad if anyone could help
This is my qa server setting:
Under /etc/init.d/xvfb script to stat Xvfb :99
export DISPLAY=:99 set in bash_profile ( echo $DISPLAY returns :99)
firefox and protractor installed.
My project pom.xml:
I'm using maven-wagon-plugin to execute
The script starting xvfb on display:99 on my qa server
Run protractor protractorTest/conf.js on my qa server
When running the job from jenkins
=> I'm getting error E/launcher - Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.
Firefox console output: Error: no display specified
Checked if the xvfb is running:
ps -ef | grep Xvfb on QA server shows the Xvfb process running, but
Please let me know if something is wrong or missing?
The xvfb need to start in the same script that is running protractor. So Maven wagon plugin can be used to execute the command that starts the xvfb + runs protractor tests.
Source: #sou comment.
Related
I am trying to integrate CI/CD using Jenkins. I have properly set Jenkins up on my mac by installing Java JDK and all. The localhost url was also accessible. I was able to manage plugins using http://localhost:8081 url.
But I accidentally closed the terminal window and the Jenkins was stopped. The url stopped working. It now shows error
This site can’t be reached
localhost refused to connect.
I tried to run the Jenkins from terminal using this command
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
also this command:
sudo launchctl start /Library/LaunchDaemons/org.jenkins-ci.plist
The terminal asks for password, but the url still does not work. I even tried unloading the Jenkins using this command:
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
Then again loading and starting command. But its not working.
Any help would be appreciated. Thanks
This is how I solved the above problem
Go to Jenkins directory
/Users/me/Downloads/Jenkins
Then run Jenkins on any port (default 8080 or any other)
java -jar jenkins.war --httpPort=8081
And the localhost is working now.
This was a stupid situation.
I'm using vmrun.exe from VMware Workstation to start an Ubuntu 16 desktop VM and launch a Java selenium Firefox process in it. I can start and launch the script however I would like the selenium process to be visible in case a user would like to monitor it. It gives the following error when trying to launch firefox with a visible GUI.
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/home/vmdops/firefox/firefox) on port 7055; process output follows:
Error: GDK_BACKEND does not match available displays
The following bash script is used to launch the process
java -jar seleniumProcess.jar
I can execute the process headless with XVFB and run the selenium process in memory however then I cannot view the process running visually.
/usr/bin/Xvfb :1 & export DISPLAY=:1
java -jar seleniumProcess.jar
What is the proper terminology to explain why the firefox browser cannot be displayed?
Is there anyway to launch the selenium process from VMRUN that allows the firefox browser to display normally?
Thanks
Conteh
I was able to resolve the issue adding -interactive to the end of the command
vmrun -T player -gu vmdops -gp xxxx runScriptInGuest "C:\VMDOPS2\VMDOPS2.vmx" /bin/bash "sh /home/vmdops/autovpn/runProfiler.sh" -interactive
This works when the use is already logged in interactively. When I launch too quickly after starting the vm I get the following error.
Error: The specified guest user must be logged in interactively to perform this operation
So one must wait a while after booting.
I have a job in Jenkins that runs UI tests written in Selenium. The job can run multiple instances of it concurrently. I am running into a problem while trying to use Xvfb (the Xvfb plugin or otherwise).
Using the Xvfb plugin
The configuration is as below.
The plugin assigns the same display port to 2 concurrent job instances, and then one fails.
From the Xvfb log (note displayfd is 2 and screen is 0 in both cases):
Xvfb starting$ /usr/bin/Xvfb -displayfd 2 -screen 0 1024x758x16 -fbdir /srv/jenkins/xvfb-86-2156913754362856583.fbdir
Xvfb starting$ /usr/bin/Xvfb -displayfd 2 -screen 0 1024x758x16 -fbdir /srv/jenkins/xvfb-87-5845090375656014678.fbdir
One of the above 2 job instances fails. The failure message is this:
02:11:51 _XSERVTransSocketINETCreateListener: ...SocketCreateListener() failed
02:11:51 _XSERVTransMakeAllCOTSServerListeners: server already running
How can this error be fixed so that the concurrent instances run without any issue?
Further, I wonder how Xvfb plugin does the association of the display to the running browser instances (Firefox in this case). Does it do export DISPLAY=:xx internally, where xx = the display port as computed by the plugin?
Command line (not using Xvfb plugin)
The second way I tried is not to use the plugin and run Xvfb directly using the CLI. I used the Jenkins env variable BUILD_NUMBER to ensure unique display association to the job instance.
export DISPLAY=:${BUILD_NUMBER}
Xvfb :${BUILD_NUMBER} -screen 0 1024x768x24 &
Xvfb starts up fine in both job instances, but the tests fail with this.
Failed to connect to binary FirefoxBinary(/usr/local/bin/firefox) on port 7055; process output follows:
Error: cannot open display: 0:0
It appears the tests are still trying to use display 0:0.
Any help to fix this problem is greatly appreciated.
Have you tried to use Display environment variable in Jenkins, the same Xvbf has started with? In my case it worked and I followed the instructions, described in this article headless execution selenium tests in Jenkins
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)
I have a WebDriver test using the FirefoxDriver that I am attempting to run as a Jenkins job.
It works fine in Windows, it also works from the command line in Linux, where my Jenkins server lives.
Unfortunately, I got the following error during executing as a Jenkins job:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
The Jenkins job consists of 2 steps: a shell step that executes:
Xvfb :1 -screen 0 1024x768x24 &
export DISPLAY=:1
And then a maven package to run the test class.
Why can't I get the Jenkins job to execute Firefox?
What finally ended up working was to create the entire Jenkins job as one step that ran shell commands:
Xvfb :1 -screen 0 1024x768x24 &
export DISPLAY=:1
mvn package
and that worked. No more NotConnectedException.
I had originally had the Jenkins job as 2 steps, shell to create virtual frame buffer and maven goal.
When you run the job from jenkins, it runs the same test as "Jenkins" user. You need to add one more line in etc/hosts file for jenkins user like
your.ip.address.value jenkins