Selenium 4 with multiple nodes

155 Views Asked by At

I am testing the upgrade from Selenium 3 to Selenium 4. I am having problems trying to start two nodes at the same time. These nodes have a .bat file that calls a .json file for its configuration.

In Selenium 3, the start-node1.bat file is as follows:

java -jar -Dwebdriver.chrome.driver=drivers/chromedriver_112.exe jars/selenium-server-standalone-3.141.59.jar -role node -nodeConfig grid/node1.json

And the node1.json file is as follows:

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

The hub.bat file in Selenium 3 is as follows:

java -jar jars/selenium-server-standalone-3.141.59.jar -role start-hub -hubConfig grid/hub.json

And the hub.json file is like this:

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

If I launch this with selenium 4 I get this error on the nodes:

    09:44:15.452 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 7504
    2023-08-03 09:44:16.630:INFO::main: Logging initialized @1779ms to org.seleniumhq.jetty9.util.log.StdErrLog
    09:44:17.024 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
    09:44:17.217 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 7504
    09:44:17.218 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub
    09:44:17.562 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
    09:44:18.002 WARN [SelfRegisteringRemote.registerToHub] - Error getting the parameters from the hub. The node may end up with wrong timeouts.Failed to connect to localhost/0:0:0:0:0:0:0:1:7500
    09:44:18.002 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://localhost:7500/grid/register
    09:44:18.028 INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: Error sending the registration request: Failed to connect to localhost/0:0:0:0:0:0:0:1:7500
    09:44:23.159 INFO [SelfRegisteringRemote$1.run] - Couldn't register this node: The hub is down or not responding: The hub responded with 404

In the hub.bat you see this:

09:44:15.612 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
09:44:15.619 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
09:44:16.908 INFO [BoundZmqEventBus.<init>] - XPUB binding to [binding to tcp://*:4442, advertising as tcp://XXX.80.80.198:4442], XSUB binding to [binding to tcp://*:4443, advertising as tcp://172.80.80.198:4443]
09:44:17.018 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://172.80.80.198:4442 and tcp://XXX.80.80.198:4443
09:44:17.074 INFO [UnboundZmqEventBus.<init>] - Sockets created
09:44:18.090 INFO [UnboundZmqEventBus.<init>] - Event bus ready
09:44:20.310 INFO [Hub.execute] - Started Selenium Hub 4.10.0 (revision c14d967899):http://xxx.168.1.134:7500

What should I do to make the configuration I had in selenium 3 work for me for selenium 4? Thank you

My problem is that the configuration I had in Selenium 3 to launch multiple nodes no longer works with Selenium 4

0

There are 0 best solutions below