在selenium Java中,我们可以通过findElement(locator1).findElement(locator2)
找到一个元素,其中包含一个元素
我们也可以做DefaultElementLocatorFactory locatorFactory = new DefaultElementLocatorFactory(getElement()); PageFactory.initElements(locatorFactory, this);
问题1。我们如何在机器人框架中实现同样的事情?
问题2。我们如何在python中实现同样的功能
https://github.com/robotframework/SeleniumLibrary/issues/672
没有内置函数,但您可以使用:
创建关键字
需要两个参数parent(Webelement)和child(Xpath)来搜索父级中的子级
假设父xpath为:
//ul[@id="top_menu"]
,上述代码将搜索等价xpath//ul[@id="top_menu"]/./h3
。注意,taht上下文是父上下文而不是根上下文所以这将等同于xpath
相关问题 更多 >
编程相关推荐