简体   繁体   English

在等待量角器与页面同步时刷新时发生错误,在捕获警报时

[英]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.

相关问题 量角器“等待量角器与页面同步时出错”浏览Angular站点 - Protractor “Error while waiting for Protractor to sync with the page” browsing Angular site 执行量角器测试时出现“失败:等待量角器与页面同步时出错” - "Failed: Error while waiting for Protractor to sync with the page" while executing Protractor tests 等待量角器与页面同步时出错:在运行量角器测试用例时“在窗口中找不到角度” - Error while waiting for Protractor to sync with the page: “angular could not be found on the window” on running protractor test case 失败:等待量角器与页面同步时出错:“在窗口中找不到角度” - Failed: Error while waiting for Protractor to sync with the page: “angular could not be found on the window” 带有 protractorjs 的 Angular 2 失败:等待 Protractor 与页面同步时出错:“window.getAllAngularTestabilities 不是函数” - Angular 2 with protractorjs Failed: Error while waiting for Protractor to sync with the page: "window.getAllAngularTestabilities is not a function" 使用量角器时,单击导致发出http请求的按钮时,我收到此消息:等待量角器同步时出错 - While using Protractor, when clicking a button which causes an http request to be made, I receive this: error while waiting for protractor to sync 使用$ resource时,量角器会等待与页面同步 - Protractor times out waiting for sync with page when using $resource 量角器不等待页面加载 - Protractor not waiting for page load Protractor.js:加载页面时出错 - Protractor.js:Error while loading the page 在nodejs中等待promise时捕获异常 - catching exceptions while waiting for a promise in nodejs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM