0
votes

I tried to search stackoverflow for answer to this question but didn't get the right one. So posting this. Please let me know how to solve this.

I am trying to set up a selenium grid with my local machine as hub. I created a microsoft azure VM and trying to use it as node.

I executed the following command on hub (my local machine) and it started listing on port 4444.

java -jar selenium-server-standalone-2.53.1.jar -role hub

I executed the following command on the VM (node) but it's not getting registered with the hub.

java -Dwebdriver.chrome.driver="D:\selenium\geckodriver.exe" -jar selenium-server-standalone-2.53.1.jar -role webdriver -hub http://
176.154.37.8:4444/grid/register/ -port 5566

I have opened all the required ports on the VM but still it is not working. The logs are shown below.

Can you please check it and let me know what mistake I am doing?

Hub log:

E:\>java -jar selenium-server-standalone-2.53.1.jar -role hub

18:40:38.638 INFO - Launching Selenium Grid hub

2018-06-29 18:40:40.478:INFO::main: Logging initialized @2079ms

18:40:40.497 INFO - Will listen on 4444

18:40:40.565 INFO - Will listen on 4444

2018-06-29 18:40:40.569:INFO:osjs.Server:main: jetty-9.2.z-SNAPSHOT

2018-06-29 18:40:40.606:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@17211155{/,null,AVAILABLE}

2018-06-29 18:40:40.636:INFO:osjs.ServerConnector:main: Started ServerConnector@4d85a01a{HTTP/1.1}{0.0.0.0:4444}

2018-06-29 18:40:40.639:INFO:osjs.Server:main: Started @2241ms

18:40:40.640 INFO - Nodes should register to http://176.154.37.8:4444/grid/register/

18:40:40.640 INFO - Selenium Grid hub is up and running

Node Log:

D:\selenium>java -Dwebdriver.chrome.driver="D:\selenium\geckodriver.exe" -jar selenium-server-standalone-2.53.1.jar -role webdriver -hub http://176.154.37.8:4444/grid/register/ -port 5566 -debug

14:24:05.488 INFO - Launching a Selenium Grid node

14:24:06.285 DEBUG - CookieSpec selected: default

14:24:06.301 DEBUG - Auth cache not set in the context

14:24:06.301 DEBUG - Connection request: [route: {}->myurl:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]

14:24:06.332 DEBUG - Connection leased: [id: 0][route: {}->myurl:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000]

14:24:06.332 DEBUG - Opening connection {}->myurl:4444

14:24:06.332 DEBUG - Connecting to /192.168.32.1:4444

14:24:27.352 DEBUG - http-outgoing-0: Shutdown connection

14:24:27.352 DEBUG - Connection discarded

14:24:27.352 DEBUG - Connection released: [id: 0][route: {}->myurl:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]

14:24:27.352 WARN - error getting the parameters from the hub. The node may end up with wrong timeouts.Connect to 192.168.32.1:4444 [/192.168.32.1] failed: Connection timed out: connect

14:24:27.399 INFO - Java: Oracle Corporation 25.172-b11

14:24:27.399 INFO - OS: Windows 10 10.0 amd64

14:24:27.415 INFO - v2.53.1, with Core v2.53.1. Built from revision a36b8b1

14:24:27.415 INFO - Selenium server running in debug mode.

14:24:27.415 DEBUG - add component: [email protected]:5566

14:24:27.446 DEBUG - add component: org.openqa.jetty.http.ResourceCache@12cdcf4

14:24:27.446 DEBUG - add component: org.openqa.selenium.server.ProxyHandler in HttpContext[/,/]

14:24:27.446 DEBUG - add component: HttpContext[/,/]

14:24:27.462 DEBUG - Added HttpContext[/,/] for host *

14:24:27.462 DEBUG - add component: org.openqa.jetty.http.ResourceCache@ed9d034

