【问题标题】:errors after running npm with mocha and selenium webdriver使用 mocha 和 selenium webdriver 运行 npm 后出现错误
【发布时间】:2019-09-26 17:59:39
【问题描述】:

在 ubuntu 18.04 上使用 node 和 mocha 运行 selenium webdriver ...

现在我收到了这些错误:

  1) Google search automated testing
       find the input box and google search button:
     TimeoutError: Looking for element
Wait timed out after 15002ms
      at /root/test/node_modules/selenium-webdriver/lib/webdriver.js:834:17
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)

  2) Google search automated testing
       put keyword in search box and click search button:
     TimeoutError: Looking for element
Wait timed out after 15005ms
      at /root/test/node_modules/selenium-webdriver/lib/webdriver.js:834:17
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:93:5)



[mochawesome] {
  "killed": false,
  "code": 3,
  "signal": null,
  "cmd": "xdg-open /root/test/mochawesome-report/mochawesome.html"
}

您需要提供哪些详细信息才能提供更多信息?有没有机会调试这个?

这是我玩 atm 的基地。 (https://github.com/bmshamsnahid/Automation-With-Selenium-And-Node.js)

【问题讨论】:

  • 别以为我能找到答案……已经这样做了。
  • @DMart 我认为这是一个摩卡咖啡问题。刚刚安装它新鲜。不,我收到新错误*douh
  • 找不到元素。在没有头的情况下运行它,看看会发生什么。请更新您使用的代码,您可能会输入错误的 Id 或类。
  • 不,我已经检查了选择器......我认为这应该适合。我只是在玩这个例子:github.com/bmshamsnahid/Automation-With-Selenium-And-Node.js

标签: javascript selenium-webdriver npm mocha.js ubuntu-18.04


【解决方案1】:

您好,证书验证似乎存在问题。您可以使用以下选项在 chrome 上禁用它:--ignore-certificate-error

【讨论】:

    【解决方案2】:

    如果我删除无头选项,我会得到:

    > googlesearch@1.0.0 test /root/test
    > mocha test --reporter mochawesome --reporter-options autoOpen=true
    
    
    
      Google search automated testing
        1) "before each" hook for "find the input box and google search button"
        2) "after each" hook for "find the input box and google search button"
    
    
      0 passing (456ms)
      2 failing
    
      1) Google search automated testing
           "before each" hook for "find the input box and google search button":
         WebDriverError: unknown error: Chrome failed to start: exited abnormally
      (unknown error: DevToolsActivePort file doesn't exist)
      (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
          at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:550:15)
          at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:563:13)
          at Executor.execute (node_modules/selenium-webdriver/lib/http.js:489:26)
          at processTicksAndRejections (internal/process/task_queues.js:93:5)
    
      2) Google search automated testing
           "after each" hook for "find the input box and google search button":
         WebDriverError: unknown error: Chrome failed to start: exited abnormally
      (unknown error: DevToolsActivePort file doesn't exist)
      (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
          at Object.throwDecodedError (node_modules/selenium-webdriver/lib/error.js:550:15)
          at parseHttpResponse (node_modules/selenium-webdriver/lib/http.js:563:13)
          at Executor.execute (node_modules/selenium-webdriver/lib/http.js:489:26)
          at processTicksAndRejections (internal/process/task_queues.js:93:5)
    
    
    
    [mochawesome] {
      "killed": false,
      "code": 3,
      "signal": null,
      "cmd": "xdg-open /root/test/mochawesome-report/mochawesome.html"
    }
    
    npm ERR! Test failed.  See above for more details.
    

    如果我以正确的方式理解这一点,这个错误的解决方案是无头运行?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-03
      • 1970-01-01
      • 2013-12-23
      相关资源
      最近更新 更多