[英]Error while waiting for protractor to sync with the page on catching alert during refresh
I am getting this error while I refresh the page and catch the alert: 刷新页面并捕获警报时出现此错误:
Failed: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined. This could be either because this is a non-angular page or because your test involves client-side navgation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details".
失败:等待量角器与页面同步时出错:“未定义angularJS可测试性和角度可测试性。这可能是因为这是非角度页面,或者因为您的测试涉及客户端导航,这可能会干扰量角器的引导程序。有关详细信息,请参见http://git.io/v4gXM 。
Please see the code used below: 请查看下面使用的代码:
browser.refresh().catch(function(){
browser.switchTo().alert().then(function(alert){
alert.accept();
});
The Alert isn't an Angular Alert, in which case you should tell Angular you're not testing an Angular Application anymore. 警报不是Angular警报,在这种情况下,您应该告诉Angular您不再测试Angular应用程序。
browser.waitForAngularEnabled(false);
Then proceed with the rest of your code after 然后在执行完其余的代码后
browser.refresh().catch(function(){
browser.switchTo().alert().then(function(alert){
alert.accept();
});
If you want it to behave again in an Angular way (in terms of waiting for HTTPS requests etc) then you will need to re-enable it after accepting your alert 如果您希望它再次以Angular的方式运行(在等待HTTPS请求等方面),那么您将需要在接受警报后重新启用它
browser.switchTo().defaultContent();
browser.waitForAngular();
browser.waitForAngularEnabled(true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.