我正在尝试使用Protractor为我的Angular应用程序编写一些e2e测试。
我有一个id=my-btn想要单击的简单html按钮,使用:
$('#my-btn').click();
Run Code Online (Sandbox Code Playgroud)
不幸的是我遇到以下错误:
失败:脚本超时:11秒内未收到结果
来自:任务:Protractor.waitForAngular()-定位器:通过(css选择器,#my-btn)
Run Code Online (Sandbox Code Playgroud)(Session info: chrome=73.0.3683.75) (Driver info: chromedriver=2.46.628411 (3324f4c8be9ff2f70a05a30ebc72ffb013e1a71e),platform=Mac OS X 10.14.3 x86_64)
如果在点击之前我设置了:
browser.waitForAngularEnabled(false);
Run Code Online (Sandbox Code Playgroud)
那我就没有任何错误 问题在于这样做意味着:
Run Code Online (Sandbox Code Playgroud)* If set to false, Protractor will not wait for Angular $http and $timeout * tasks to complete before interacting with the browser. This can cause * flaky tests, but should be used if, for instance, your app continuously * polls an API with $timeout.
所以我想什么导致waitForAngular操作超时。
有没有办法检查仍然挂起的HTTP或超时? …