Selenium Grid:
Well, I have experienced the following scenarios while setting up the grid environment for the first time.
Here it is, I have two machine, say '10.19.137.247' (test dev machine) and 192.168.1.113 (test execution machine) so to start the hub from test dev machine I have run the following command:
On Test Dev Machine:
java -jar selenium-server-standalone.jar -role hubThe following message or information appeared on command line as a result
Mar 10, 2014 2:57:03 AM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a selenium grid server
2014-03-10 02:57:26.332:INFO:osjs.Server:jetty-7.x.y-SANPSHOT
2014-03-10 02:57:26.395:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContextHandler{/,null}
2014-03-10 02:57:26.410:INFO:osjs.AbstractConnector:Started SocketConnector@0.0.0.0:4444
On Test execution machine:
java -jar selenium-server-standalone -Dwebdriver.chrome.driver=C:\Users\Fayaz\Downloads\chromedriver.exe -role webdriver -hub http://10.19.137.247/grid/registerThe following message or information appeared on command line as a result
Mar 10, 2014 12:30:36 PM org.openqa.grid.selenium.GridLauncher mainIf we observer on the test machine to verify the status of the selenium web server whether the client / node is connected or not, in other words when no node connects to hub using selenium grid, it will looks like in the screen shot
INFO: Launching a selenium grid node
Mar 10, 2014 12:30:39 PM org.openqa.grid.internal.utils.SelfRegisteringRemote startRemoteServer
WARNING: error getting the parameters from the hub. The node may end up with wrong timeouts. Connection refused: connect
12:30:39.255 INFO - Java: Oracle Corportation 24.45-b08
12:30:39.263 INFO - OS:Windows 7 6.1 x86
12:30:39.295 INFO - v2.39.0, with Core v2.39.0. Built from revision ff23eac
12:30:39.565 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver registration is skipped: registration capabilities Capabilites [{platform=MAC, browserName=iPhone, version=}] does not match with current platform: VISTA
12:30:39:565 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver registration is skipped:
registration capabilities Capabilities [{platform=MAC, browserName=iPad, version=}] does not match with current platform: VISTA
12:30:39.648 INFO - RemoteWebDriver instances should connect to : http://127.0.0.1:5555/wd/hub
12:30:39.649 INFO - Version Jetty/5.1.x
12:30:39.650 INFO - Started HttpContext[/selenium-server/driver./selenium-server/driver]
12:30:39.651 INFO - Started HttpContext[/selenium-server,/selenium-server]
12:30:39:652 INFO - Started HttpContext[/,/]
12:30:39:654 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@12132a6
12:30:39.654 INFO - Started HttpContext[/wd,/wd]
12:30:39.657 INFO - Started SocketListener on 0.0.0.0:5555
12:30:39.658 INFO - Started Started org.openqa.jetty.jetty.Server@a4b9da
12:30:39.661 INFO - using the json request : {"class":"org.openqa.grid.common.RegistrationRequest","capabilities":[{"platform":"VISTA","seleniumProtocol":"Selenium","browserName":"*firefox","maxInstances":5},{"platform":"VISTA","seleniumProtocol":"Selenium","browserName":"*googlechrome","maxInstances":5},{"platform":"VISTA","seleniumProtocol":"seleniumProtocol":"WebDriver","browserName":"chrome","maxInstances":1},{"platform":"VISTA","seleniumProtocol":"WebDriver","browserName":"internet explorer","maxInstances":1}],"configuration":{"port":5555,"register":true,"host":"192.168.1.113","proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","maxSession":5,"role":"node","hubHost":"10.19.137.247","registerCycle":5000,"hub":"http://10.19.137.247/grid/register","hubPort":-1,"url":"http://192.168.1.113:5555","remoteHost":"http://192.168.1.113:5555"}}
12:30:39.664 INFO - Starting auto register thread. Will try to register every 5000 ms.
12:30:39.664 INFO - Registering the node to hub :http://10.19.137.247:-1/grid/register
12:30:41.466 INFO - couldn't register this node : Error sending the registration request.
12:30:48.264 INFO - couldn't register this node : Hub is down or not responding: Connection refused: connect
When no nodes connects to a hub using selenium grid then the server details displayed |
This error has been resolved after I corrected the command to connect the hub from my test dev machine, and the changed command is
java -jar selenium-server-standalone.jar -Dwebdriver.chrome.driver=C:\Users\Fayaz\Downloads\chromedriver.exe -role webdriver -hub http://10.19.137.247:4444/grid/register
The difference here is I am using port number ':4444' after test machine URL and also it is necessary to mention the driver using at command line or else, we need to set it as a property in our code using DesiredCapabilities reference.
After connecting to the server, we can verify the status of the selenium web server whether the client / node is connected or not, it will looks like in the screen shot
When a node connects to hub using selenium grid then the list of details displayed |
The path in browser to see list of clients or nodes connected to a hub at server / hub side is,
localhost:4444/grid/consoleFor a beginner most common and exception can occur as follows, part of exception pasted
Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property;OR
Error forwarding the new session cannot find for IEOR
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failureFor more info please find the source here for chrome and for Internet explorer or for RemoteWebDriver and for a quick start of Grid2
Update :
From the latest release of selenium 3.x, if we use above command to register client to remote hub then we get the following exception
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -Dwebdriver.chrome.driver=C:\Users\Fayaz\Downloads\chromedriver.exe
at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
at com.beust.jcommander.JCommander.parse(JCommander.java:282)
at com.beust.jcommander.JCommander.parse(JCommander.java:265)
at com.beust.jcommander.JCommander.<init>(JCommander.java:210)
at org.openqa.grid.selenium.GridLauncherV3$3.setConfiguration(GridLauncherV3.java:267)
at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:155)
at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:75)
So the command to register a node / client is changed as follows:
java -jar selenium-server-standalone-3.3.1.jar -role node -hub http://<hub_ip>:4444/grid/register -port 4444
Thanks for the selenium grid start up post..
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete