当我运行量角器测试以检查 toast 弹出消息中的文本时,出现失败:过时的元素引用:元素未附加到页面文档错误。我试过 element.all 但无济于事:
我的期望声明是
it('Delete toast pop up', function() {
var EC = protractor.ExpectedConditions;
publisher_whitelist_page.deleteButtonClick();
browser.wait(EC.visibilityOf(element(by.className('toast-success toast ng-trigger ng-trigger-flyInOut'))),5000);
expect(element.all(by.className('toast-success toast ng-trigger ng-trigger-flyInOut')).getText()).toEqual('Ip address removed');
任何帮助或指导将不胜感激!
谢谢!
柯斯蒂
编辑
获得不同错误失败的进一步进展:无法读取未定义的属性“绑定”
将其塑造成一个页面对象类:
this.popupToastIP = function(){
element.all(by.className('toast-success toast ng-trigger ng-trigger-flyInOut')).then(function(){
element(by.className('toast-success toast ng-trigger ng-trigger-flyInOut')).getText();
});
我的期望:
browser.wait(EC.visibilityOf(publisher_whitelist_page.popupToastIP),5000);
expect(publisher_whitelist_page.popupToastIP.toEqual('Ip address removed'));
再次感谢任何建议,至少它正在找到它但无法阅读它!