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

我怕爱的太早我们不能终老 提交于 2021-02-05 07:51:11

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/62592792/karate-ui-unable-to-find-the-child-element-using-friendly-locator-and-looking-f

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