Selenium:会话外部密钥不可用

Selenium: Session externalKey not available

每当 Robot Framework 自动化测试(由 Jenkins 作业启动)从集线器请求 Chrome 浏览器时,我 运行ning 的 Selenium Grid Hub 会显示此错误消息:

Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.

我花了几个小时搜索和尝试建议的解决方案,但没有成功。

运行 Linux 服务器作为 Selenium Grid Hub,windows 服务器作为 Selenium Grid 节点。已使用 selenium-server-standalone-<version>.jar 文件的版本 3.0.1、3.5.3、3.13.0 和 3.141.59 尝试了每个节点。第三台服务器 运行s Jenkins。

集线器似乎配置正确,因为它工作正常:

http://10.1.10.231:4444/grid/console

我还在命令行中 运行 jar 文件,最后是 -debug,但没有显示更多信息。还在命令行的 "java side" 上尝试了 -Dselenium.LOGGER.level=WARNING,但没有显示比使用 -debug.

更多的信息

我们有另一组配置相同的服务器,运行没问题。

有人知道这条消息的含义吗?


紧随其后。

网格中心:

java -jar -Xms1024m -Xmx2048m selenium-server-standalone-3.141.59.jar -role hub -hubConfig ./hub-config.json

hub-config.json:

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

网格节点:

SET CHROMEDRIVER=.\bin\chromedriver_win32-v2.37\chromedriver.exe
SET IEDRIVER=.\bin\IEDriverServer.exe
SET FFDRIVER=.\bin\geckodriver-v0.11.1-win32\geckodriver.exe

START "SeleniumNode" java -Xms1024m -Xmx2048m ^
    -Dwebdriver.gecko.driver=%FFDRIVER% ^
    -Dwebdriver.ie.driver=%IEDRIVER% ^
    -Dwebdriver.chrome.driver=%CHROMEDRIVER% -Dwebdriver.chrome.args="--disable-extensions" ^
    -jar .\bin\selenium-server-standalone-3.141.59.jar -role node -nodeConfig .\node-config.json

节点-config.json:

{
  "capabilities":
  [
    {
      "browserName": "firefox",
      "maxInstances": 5,
      "platform": "WINDOWS",
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "chrome",
      "maxInstances": 5,
      "platform": "WINDOWS",
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "internet explorer",
      "maxInstances": 5,
      "platform": "WINDOWS",
      "seleniumProtocol": "WebDriver"
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 5,
  "port": 5555,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://10.1.10.231:4444",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {},
  "browserTimeout": 0,
  "timeout": 1800,
  "cleanUpCycle": 2000
}

想通了!希望它能对报告此错误消息但未收到解决方案的其他人有所帮助。

像这样的问题最常见的情况是,尤其是当在损坏的实例旁边有一个已知的工作设置时,这是一个(令人尴尬的)愚蠢的配置问题。机器人测试指向此 URL 以获取浏览器:

http://10.1.10.75:4444/wd/hub/static/resource/hub.html

它应该指向这个路径:

http://10.1.10.75:4444/wd/hub

至少这是一个简单的修复。