我在代码中使用xpath作为定位符时出现WebDriverException

时间:2019-07-16 06:05:14

标签: xpath parent-child appium-android

在我的appium代码中使用xpath作为定位符时,我收到WebDriverException。我想从子元素获取文本值,但是子元素没有content_desc,因此可以使用父元素转到子元素。

我尝试了以下代码。

WebElement ele = driver.findElementByAccessibilityId(domNodes.firstChannelLiveEvent)
log.info("ele -------------->  "+ele)
WebElement try1 = ele.findElement(By.xpath(".//*"))
WebElement try2 = ele.findElement(MobileBy.xpath("./*"))
log.info("try1 -----------> "+ try1)
log.info("try2 -----------> "+ try2)

0 个答案:

没有答案