Jenkins doesn't launch the application under test on chromebrowser
I ran into an issue with Jenkins which I've never seen before and I thought I'll get some advice. Jenkins wouldn’t launch the AUT on the chrome browser for running selenium tests.
Steps that I followed:
- A Jenkins Master and Slave are setup on the same machine. Not as a windows service, but I launch them manually via command prompt
- I setup a project on the Slave node with 2 build steps. One for the MSBuild (I dowloaded the plugin) to build the solution and the second step for executing the windows batch command that will start the tests
- I also have a TFS plugin to fetch the server version of the solution to build on Jenkins
- So when I build the job on Jenkins Slave,
- The solution gets built successfully without any errors
- Then for the next build step, Jenkins executes the windows batch command and loads the .dll file. Says “starting execution..”
- Chromedriver launches. It opens up the chrome browser
- But the chrome browser wouldn’t launch the AUT. It just tries to load it and stays intact indefinitely until my Jenkins job times out
- With all this happening, my CPU utilization is at 100%. The browser that runs the Jenkins UI on the local host and Java.exe*32 consumes it to the fullest
- I ran the exact same MSTest.exe command (that I entered in the build step) in command prompt when Jenkins is not running and it launches the AUT successfully and tests ran
- I ran the exact same MSTest.exe command (that I entered in the build step) in command prompt when Jenkins is running. It again spikes the CPU to 100% and AUT never launches
I was also running into this issue and solved it as follows.
Basically the jenkins slave has to be started from the startup through a batch job.
Here is the step by step process.
Node URL : http://host:port/computer/nodeName/
- Go to the node "Node URL"
- Click on "Mark this node temporarily offline"
- Go the the machine where slave is running.
- Open command prompt in admin mode.
- cd to the location where jenkins is installed
- Execute jenkins-slave uninstall
- Go to services (type services in run) and stop the jenkins slave running
- Restart the machine.
- cd C:\Users\myUserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
- Create a new batch job (name say LaunchJenkinsSlave.bat) with following content
> java -jar C:/Jenkins/slave.jar -jnlpUrl http://host:port/computer/nodeName/slave-agent.jnlp -secret yourSecret
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
<< fyi : You can refer jenkins-slave.xml in your Jenkins install location for yourSecret, nodeName, host ect if you forgot.
- Restart your machine.
Observation : Jenkins slave will be started automatically 12. Go to the "Node URL" and bring the node back online.
Hope this helps.