Karate UI: How to click a specific checkbox with same class name

拜拜、爱过 提交于 2021-02-05 08:21:08

问题


Scenario: A bunch of checkboxes rowed up all the the same class name. Using the 'rightOf' for the checkbox names doesn't work in this specific case.

The above images shows the div has a id, but it can't be clicked. The clickable part is identified with a shared class name with multiple other similar checkboxes.

Question: How do I click on a third or fourth checkbox sharing the same class name?


回答1:


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()


来源:https://stackoverflow.com/questions/63893648/karate-ui-how-to-click-a-specific-checkbox-with-same-class-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!