量角器 - 计数中继器的元素和打印 [英] Protractor - count elements in repeater and print it
本文介绍了量角器 - 计数中继器的元素和打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想计数中继器的元素,并打印到控制台。
I'm trying to count the elements in repeater and to print it to console.
这是标记:
<div class="col-md-3 ng-scope" ng-repeat="app in userApps" >...< /div>
目前我数和比较:
expect(element.all(by.repeater('app in userApps')).count()).toEqual(4);
它的工作原理,但我希望能够同时打印了。
it works, but I want to be able to print it also.
我试过这样:
var rows = element.all(by.repeater("app in userApps"));
var sum = rows.count();
console.log(sum.getText());
但我发现:
TypeError: Object [object Object] has no method 'getText'
有两个问题actually-
1.我在做了正确的方法是什么?
2.我怎么打印到控制台?
there are two question actually- 1. am I doing it the correct way? 2. how do I print it to console?
推荐答案
如果我正确理解你的问题,你真正想要打印的数量,而不是倾销的全部内容吧?
If I'm understanding your problem correctly, you actually want to print the count and not dumping the entire content right?
element.all(by.repeater('app in userApps')).count().then(function(count) {
console.log(count);
});
这篇关于量角器 - 计数中继器的元素和打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文