【发布时间】:2019-12-30 20:08:48
【问题描述】:
我正在尝试使用 NGTest 框架和 UIAutomator 对 Android 应用执行一些自动化操作。
以下是 UI Automator 的输出 - 我的 XPath 知识不是最热门的,但我尝试使用以下 Java 代码选择相机按钮的父级:
WebElement e = driver.findElement(By.xpath("//android.widget.LinearLayout[@resource-id=com.instagram.android:id/tab_bar']"));
但是这会返回异常:
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command.
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
谁能更好地指导我如何使用 XPath 表达式从 UIInspector 向下钻取树?我应该从顶部开始,然后一路向下,还是可以尝试以这种方式抓住孩子?
我也尝试过直接使用边界来抓取相机图标,但这也没有用。
尝试过:
WebElement abc = driver.findElement(By.xpath ("//android.widget.ImageView[contains(@bounds,'[508,2119][571,2131]')']"));
abc.click();
【问题讨论】:
标签: xpath appium appium-android