原型:选择两个孩子中的第一个
我正在 Ruby on Rails 中实现功能测试。我需要在网页上创建一个 assert_select
,其中有一个 content
div,它是两个
项目的数量。我无法将任何类或 id 添加到任何
列表中。 所以我的选择器看起来像这样:
列表。我需要检查第一个列表中
assert_select 'content ul<something_here_to_specify_the_first_one> li', <number_of_li_elements
但是,我找不到“选择第一个 ul 元素”的方法。我查看了 http://content.labnotes.org/assert_select/assert_select.html< /a> 但无法弄清楚哪一个适合我。
干杯!
I'm implementing a functional test in Ruby on Rails. I need to make an assert_select
on a web page, which has a content
div, which was two <ul>
lists. I need to check the number of <li>
items in the first list. And I can't add any class or id to any of the <ul>
list.
So my selector would look like this:
assert_select 'content ul<something_here_to_specify_the_first_one> li', <number_of_li_elements
However, I can't find the way to do that 'select the first one of the ul elements'. I've taken a look at http://content.labnotes.org/assert_select/assert_select.html but haven't been able to figure out which one is the right for me.
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了选择第一个 ul 元素,请执行以下操作:
In order to select the first ul element, do: