【发布时间】:2018-09-06 19:13:01
【问题描述】:
所以这个问题基本上是要详细说明 [How to find specific row in ng-table by text [protractor] 中提到的解决方案是如何工作的。
我这里复制代码sn-p
element.all(by.repeater('item in $data track by $index')).filter(function(row) {
return row.getText().then(function(txt) {
txt = txt.replace(/\s/g, '');
var found = txt.split('ID0001');
return found.length > 1;
});
}).then(function( elem){
elem[0].click();
});
在这里,我无法理解它是如何在 then 子句中专门选择 ID0001 的。我得到了使用 split 函数的部分,因为当什么都没有找到时,它会简单地返回 1 并且如果找到它,长度将大于并且因此将返回 true。但是,我很困惑它在哪里返回了我们想要找到的元素以便对其执行点击操作?
【问题讨论】:
标签: angularjs selenium protractor automated-tests