I wrote some automation tests using Selenium as I build a framework for the project I’m currently working on. Since I’m probably going to go with Jenkins to run them, I got him setup on my Windows 7 machine as I run through the tests. I ran into one problem: The tests would run fine if I ran them via the command line but they were failing when Jenkins ran them. I couldn’t figure out why.
What is that Jenkins guy doing?
After some investigating, I accidentally discovered a nifty setting in Windows for the Jenkins service that showed me exactly why the tests were failing. Under the Log On tab there’s a setting that says “Allow service to interact with desktop”. Enabling this brings up an “Interactive Services” prompt. When you click the button that says “View the message”, you are brought to the Jenkins interface and can see exactly what the nice man is doing. You see the browser window he’s opening and what he’s doing just like if you were running the Selenium test via the command line.
How to enable Interactive Services for Jenkins
Precondition: you’ll need to have Jenkins installed as a service. If you’re running Jenkins manually by running the war file this won’t work (unless I’m completely wrong about this in which case please let me know!)
Step One: Open the run dialog by clicking the Start button and selecting the “Run…” icon. If
the run icon is hidden you can always type the word “run” and the Start button will find it for you or be a keyboard shortcut ninja and press the Windows key + “R” together.
Once you have the Run dialog up, enter “services.msc” in the text box and click the Ok button. This will open the Services window showing you all the services that are running.
Step Two: Scroll down to the Jenkins service and right-click, select Properties.
Step Three: Click the Log On tab. In this tab you’ll see the option “Allow service to interact with desktop”. Enable this and click the Ok button.
Step Four: Restart the Jenkins service.
Once you restart the Jenkins service you should notice a new item in the taskbar requesting your action. Click on it to bring it up and you’ll see two options: “View the message” and “Ask me later”. If you click the “View the message” option it’ll bring you to the Jenkins session showing you what he’s doing. If you click the “Ask me later” option the prompt will go away until the next time Jenkins tries to do something (like when you run another test). If you ignore the options the prompt will stay in your taskbar.