浏览Capybara的清单?
我有一个下拉菜单。我希望Capybara通过它找到特定元素,然后单击它。我目前正在尝试在子句中进行一个,并在列表中迭代并找到此元素:“ cow_poop”
<li role="option" unselectable="on" title="Cow_poop" class="ant-select-dropdown-menu-item ant-select-dropdown-menu-item-selected" aria-selected="true" style="user-select: none;">Cow_pop</li>
这是我要执行的代码。
find('div.ant-select-dropdown-menu-item-selected', text: 'Cow_poop').click
但是,这给了我这个错误:
Capybara::ElementNotFound:
Unable to find css "div.ant-select-dropdown-menu-item-selected"
I have a drop down menu. I want capybara to go through it and find the specific element and click on it. I'm currently trying to do a within clause and having it iterate through the list and find this element: "Cow_poop"
<li role="option" unselectable="on" title="Cow_poop" class="ant-select-dropdown-menu-item ant-select-dropdown-menu-item-selected" aria-selected="true" style="user-select: none;">Cow_pop</li>
This is the code that I'm trying to do.
find('div.ant-select-dropdown-menu-item-selected', text: 'Cow_poop').click
However it's giving me this error:
Capybara::ElementNotFound:
Unable to find css "div.ant-select-dropdown-menu-item-selected"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它不是
&lt; div&gt;
,而是&lt; li&gt;
元素。您有效的代码线将是:
替代:
It's not a
<div>
but a<li>
element.Your effective line of code will be:
Alternative: