1

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.

enter image description here

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?

Puti
  • 101
  • 8
  • My apologies, done. Any chance for the assist on the question above? I'll ensure to confirm/vote answer, thank you! – Puti Sep 15 '20 at 04:09

1 Answers1

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()
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • I didn't think about the parent child option. That may work better than my original approach, however it's not really working for me. I'll add a screen of the elements I'm trying to navigate to. – Puti Sep 15 '20 at 05:46
  • 1
    @Puti works for me™, so follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Sep 15 '20 at 05:47
  • Thanks Peter, I appreciate your time. I'll try to clean up my original post with more info so other user may gain benefit from this post. – Puti Sep 15 '20 at 05:52
  • 1
    @Puti if it makes it easier try to find a public web page that replicates your problem and edit your question. all the best – Peter Thomas Sep 15 '20 at 05:53