Selenium 3.0.1 Chrome Node configuration

2019-05-19 15:37发布

Selenium 3.0.1 update is throwing an error while invokeing the node through Json Config File. Please find the following details from the Json file.

{
  "capabilities":
      [
        {
          "browserName": "chrome",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        }
      ],
  "configuration":
  {
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "maxSession": 5,
    "port": 5559,
    "host": ip,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4445,
    "hubHost":ip,
    "hub":"http://XX.XX.XX.XX:XXXX/grid/register",
    "timeout":600000,
    "browserTimeout":600000"
  }
}

Error - Error with Json of Config : Depricated node config file encountered. please update the file to work with selenium 3

2条回答
倾城 Initia
2楼-- · 2019-05-19 16:22

I'm sure you've solved this, but for future visitors:

In Selenium 3, the configuration object has been flattened, as stated here: https://github.com/SeleniumHQ/selenium/wiki/Grid2#configuring-the-nodes-by-json

So you just need to remove configuration. So something like this:

{ "capabilities": [ { "browserName": "chrome", "maxInstances": 5, "seleniumProtocol": "WebDriver" } ], "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "maxSession": 5, "port": 5559, "host": ip, "register": true, "registerCycle": 5000, "hubPort": 4445, "hubHost":ip, "hub":"http://XX.XX.XX.XX:XXXX/grid/register", "timeout":600000, "browserTimeout":600000" }

查看更多
老娘就宠你
3楼-- · 2019-05-19 16:36

If you look at the complete error message (which you haven't included here)

Exception in thread "main" org.openqa.grid.common.exception.GridConfigurationException: Error with the JSON of the config : Deprecated -nodeConfig file encountered. Please update the file to work with Selenium 3. See https://github.com/SeleniumHQ/selenium/wiki/Grid2#configuring-the-nodes-by-json for more details. at org.openqa.grid.internal.utils.configuration.GridNodeConfiguration.loadFromJSON(GridNodeConfiguration.java:311) at org.openqa.grid.internal.utils.configuration.GridNodeConfiguration.loadFromJSON(GridNodeConfiguration.java:287) at org.openqa.grid.selenium.GridLauncherV3$3.setConfiguration(GridLauncherV3.java:261) at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:147) at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:73) Caused by: org.openqa.grid.common.exception.GridConfigurationException: Deprecated -nodeConfig file encountered. Please update the file to work with Selenium 3. See https://github.com/SeleniumHQ/selenium/wiki/Grid2#configuring-the-nodes-by-json for more details. at org.openqa.grid.internal.utils.configuration.GridNodeConfiguration.loadFromJSON(GridNodeConfiguration.java:303) ... 4 more

you would realise that the error message also contains info on what you need to do to fix the problem.

Looks like they changed the file format of the node configuration file with 3.0.

Please refer here for a new sample file and here for more information.

查看更多
登录 后发表回答