Sathish
Sathish

Reputation: 360

Karate UI: unable to find the child element using friendly locator and looking for some alternatives

Looking for an alternative of findElement.findElement like in selenium. I have tried chainable keywords available in like friendly locators but none of them worked. I want to get the text of 'p' and I can achieve it by using XPath however in selenium we could use findElement($parentDiv).findElement($p) will work.

<div class="example">
 <span class="new"></span>
 <p>Random Text</p>
</div>

Xpath will fail if there are any new changes in the UI however findElement.findElement won't. Does Karate-UI have a solution for this

Upvotes: 1

Views: 1096

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58088

Try 0.9.6.RC3 - you should be able to chain locate()

* def e = locate('.example')
* match e.locate('p').text == 'Random Text'

Else please follow this process so that the scenario is more clear - and help us fix this: https://github.com/intuit/karate/tree/develop/examples/ui-test

Upvotes: 1

Related Questions