TypeError [ERR_UNESCAPED_CHARACTERS] when running nightwatchjs test

こ雲淡風輕ζ 提交于 2020-02-25 06:05:18

问题


I just updated my chromedriver from version 74.x.x to 76.x.x and received the following error:

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)

I also update nightwatch from 1.1.13 to 1.2.1 in the process.


回答1:


As part of the change from chrome version 74.x.x to 76.x.x, I ran into the switch that was made where ChromeDriver now runs in W3C standard compliant mode by default (chromeDriver version 75.0.3770.8 specifically).

To get around this for my existing codebase, I had to add the w3c setting below to my configuration file:

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



回答2:


In the above commented code, the implementation is not correct so adding that

"desiredCapabilities": {
            "browserName": "chrome",
            "javascriptEnabled": true,
            "acceptSslCerts": true,
            "chromeOptions": {
              "w3c": false,
              "args": ["--headlesffs",  "window-size=1280,800"]

            }
          }


来源:https://stackoverflow.com/questions/57502302/typeerror-err-unescaped-characters-when-running-nightwatchjs-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!