【发布时间】:2015-03-23 18:43:05
【问题描述】:
我试图写一个函数来等待某些元素的数量为特定的数字,我的代码是:
waitelementnum= function (num) {
var elmnum=element.all(by.xpath("//div[@class='notification-content']")).count();
browser.wait(function () {
return (elmnum>num);
}, 10000);
};
但它总是超时。然后我尝试打印 count 的结果,例如:
console.log(element.all(by.xpath("//div[@class='notification-content']")).count());
什么都没有打印出来;
但是当我尝试时:
expect(element.all(by.xpath("//div[@class='notification-content']")).count()).toEqual(2);
它报告了:
expecting 1 to be 2.
那么世界上有人请告诉我我的功能有什么问题吗?
【问题讨论】:
标签: angularjs testing protractor end-to-end