Running Selenium Grid Hub as a Windows Service

919 views
Skip to first unread message

Orion Ifland

unread,
Mar 6, 2009, 4:22:24 PM3/6/09
to selenium-users...@googlegroups.com
The basic instructions for getting a Selenium Grid Hub set up show how to do it in a Console window, but I was hoping to install the hub on my build/test server and make sure it's "always running" so the Selenium Grid nodes running Selenium RC would always be able to connect to it.

I've seen other techniques - starting a remote desktop session with the console app and leaving that desktop active, or using Ant to start up the hub, but since I'm not using Java (and I don't want to learn Ant right now), I found this would work:

# Download and unzip Selenium Grid.
# If you don't have it already, download and install the [JDK|http://java.sun.com/javase/downloads/]\\
# Download [Java Service Wrapper|http://wrapper.tanukisoftware.org/doc/english/download.jsp] and unzip it. (I'm using the Windows x86 Community Edition.)\\
# Using the "[Simple Integration Method|http://wrapper.tanukisoftware.org/doc/english/integrate-simple-win.html],"
## Create these folders in the Selenium Grid folder: *logs*, *conf*, *bin*.
## Copy/rename files from the JSW folder to the Selenium Grid folder: \\
### \src\conf\wrapper.conf.in +to+ \conf\wrapper.conf
### \src\bin\App.bat.in, \src\bin\InstallApp-NT.bat.in, \src\bin\UninstallApp-NT.bat.in +to+ \bin\SeleniumGrid.bat, \bin\InstallSeleniumGrid-NT.bat, \bin\UninstallSeleniumGrid-NT.bat
### \bin\wrapper.exe +to+ \bin\wrapper.exe
### \lib\wrapper.dll, \lib\wrapper.jar +to+ \lib\wrapper.dll, \lib\wrapper.jar
## Edit the \conf\wrapper.conf file:
### Set the location of Java.exe by editing the "+wrapper.java.command=java+" line, making sure to +not+ quote the path even if it has spaces in it:\\ wrapper.java.command=C:\Program Files\Java\jdk1.6.0_12\bin\java.exe\\
### Replace the "+wrapper.java.classpath.1=...+" line with these three lines:\\ wrapper.java.classpath.1=..\\ wrapper.java.classpath.2=../lib/selenium-grid-hub-standalone-1.0.3.jar\\ wrapper.java.classpath.3=../lib/wrapper.jar
### Change "+wrapper.app.parameter.1=<YourMainClass>+" to:\\ wrapper.app.parameter.1=com.thoughtworks.selenium.grid.hub.HubServer\\
### Set up the names/display names for the service:
#### wrapper.console.title=Selenium Grid Hub
#### wrapper.ntservice.name=selenium-grid-hub
#### wrapper.ntservice.displayname=Selenium Grid Hub
#### wrapper.ntservice.description=Central control server for Selenium Grid
## Test your configuration by running the \bin\SeleniumGrid.bat file. \\
*** If it works, you should see Selenium Grid Hub running in the console - one of the the last lines will likely say something about Jetty and you may see some of the Selenium Grid configuration fly past as it's starting up. You can shut it down by pressing Ctrl+C.\\
*** If it's not working, you'll probably see error messages about how the JVM wasn't found (meaning the path to Java is no good) or some other configuration problem. Or the batch file might run and close immediately.
# Once it's running with the SeleniumGrid.bat file, you can install the service by running the InstallSeleniumGrid-NT.bat file.
# To start the service, you can use the command line (net start selenium-grid-hub) or the GUI (Start->Administrative Tools->Services).

Hope that's helpful. I'm mostly posting it here so I remember how to do this next time. = )

Let me know if you have feedback on this or if I'm overlooking/missing anything.

- Orion

Message was edited by Orion Ifland to show correct classpath settings (to allow use of the grid_configuration.yml file)

ejohn

unread,
Mar 7, 2009, 4:11:34 AM3/7/09
to selenium-users...@googlegroups.com
[Orion Ifland|/people/ifland], hi.
That is interesting. i'll try this soon.
But do you have any ideas how to lanch Selenium RC as a windows service?
Thanks in advance.

Best regards,
ejohn, www.acumatica.com

Orion Ifland

unread,
Mar 7, 2009, 10:50:34 PM3/7/09
to selenium-users...@googlegroups.com
I think you could use JSW to run Selenium RC as a service - the only issue I can think of is that with RC, you need some sort of display on which to run Firefox. It's possible that it could run "headless", but I haven't tried that.

If you want to give it a shot, try following the instructions for a "Simple Integration" from the JSW site. (I have the link above.)

- Orion

Reply all
Reply to author
Forward
0 new messages