等待量角器与页面同步时出错



我在量角器中的测试有问题。

我需要这样的东西:

"找到iframe,点击它,然后将值设置为ng模型。

所以我的代码看起来像:

browser.switchTo().frame(element(by.model('myModel')).getWebElement());
browser.findElement(by.className('testClass')).click();
var elm = element(by.model("myModel"));
elm.evaluate("fields.myModel = 'test';");

但不幸的是,我有如下错误:

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 navigation, which can interfere with 
Protractor's bootstrapping.  See http://git.io/v4gXM for details

这个页面是有角度的页面,我不知道如何处理它。 我不能使用"browser.ignoreSynchronization=true",因为那样我就有错误,没有定义角度。 我也无法刷新浏览器,因为那样我就会丢失我的内容(它在单击后显示(,所以我不知道该怎么做。

非常感谢您的任何提示。

Iframe和量角器相处得不好。我使用browser.waitForAngularEnabled();,然后进行检查,然后切换回来。
例:

browser.waitForAngularEnabled(false);
browser.switchTo().frame(iFrame)
//Do stuff inside iframe here. You should be treating this as a non angular page
browser.switchTo().defaultContent();
browser.waitForAngularEnabled(true);

相关内容

最新更新