[英]Protractor E2E Test - How can I get a Table Heading by its repeater?
Looking at this topic , I can get the information for a table heading by it's class/tags. 查看此主题 ,我可以通过表的类/标签获取表标题的信息。 However, for the table I have I would like to get mine using the repeater.
但是,对于这张桌子,我想使用转发器。
I know I can get the rows using element.all(by.repeater('row in myRows'))
but that only seems to include the tr
rows themselves, and not the heading ( th
) row. 我知道我可以使用
element.all(by.repeater('row in myRows'))
来获取element.all(by.repeater('row in myRows'))
似乎仅包括tr
行本身,而不包括标题( th
)行。
How can I use by.repeater
to get the row of headings? 我如何使用
by.repeater
获取标题行?
One option would be to get one repeater row and use ancestor
to get the table
parent element. 一种选择是获取一个转发器行,并使用
ancestor
获取table
父元素。 Then, you can get to the th
header elements from there: 然后,您可以从那里到达
th
标题元素:
var rows = element.all(by.repeater('row in myRows'));
var table = rows.first().all(by.xpath("ancestor::table")).last();
var headers = table.all(by.tagName("th"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.