当我们使用 XVFB 加载 WCT 测试时,我在 ubuntu 上收到此错误。第一次测试顺利进行,但是当我们第二次运行时它失败了。 看起来缺少 HTMLunit 驱动程序。我尝试安装单元驱动程序但无法修复。
最佳答案
我做了以下三件事来使其正常工作。它们可能不是完美的解决方案,因为它有点hacky。
下载 https://selenium-release.storage.googleapis.com/2.52/selenium-server-standalone-2.52.0.jar并将其复制到/usr/local/lib/node_modules/web-component-tester/node_modules/selenium-standalone/.selenium/selenium-server/2.52.0-server.jar (您可能需要更改路径以适合您的服务器)。
修改/usr/local/lib/node_modules/web-component-tester/node_modules/selenium-standalone/lib/default-config.js 将 selenium 独立服务器版本从 2.53.1 更改为 2.52.0 (这将解决 HtmlUnitDriver 未注册问题)
修改/usr/local/lib/node_modules/web-component-tester/node_modules/selenium-standalone/lib/check-started.js 以更改“var maxRetries = 60 * 1000/retryInterval;”为“var maxRetries = 600 * 1000/retryInterval;” (这将解决超时问题)
完成上述 hack 后,您可以运行 wct 或 xvfb-run wct。只需稍等一下,您就会看到测试结果。
关于selenium - Polymer Webcomponent Tester (WCT) XVFB 无法连接到 selenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39989175/