karate - 空手道 UI:如何单击具有相同类名的特定复选框
问题描述
场景:一堆复选框将所有相同的类名排成一行。在这种特定情况下,对复选框名称使用“rightOf”不起作用。
上图显示 div 有 id,但无法点击。可点击部分由具有多个其他类似复选框的共享类名称标识。
问题:如何单击共享相同类名的第三个或第四个复选框?
解决方案
First, you can do a locateAll()
and then navigate:
* locateAll('.myclassname')[2].click()
For more advanced filtering, read the docs on using a "filter condition" with locateAll()
: https://github.com/intuit/karate/tree/master/karate-core#locateall-with-filter
For completeness, if you can get hold of the parent of the bunch: https://github.com/intuit/karate/tree/master/karate-core#tree-walking
* parent.children[2].click()
推荐阅读
- python - 我无法在 Atom 中运行 python 代码,但可以在视觉工作室中运行它,因为我使用 anconda 3 下载 python
- c++ - 如何将节点保存到数组中
- google-sheets - 接收“SUMIFS 的数组参数大小不同。” 谷歌表格中的错误
- javascript - 访问有序的类属性
- python - 在自定义环境中运行的 Tensorflow C51 示例代码会出现形状错误
- ios - CI - Xcode 12 服务器在集成后不发送电子邮件
- python - python中的portscanner问题
- html - 可以使用元标记(http-equiv)设置 COOP/COEP 标头吗?
- swift - 泛型方法的类型不匹配问题
- asp.net - 使用 React 和 ASP 下载文件