一尘不染

转发新会话时出错:Selenium Grid 2

selenium

Selenium Server这里选择了最新的2.45.0
。遵循文档并使用以下命令启动集线器

java -jar selenium-server-standalone-2.45.0.jar -role hub -hubConfig HubConfigFile.json

并且,JSon文件内容为:

{
  "host": 10.5.0.21,
  "port": 4444,
  "newSessionWaitTimeout": -1,
  "servlets" : [],
  "prioritizer": null,
  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
  "throwOnCapabilityNotPresent": true,
  "nodePolling": 5000,
  "cleanUpCycle": 5000,
  "timeout": 300000,
  "browserTimeout": 0,
  "maxSession": 5,
  "jettyMaxThreads":-1
}

而且,唯一Node

java -jar selenium-server-standalone-2.45.0.jar -role node -nodeConfig DefaultNode.json

{
  "capabilities":
      [
        {
          "browserName": "*firefox",
          "maxInstances": 5,
          "seleniumProtocol": "Selenium"
        },
        {
          "browserName": "*googlechrome",
          "maxInstances": 5,
          "seleniumProtocol": "Selenium"
        },
        {
          "browserName": "*iexplore",
          "maxInstances": 1,
          "seleniumProtocol": "Selenium"
        },
        {
          "browserName": "firefox",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        },
        {
          "browserName": "chrome",
          "maxInstances": 5,
          "seleniumProtocol": "WebDriver"
        },
        {
          "browserName": "internet explorer",
          "maxInstances": 1,
          "seleniumProtocol": "WebDriver"
        }
      ],
  "configuration":
  {
    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
    "maxSession": 5,
    "port": 5555,
    "host": 10.5.0.161,
    "register": true,
    "registerCycle": 5000,
    "hubPort": 4444,
    "hubHost": 10.5.0.21
  }
}

到目前为止,一切看起来都很不错。在这里注册后,请查看控制台的屏幕截图

而且,当我尝试通过以下方式开始测试时,问题就开始了:

DesiredCapabilities capabilities = DesiredCapabilities.InternetExplorer();
capabilities.SetCapability("browserName", "internet explorer");
capabilities.SetCapability("platform", "XP");
capabilities.SetCapability("version", "8.0");
//capabilities.SetCapability("seleniumProtocol", "WebDriver");

Driver = new RemoteWebDriver(new Uri("http://10.5.0.21:4444/wd/hub"), capabilities);

而且,它抛出:

WebDriver.dll中发生类型’System.InvalidOperationException’的异常,但未在用户代码中处理

附加信息:找不到新会话时转发错误:功能[{browserName = internet Explorer,版本= 8.0,平台= XP}]

查看屏幕截图 屏幕截图1
屏幕截图2

屏幕截图3

我必须说Selenium Grid上的文档非常令人沮丧 。我花了整整一天的时间试图找出问题所在。

我想念什么吗?


阅读 307

收藏
2020-06-26

共1个答案

一尘不染

经过大量研究,我能够解决此问题。命令行参数错误,因为我使用的是WebDriver我必须替换

java -jar selenium-server-standalone-2.45.0.jar -role node -nodeConfig DefaultNode.json

java -jar selenium-server-standalone-2.45.0.jar -role webdriver -nodeConfig DefaultNode.json -Dwebdriver.ie.driver=.\IEDriverServer.exe

确保我也将驱动程序可执行文件设置在正确的目录中。

2020-06-26