Running Selenium RC as a Windows Service

Created 18 September 2009 11:28

We've recently started using Selenium as a testing tool at work. The IDE is great, particularly for filling in forms during development, but I'm a stickler for automated testing.

Selenium does off Selenium RC, which combined with nUnit allows for this in a variety of programming languages. The problem here, is that the server is a jar file, and I wanted it running as a windows service on our build server.

Anyway, I found a great article on that shows how to run just about anything as a windows service - and I successfully used that article to get Selenium RC running as windows service on our build server. Here are the steps:

  1. Install the latest Java runtime if you don't have it installed already
  2. Install the Selenium server (e.g. C:Seleniumselenium-server-1.0.1
  3. Download srvany.exe and instsrv.exe (these are part of the Microsoft Windows Resource Kit - you will need to download the correct version for your OS) and copy these files to a location on your server (e.g. C: eskit)
  4. Browse to this folder, and type: instsrv "Selenium RC" "C: eskitsrvany.exe" - this will create the windows service named "Selenium RC", which will now be installed as a Windows service, although it won't start up yet
  5. Open up regedit, and browse to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSelenium RC
  6. Right-click "Selenium RC" in the tree, and click New - Key, and add a key called "Parameters"
  7. Open Parameters, and create a new string value called "Application"
  8. Add the following to the data value for the new string value: "C:Program Files (x86)Javajre6injava.exe" -jar "C:Seleniumselenium-server-1.0.1selenium-server.jar", substituting paths to the java exe and the selenium server jar file where appropriate
  9. Load up the windows services console (services.msc) and start the service

kevinjamesfield on 02 October 2009 at 15:49
Thanks, this is very handy.
Nick on 20 October 2009 at 19:58
I&#39;d written a similar article recently:<br /><br /><a href="" rel="nofollow"></a>
DazAdams on 05 November 2010 at 19:17
I&#39;ve followed those steps. The service seems to be running but, when I trigger one of my Selenium tests from my Test Hub application the page just keeps saying Loading.<br /><br />If I stop it it throws an error so it seems like it is running but it doesnt seem to do anything.<br /><br />I&#39;ve also tried running it via the command line using the same command in the Application parameter and it works this way.<br /><br />Do you have any ideas?