运行nightwatchjs测试时出现TypeError [ERR_UNESCAPED_CHARACTERS]

时间:2019-08-14 21:27:41

标签: javascript node.js testing nightwatch.js

我刚刚将chromedriver从74.x.x更新到76.x.x,并收到以下错误消息:

Error while running .isElementDisplayed() protocol action: TypeError [ERR_UNESCAPED_CHARACTERS]: Error while trying to create HTTP request for "/wd/hub/session/676ee244a59ce7cba8601d00582bbe13/element/[object Object]/displayed": Request path contains unescaped characters
    at new ClientRequest (_http_client.js:115:13)
    at Object.request (http.js:42:10)
    at HttpRequest.createHttpRequest (/Users/bradleystillwagon/Documents/dev/git/nightwatch_intellij/node_modules/nightwatch/lib/http/request.js:112:55)
    at HttpRequest.send (/Users/bradleystillwagon/Documents/dev/git/nightwatch_intellij/node_modules/nightwatch/lib/http/request.js:191:29)
    at Promise (/Users/bradleystillwagon/Documents/dev/git/nightwatch_intellij/node_modules/nightwatch/lib/transport/transport.js:189:15)
    at new Promise (<anonymous>)
    at Selenium2Protocol.sendProtocolAction (/Users/bradleystillwagon/Documents/dev/git/nightwatch_intellij/node_modules/nightwatch/lib/transport/transport.js:187:12)
    at Selenium2Protocol.runProtocolAction (/Users/bradleystillwagon/Documents/dev/git/nightwatch_intellij/node_modules/nightwatch/lib/transport/jsonwire.js:61:17)
    at Object.isElementDisplayed (/Users/bradleystillwagon/Documents/dev/git/nightwatch_intellij/node_modules/nightwatch/lib/transport/actions.js:54:10)
    at Selenium2Protocol.executeProtocolAction (/Users/bradleystillwagon/Documents/dev/git/nightwatch_intellij/node_modules/nightwatch/lib/transport/transport.js:235:48)

在此过程中,我还将守夜表从1.1.13更新为1.2.1。

1 个答案:

答案 0 :(得分:1)

作为从chrome版本74.xx更改为76.xx的一部分,我遇到了一个开关,其中ChromeDriver现在默认情况下以W3C标准兼容模式运行(特别是chromeDriver版本75.0.3770.8)。

要解决现有代码库的这一问题,我必须将以下w3c设置添加到我的配置文件中:

desiredCapabilities: {
        browserName: "chrome",
        chromeOptions: {
          w3c: false
        }
      }