量角器 - 计算中继器中的元素并打印它 [英] Protractor - count elements in repeater and print it

查看:15
本文介绍了量角器 - 计算中继器中的元素并打印它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试计算中继器中的元素并将其打印到控制台.

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> 

目前我正在计算和比较:

currently I'm counting and comparing:

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'

实际上有两个问题-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 understand your problem correctly, you actually want to print the count and not the entire content, right?

element.all(by.repeater('app in userApps')).count().then(function(count) {
  console.log(count);
});

这篇关于量角器 - 计算中继器中的元素并打印它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