Selenium 3.0.1 Chrome节点配置

时间:2016-10-28 17:24:08

标签: selenium selenium-webdriver selenium-chromedriver selenium-grid

Selenium 3.0.1更新在通过Json Config File调用节点时抛出错误。请从Json文件中找到以下详细信息。

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

错误 - 配置Json时出错:遇到已删除的节点配置文件。请更新文件以使用selenium 3

2 个答案:

答案 0 :(得分:1)

我确定你已经解决了这个问题,但对未来的访问者来说:

在Selenium 3中,configuration对象已被展平,如下所述:https://github.com/SeleniumHQ/selenium/wiki/Grid2#configuring-the-nodes-by-json

所以你只需删除configuration即可。所以像这样:

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

答案 1 :(得分:0)

如果您查看完整的错误消息(此处未包含此内容)

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

您会意识到错误消息还包含有关解决问题所需操作的信息。

看起来他们用3.0更改了节点配置文件的文件格式。

请参阅here以获取新的示例文件,并here查看更多信息。