Polymer Webcomponent Tester (WCT) XVFB 无法连接到 selenium

Polymer Webcomponent Tester (WCT) XVFB unable to connect to selenium

当我们使用 XVFB 加载 WCT 测试时,我在 ubuntu 上收到此错误。测试第一次通过,但是,当我们 运行 第二次失败时。 看起来它缺少 HTMLunit 驱动程序。我尝试安装单元驱动程序但无法修复。

xvfb-运行 wct --skip-selenium-install

我做了以下 3 件事来让它工作。它们可能不是完美的解决方案,因为它有点老套。

  1. 下载 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(您可能需要更改路径以适合您的服务器).

  2. 修改/usr/local/lib/node_modules/web-component-tester/node_modules/selenium-standalone/lib/default-config.js将selenium独立服务器版本从2.53.1更改为2.52.0(这将解决HtmlUnitDriver未注册的问题)

  3. 修改/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;"(这样可以解决超时问题)

完成上述破解后,您可以运行 wct 或 xvfb-运行 wct。只需要稍等片刻,您就会看到您的测试结果。