【问题标题】:Protractor tests passing before page fully loaded量角器测试在页面完全加载之前通过
【发布时间】:2016-08-31 13:29:26
【问题描述】:

更新我的 node_modules 后,我的量角器测试开始失败。测试似乎在页面加载之前就开始运行:

Using the selenium server at http://127.0.0.1:4444/wd/hub
[launcher] Running 1 instances of WebDriver
Spec started

Login
✓ should navigate to the homepage
✓ should display login form

Password > Forgot Password
✓ should go the forgot password form
✓ should not redirect user if email does not exist

Executed 4 of 4 specs SUCCESS in 0.025 sec.
Uncaught exception: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nhttp://errors.angularjs.org/1.5.8/ng/test"
[launcher] Process exited with error code 1

启动的谷歌浏览器窗口是空白的,但它有正确的 URL (http://localhost:8081)。但是,如果我不运行测试而只是调用browser.get('/'),则窗口会导航到我的 Web 应用程序并且页面会按预期加载。

我怀疑测试在某种程度上独立于量角器、硒和 Chrome 之间的通信运行,并且以某种方式异步出错。

我目前正在运行以下版本:

  • 量角器:2.5.1
  • selenium-server-standalone: 2.47.1(我也试过 2.46.0)
  • chromedriver:最新版本,使用webdriver-update安装
  • 铬:52.0.2743.116

【问题讨论】:

  • 在 Firefox 中也会发生同样的情况吗?如果您打开或关闭 directConnect 会怎样?
  • 还有量角器 2.5.1?已经有4.0.4了,还不升级一下?
  • 浏览器控制台有错误吗?
  • Firefox 根本无法连接。 directConnect 的开启和关闭对 chrome 或 firefox 都没有影响。
  • 使用版本 4 解决了这个问题。谢谢:-)

标签: javascript google-chrome selenium selenium-webdriver protractor


【解决方案1】:

感谢@alecxe,升级到 v4 解决了我的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-08
    • 1970-01-01
    • 1970-01-01
    • 2015-08-31
    • 1970-01-01
    • 2020-07-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多