javascript Angular JS 如何使用量角器获取中继器的所有行?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19913409/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 17:14:00  来源:igfitidea点击:

Angular JS How to get all rows of a repeater with Protractor?

javascriptangularjsrepeaterng-repeatprotractor

提问by Philipp

I have a table with all users and I want to search for a user with the column {{user.name}} === 'X'. When I found the right row I want to delete the entry with a click on the last column of the row.

我有一个包含所有用户的表,我想搜索列 {{user.name}} === 'X' 的用户。当我找到正确的行时,我想通过单击该行的最后一列来删除该条目。

element(by.repeater('user in allUsers')).then(function(rows) {
  for (var i = 0; i < rows.length; ++i) {
    // if the right row is found click on the last column to delete it
  } 
});

I get an TypeError: Object # has no method 'then'

我得到一个 TypeError: Object # has no method 'then'

I found my solution here but that is still the old syntax

我在这里找到了我的解决方案,但这仍然是旧语法

回答by JB Nizet

You forgot to call the allfunction:

你忘了调用all函数:

element.all(by.repeater('user in allUsers')).then(function(rows) {