空手道 UI: 无法使用友好的定位器找到子元素并寻找一些替代品

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

正在寻找 findElement.findElement 的替代品,例如 selenium。我已经尝试过在 like friendly locators 中可用的可链接关键字,但其中 none 有效。我想获取 'p' 的文本,我可以通过使用 XPath 来实现它,但是在 selenium 中我们可以使用 findElement($parentDiv).findElement($p) 将起作用。

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

如果 UI 中有任何新的更改,Xpath 将失败,但 findElement.findElement 不会。 空手道-UI 有解决办法吗

试试 0.9.6.RC3 - 你应该可以链接 locate()

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

否则请遵循此过程,以便场景更加清晰 - 并帮助我们解决此问题:https://github.com/intuit/karate/tree/develop/examples/ui-test