Running Selenium Server standalone 2 as a service in windows XP
Or if you want it start at startup, you can do this:
Create file
01_start_hub.bat
which will contain this command:java -jar selenium-server-standalone-2.20.0.jar -role hub
Create file
02_start_node.bat
which will contain this command:java -jar selenium-server-standalone-2.20.0.jar -role node -hub http://localhost:4444/grid/register
Place both bat files into Startup folder
C:\Documents and Settings\UserName\Start Menu\Programs\Startup
Yes you will have two "ugly" dos prompts after startup, but this is quickwin solutin
http://brantleytec.blogspot.com/2012/11/selenium-hub-and-node-as-windows-service.html
That link describes the process I used to set up and use Selenium hub and node as a service using native Microsoft programs. I was able to get this running locally on my work PC as well as on a remote server which runs my tests after every build.
If this is for your local PC though, I might suggest using the ChromeDriver instead of the RemoteWebDriver. It's less setup and allows new hires to start using your tests without any extra setup.
I've had a lot of luck with the Non-Sucking Service Manager. It's a standalone executable that creates and a windows service and works much better than any alternatives I've ever used (I'm thinking about srvany.exe). The usage instructions are pretty straightforward.
Here's how I used it:
- Download and extract nssm.exe
- I wanted to run a single instance that acted as both the hub and a node, so I didn't specify a role. I also just wanted the default settings, so I didn't pass in any parameters. Here's what I did from the command line: nssm install Selenium-Server "C:\Program Files\Java\jre6\bin\java.exe" "-jar C:\Selenium\selenium-server-standalone-2.21.0.jar"
If you want to run as just a hub or a node, then add in the -role hub or -role node to the last parameter in step #2, e.g. "-jar C:\Selenium\selenium-server-standalone-2.21.0.jar -role hub". You can specify any other parameters for Selenium here as well.
If you need to adjust the parameters later, you can do this through Regedit under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\\Parameters. Specifically, the AppParameters Key contains the parameters you pass to Selenium.