I had this small confusion around Selenium Standalone Server and Grid.
I have tried to summarize my understanding of starting Hub and multiple nodes.
Starting a hub using Selenium Grid:
java -jar selenium-server-standalone-2.40.0 -role hub -port 4443
-port 4443 is optional as the default port is 4444 and might be in use. The same output of successful server start is as below:
Apr 14, 2014 11:16:07 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a selenium grid server
2014-04-14 23:16:08.871:INFO:osjs.Server:jetty-7.x.y-SNAPSHOT
2014-04-14 23:16:08.907:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContextHandler{/,null}
2014-04-14 23:16:08.915:INFO:osjs.AbstractConnector:Started SocketConnector@0.0.0.0:4443
5555 is the default port that is used to open a default node. This can be used if you are planning to use virtual machine as each machine would have 5555 available.
However, if you want to try the same on your local machine with three nodes as instance you could the following
java -jar selenium-server-standalone-2.40.0 -role node -hub http://localhost:4443/grid/register -port 5555
java -jar selenium-server-standalone-2.40.0 -role node -hub http://localhost:4443/grid/register -port 5556
java -jar selenium-server-standalone-2.40.0 -role node -hub http://localhost:4443/grid/register -port 5556
Sample Server Startup log would look like :
Apr 14, 2014 11:21:16 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a selenium grid node
23:21:17.554 INFO - Java: Sun Microsystems Inc. 20.5-b03
23:21:17.554 INFO - OS: Windows 7 6.1 x86
23:21:17.562 INFO - v2.40.0, with Core v2.40.0. Built from revision fbe29a9
23:21:17.640 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:5556/wd/hub
23:21:17.641 INFO - Version Jetty/5.1.x
23:21:17.642 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
23:21:17.643 INFO - Started HttpContext[/selenium-server,/selenium-server]
23:21:17.643 INFO - Started HttpContext[/,/]
23:21:17.645 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@1c92535
23:21:17.645 INFO - Started HttpContext[/wd,/wd]
23:21:17.648 INFO - Started SocketListener on 0.0.0.0:5556
23:21:17.648 INFO - Started org.openqa.jetty.jetty.Server@134bed0
23:21:17.649 INFO - using the json request : {"class":"org.openqa.grid.common.RegistrationRequest","capabilities":[{"platform":"VISTA","seleniumProtocol":"Selen
ium","browserName":"*firefox","maxInstances":5},{"platform":"VISTA","seleniumProtocol":"Selenium","browserName":"*googlechrome","maxInstances":5},{"platform":"V
ISTA","seleniumProtocol":"Selenium","browserName":"*iexplore","maxInstances":1},{"platform":"VISTA","seleniumProtocol":"WebDriver","browserName":"firefox","maxI
nstances":5},{"platform":"VISTA","seleniumProtocol":"WebDriver","browserName":"chrome","maxInstances":5},{"platform":"VISTA","seleniumProtocol":"WebDriver","bro
wserName":"internet explorer","maxInstances":1}],"configuration":{"port":5556,"register":true,"host":"192.168.1.3","proxy":"org.openqa.grid.selenium.proxy.Defau
ltRemoteProxy","maxSession":5,"role":"node","hubHost":"localhost","registerCycle":5000,"hub":"http://localhost:4443/grid/register","hubPort":4443,"url":"http://
192.168.1.3:5556","remoteHost":"http://192.168.1.3:5556"}}
23:21:17.651 INFO - Starting auto register thread. Will try to register every 5000 ms.
23:21:17.651 INFO - Registering the node to hub :http://localhost:4443/grid/register
Remote webdriver instances would have to connect to :
http://locahost:5555/wd/hub
http://locahost:5556/wd/hub
Additional Information
While launching a node or hub look for the following in the console output
INFO: Launching a selenium grid server
INFO: Launching a selenium grid node
The command used for standalone server is
java -jar <sel.jar> -hub -port 4443
The command for starting a hub using Selenium Grid is
java - jar <sel.jar> -role hub -port 4443
Please note this change.
Regards,
Ajith Moni