Selenium 3.0.1 Chrome Node configuration

戏子无情 提交于 2019-12-08 02:15:33

问题


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


回答1:


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" }




回答2:


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.



来源:https://stackoverflow.com/questions/40310233/selenium-3-0-1-chrome-node-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!