14:24:27.462 DEBUG - added SC{BASIC,null,user,CONFIDENTIAL} at /org/openqa/selenium/tests/html/basicAuth/*

14:24:27.477 DEBUG - add component: org.openqa.jetty.http.handler.SecurityHandler in HttpContext[/selenium-server,/selenium-server]

14:24:27.477 DEBUG - add component: org.openqa.selenium.server.StaticContentHandler in HttpContext[/selenium-server,/selenium-server] 14:24:27.477 DEBUG - add component: org.openqa.selenium.server.SessionExtensionJsHandler in HttpContext[/selenium-server,/selenium-server]

14:24:27.477 DEBUG - add component: org.openqa.selenium.server.htmlrunner.SingleTestSuiteResourceHandler in HttpContext[/selenium-server,/selenium-server]

14:24:27.477 DEBUG - add component: org.openqa.selenium.server.htmlrunner.SeleniumHTMLRunnerResultsHandler@3891771e

14:24:27.477 DEBUG - add component: HttpContext[/selenium-server,/selenium-server]

14:24:27.477 DEBUG - Added HttpContext[/selenium-server,/selenium-server] for host *

14:24:27.509 INFO - Driver class not found: com.opera.core.systems.OperaDriver

14:24:27.509 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered

14:24:27.524 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped: registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10

14:24:27.524 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver

14:24:27.524 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered

14:24:27.540 DEBUG - add component: org.openqa.jetty.http.ResourceCache@5e57643e

14:24:27.540 DEBUG - add component: org.openqa.selenium.server.SeleniumDriverResourceHandler in HttpContext[/selenium-server,/selenium-server]

14:24:27.540 DEBUG - add component: HttpContext[/selenium-server/driver,/selenium-server/driver]

14:24:27.540 DEBUG - Added HttpContext[/selenium-server/driver,/selenium-server/driver] for host *

14:24:27.540 DEBUG - add component: org.openqa.jetty.http.ResourceCache@45afc369

14:24:27.556 DEBUG - add component: WebDriver remote server

14:24:27.556 DEBUG - add component: org.openqa.jetty.jetty.servlet.HashSessionManager@1e9e725a

14:24:27.571 DEBUG - add component: org.openqa.jetty.jetty.servlet.ServletHandler@15d9bc04

14:24:27.571 DEBUG - add component: HttpContext[/wd,/wd]

14:24:27.571 DEBUG - Added HttpContext[/wd,/wd] for host *

14:24:27.571 DEBUG - Starting org.openqa.jetty.jetty.Server@2353b3e6

14:24:27.571 INFO - Version Jetty/5.1.x

14:24:27.571 DEBUG - LISTENERS: [[email protected]:5566]

14:24:27.571 DEBUG - HANDLER: {null={/selenium-server/=[HttpContext[/selenium-server,/selenium-server]], /wd/=[HttpContext[/wd,/wd]], /selenium-server/driver/*=[HttpContext[/selenium-server/driver,/selenium-server/driver]], /=[HttpContext[/,/]]}}

14:24:27.571 DEBUG - Starting HttpContext[/selenium-server,/selenium-server]

14:24:27.571 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@5c647e05 for HttpContext[/selenium-server,/selenium-server]

14:24:27.571 DEBUG - Started org.openqa.jetty.http.handler.SecurityHandler in HttpContext[/selenium-server,/selenium-server]

14:24:27.571 DEBUG - Started org.openqa.selenium.server.StaticContentHandler in HttpContext[/selenium-server,/selenium-server]

14:24:27.571 DEBUG - Started org.openqa.selenium.server.SessionExtensionJsHandler in HttpContext[/selenium-server,/selenium-server]

14:24:27.571 DEBUG - Started org.openqa.selenium.server.htmlrunner.SingleTestSuiteResourceHandler in HttpContext[/selenium-server,/selenium-server]

14:24:27.571 DEBUG - Started org.openqa.selenium.server.SeleniumDriverResourceHandler in HttpContext[/selenium-server,/selenium-server]

14:24:27.571 INFO - Started HttpContext[/selenium-server,/selenium-server]

14:24:27.571 DEBUG - Starting HttpContext[/wd,/wd]

14:24:27.571 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@5c647e05 for HttpContext[/wd,/wd]

14:24:27.571 DEBUG - Starting org.openqa.jetty.jetty.servlet.ServletHandler@15d9bc04

14:24:27.571 DEBUG - New random session seed

14:24:27.571 DEBUG - Started holder of class org.openqa.selenium.remote.server.DriverServlet

14:24:27.571 DEBUG - Session scavenger period = 30s

14:24:27.571 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@15d9bc04

14:24:27.571 INFO - Started HttpContext[/wd,/wd]

14:24:27.587 DEBUG - Starting HttpContext[/selenium-server/driver,/selenium-server/driver]

14:24:27.587 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@5c647e05 for HttpContext[/selenium-server/driver,/selenium-server/driver]

14:24:27.587 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]

14:24:27.587 DEBUG - Starting HttpContext[/,/]

14:24:27.587 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@5c647e05 for HttpContext[/,/]

14:24:27.602 DEBUG - Started org.openqa.selenium.server.ProxyHandler in HttpContext[/,/]

14:24:27.602 INFO - Started HttpContext[/,/]

14:24:27.602 INFO - Started SocketListener on 0.0.0.0:5566

14:24:27.602 INFO - Started org.openqa.jetty.jetty.Server@2353b3e6

14:24:27.602 INFO - Selenium Grid node is up and ready to register to the hub

14:24:27.634 DEBUG - Using the json request : {"class":"org.openqa.grid.common.RegistrationRequest","configuration":{"role":"webdriver","debug":"","remoteHost":"http://10.0.1.4:5566","hubHost":"192.168.32.1","hubPort":4444,"url":"http://10.0.1.4:5566","proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","hub":"myurl:4444/grid/register/","port":5566,"host":"10.0.1.4","maxSession":5,"registerCycle":5000,"register":true},"capabilities":[{"browserName":"firefox","seleniumProtocol":"WebDriver","maxInstances":5,"platform":"WIN10"},{"browserName":"chrome","seleniumProtocol":"WebDriver","maxInstances":5,"platform":"WIN10"},{"browserName":"internet explorer","seleniumProtocol":"WebDriver","maxInstances":1,"platform":"WINDOWS"}]}

14:24:27.634 INFO - Starting auto registration thread. Will try to register every 5000 ms.

14:24:27.634 INFO - Registering the node to the hub: myurl:4444/grid/register

14:24:27.634 DEBUG - CookieSpec selected: default

14:24:27.634 DEBUG - Auth cache not set in the context

14:24:27.650 DEBUG - Connection request: [route: {}->myurl:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 14:24:27.650 DEBUG - Connection leased: [id: 1][route: {}->myurl:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000]

14:24:27.650 DEBUG - Opening connection {}->myurl:4444

14:24:27.650 DEBUG - Connecting to /192.168.32.1:4444

14:24:31.149 INFO - Shutting down...

Thank you, subbu.

1

1 Answers

0
votes

If I remember correctly you should start the node with -role node and not -role webdriver.

Take a look at Selenium Grid Documentation

Also make sure that in logs the node connects to the correct hub ip address, maybe something wrong is configured at a network level.

If you want to check connectivity from node to hub, the easiest option is running:

telnet <HUB-IP-ADDR/DNS> 4444

If you get "connected", then you have a connectivity.