SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.7k stars 8.19k forks source link

Grid 3.0.1 Hub not connecting to Node on the same MacOS machine #3455

Closed kroe761-zz closed 7 years ago

kroe761-zz commented 7 years ago

Meta -

OS:
MacOS Sierra 10.12.3 Selenium Version:
Standalone Grid Server 3.0.1

I open two separate terminal windows. In one, I use this command:

java -jar selenium-server-standalone-3.0.1.jar -role hub -hubConfig hubconfig.json

hubConfig.json

{ "port": 4444, "newSessionWaitTimeout": -1, "servlets" : [], "withoutServlets": [], "custom": {}, "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher", "throwOnCapabilityNotPresent": true, "cleanUpCycle": 5000, "role": "hub", "debug": false, "browserTimeout": 0, "timeout": 1800 }

In a separate window (in the same machine) I type this command for the node:

java -jar selenium-server-standalone-3.0.1.jar -role node -hub http://10.10.3.1:4444/grid/register/ -nodeConfig nodeConfig.json -log nodelog.log -debug

nodeConfig.json

{ "capabilities": [ { "browserName": "firefox", "maxInstances": 1, "seleniumProtocol": "WebDriver" }, { "browserName": "chrome", "maxInstances": 1, "seleniumProtocol": "WebDriver" }, { "browserName": "safari", "maxInstances": 1, "seleniumProtocol": "WebDriver" } ], "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "maxSession": 5, "port": 5555, "register": true, "registerCycle": 5000, "hub": "http://10.10.3.1:4444", "nodeStatusCheckTimeout": 5000, "nodePolling": 5000, "role": "node", "unregisterIfStillDownAfter": 60000, "downPollingLimit": 2, "debug": false, "servlets" : [], "withoutServlets": [], "custom": {} }

At this point I would expect the node to successfully connect to the hub. However, It times out.

Expected Behavior -

I would expect the node to successfully connect to the hub

Actual Behavior -

Instead, it times out. Here is the content of nodelog.log

11:24:10.915 INFO - Selenium build info: version: '3.0.1', revision: '1969d75' 11:24:10.917 INFO - Launching a Selenium Grid node 11:24:11.731 DEBUG - CookieSpec selected: default 11:24:11.750 DEBUG - Auth cache not set in the context 11:24:11.752 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:24:11.781 DEBUG - Connection leased: [id: 0][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 11:24:11.784 DEBUG - Opening connection {}->http://10.10.3.1:4444 11:24:11.791 DEBUG - Connecting to /10.10.3.1:4444 11:25:29.237 DEBUG - http-outgoing-0: Shutdown connection 11:25:29.238 DEBUG - Connection discarded 11:25:29.238 DEBUG - Connection released: [id: 0][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:25:29.238 WARN - error getting the parameters from the hub. The node may end up with wrong timeouts.Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Operation timed out (Connection timed out) 11:25:29.330 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC 11:25:29.330 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped: registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC 11:25:29.330 INFO - Driver class not found: com.opera.core.systems.OperaDriver 11:25:29.330 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped: Unable to create new instances on this machine. 11:25:29.330 INFO - Driver class not found: com.opera.core.systems.OperaDriver 11:25:29.331 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered 11:25:29.463 INFO - Selenium Grid node is up and ready to register to the hub 11:25:29.519 DEBUG - Using the json request : {"class":"org.openqa.grid.common.RegistrationRequest","configuration":{"hubHost":"10.10.3.1","hubPort":4444,"id":"http://10.10.3.1:5555","capabilities":[{"browserName":"firefox","seleniumProtocol":"WebDriver","maxInstances":1,"platform":"MAC"},{"browserName":"chrome","seleniumProtocol":"WebDriver","maxInstances":1,"platform":"MAC"},{"browserName":"safari","seleniumProtocol":"WebDriver","maxInstances":1,"platform":"MAC"}],"downPollingLimit":2,"hub":"http://10.10.3.1:4444/grid/register/","nodePolling":5000,"nodeStatusCheckTimeout":5000,"proxy":"org.openqa.grid.selenium.proxy.DefaultRemoteProxy","register":true,"registerCycle":5000,"unregisterIfStillDownAfter":60000,"custom":{},"host":"10.10.3.1","maxSession":5,"servlets":[],"withoutServlets":[],"debug":false,"port":5555,"role":"node","timeout":1800}} 11:25:29.520 INFO - Starting auto registration thread. Will try to register every 5000 ms. 11:25:29.520 INFO - Registering the node to the hub: http://10.10.3.1:4444/grid/register 11:25:29.526 DEBUG - CookieSpec selected: default 11:25:29.527 DEBUG - Auth cache not set in the context 11:25:29.527 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:25:29.528 DEBUG - Connection leased: [id: 1][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 11:25:29.528 DEBUG - Opening connection {}->http://10.10.3.1:4444 11:25:29.528 DEBUG - Connecting to /10.10.3.1:4444 11:26:49.316 DEBUG - http-outgoing-1: Shutdown connection 11:26:49.318 DEBUG - Connection discarded 11:26:49.318 DEBUG - Connection released: [id: 1][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:26:49.319 INFO - Couldn't register this node: Error sending the registration request: Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Operation timed out (Connection timed out) 11:26:54.337 DEBUG - CookieSpec selected: default 11:26:54.337 DEBUG - Auth cache not set in the context 11:26:54.337 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:26:54.338 DEBUG - Connection leased: [id: 2][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 11:26:54.338 DEBUG - Opening connection {}->http://10.10.3.1:4444 11:26:54.338 DEBUG - Connecting to /10.10.3.1:4444 11:28:10.087 DEBUG - http-outgoing-2: Shutdown connection 11:28:10.087 DEBUG - Connection discarded 11:28:10.087 DEBUG - Connection released: [id: 2][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:28:10.087 INFO - Couldn't register this node: The hub is down or not responding: Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Operation timed out (Connection timed out) 11:28:15.092 DEBUG - CookieSpec selected: default 11:28:15.093 DEBUG - Auth cache not set in the context 11:28:15.093 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:28:15.093 DEBUG - Connection leased: [id: 3][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 11:28:15.093 DEBUG - Opening connection {}->http://10.10.3.1:4444 11:28:15.094 DEBUG - Connecting to /10.10.3.1:4444 11:29:30.963 DEBUG - http-outgoing-3: Shutdown connection 11:29:30.963 DEBUG - Connection discarded 11:29:30.964 DEBUG - Connection released: [id: 3][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:29:30.965 INFO - Couldn't register this node: The hub is down or not responding: Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Operation timed out (Connection timed out) 11:29:35.970 DEBUG - CookieSpec selected: default 11:29:35.970 DEBUG - Auth cache not set in the context 11:29:35.970 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:29:35.971 DEBUG - Connection leased: [id: 4][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 11:29:35.971 DEBUG - Opening connection {}->http://10.10.3.1:4444 11:29:35.971 DEBUG - Connecting to /10.10.3.1:4444 11:30:53.039 DEBUG - http-outgoing-4: Shutdown connection 11:30:53.039 DEBUG - Connection discarded 11:30:53.040 DEBUG - Connection released: [id: 4][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:30:53.040 INFO - Couldn't register this node: The hub is down or not responding: Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Operation timed out (Connection timed out) 11:30:58.044 DEBUG - CookieSpec selected: default 11:30:58.045 DEBUG - Auth cache not set in the context 11:30:58.045 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:30:58.046 DEBUG - Connection leased: [id: 5][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 11:30:58.046 DEBUG - Opening connection {}->http://10.10.3.1:4444 11:30:58.046 DEBUG - Connecting to /10.10.3.1:4444 11:32:13.264 DEBUG - http-outgoing-5: Shutdown connection 11:32:13.264 DEBUG - Connection discarded 11:32:13.264 DEBUG - Connection released: [id: 5][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:32:13.264 INFO - Couldn't register this node: The hub is down or not responding: Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Operation timed out (Connection timed out) 11:32:18.269 DEBUG - CookieSpec selected: default 11:32:18.269 DEBUG - Auth cache not set in the context 11:32:18.269 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:32:18.269 DEBUG - Connection leased: [id: 6][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 11:32:18.269 DEBUG - Opening connection {}->http://10.10.3.1:4444 11:32:18.270 DEBUG - Connecting to /10.10.3.1:4444 11:33:33.594 DEBUG - http-outgoing-6: Shutdown connection 11:33:33.595 DEBUG - Connection discarded 11:33:33.596 DEBUG - Connection released: [id: 6][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:33:33.596 INFO - Couldn't register this node: The hub is down or not responding: Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Operation timed out (Connection timed out) 11:33:38.602 DEBUG - CookieSpec selected: default 11:33:38.602 DEBUG - Auth cache not set in the context 11:33:38.602 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:33:38.602 DEBUG - Connection leased: [id: 7][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 11:33:38.603 DEBUG - Opening connection {}->http://10.10.3.1:4444 11:33:38.603 DEBUG - Connecting to /10.10.3.1:4444 11:34:56.274 DEBUG - http-outgoing-7: Shutdown connection 11:34:56.275 DEBUG - Connection discarded 11:34:56.275 DEBUG - Connection released: [id: 7][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:34:56.276 INFO - Couldn't register this node: The hub is down or not responding: Connect to 10.10.3.1:4444 [/10.10.3.1] failed: Operation timed out (Connection timed out) 11:35:01.280 DEBUG - CookieSpec selected: default 11:35:01.281 DEBUG - Auth cache not set in the context 11:35:01.281 DEBUG - Connection request: [route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000] 11:35:01.281 DEBUG - Connection leased: [id: 8][route: {}->http://10.10.3.1:4444][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000] 11:35:01.282 DEBUG - Opening connection {}->http://10.10.3.1:4444 11:35:01.282 DEBUG - Connecting to /10.10.3.1:4444

Is anyone else experiencing this issue? If I run the same commands on a Windows machine, it connects with no issues. I have not been able to find any documentation regarding special use of the grid on a Mac.

kroe761-zz commented 7 years ago

I was able to figure it out. As it turns out, when creating the hub, Selenium was choosing the vpn gateway, not the correct IP address. using the -host option fixed it. Closing the issue, but wanted to address the solution in case someone sees this in 3 years or so.