需要在量角器中找到使用ng中继器的li元素的数量

Need to find the number of li elements which uses ng-repeater in protractor

本文关键字:中继器 ng li 元素 量角器      更新时间:2023-09-26

我需要在量角器中找到li元素的长度

我的视图是

<ul id="list">
<li ng-repeat="class in classList.classInfo.values() | orderBy:'displayOrder'">
</li>
</ul>

我试过这个

element.all(by.repeater('class in classList.classInfo.values()| orderBy:"displayOrder"')).count().then(function (count) {
}

但我得到了错误的计数值。在这种情况下,使用量角器找到li元素个数的最佳方法是什么?

尝试使用$$('')选择器,这是element.all(by.css('…'))的缩写:

var foo = $$('[ng-repeat="class in classList.classInfo.values() | orderBy:''displayOrder''"]');
    foo.then(function(bar){
        console.log(bar.length);
    });