量角器测试在页面完全加载之前传递

时间:2016-08-31 13:29:27

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

更新我的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

已启动的Google Chrome窗口为空白,但它具有正确的网址(http://localhost:8081)。但是,如果我不运行测试而只是调用browser.get('/'),则窗口会导航到我的Web应用程序,并按预期加载页面。

我怀疑这些测试是以某种方式独立于量角器,selenium和Chrome之间的通信而运行的,并以某种方式异步错误。

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

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

1 个答案:

答案 0 :(得分:2)

感谢@alecxe,升级到v4修复了我的问题。