【发布时间】:2019-11-03 22:37:33
【问题描述】:
当我单击 UIAutomator 或 Appium Inspector 会话中的元素时,我需要记录所有 Xpaths/资源。为此,我需要在我的代码中创建一个 UIAutomator/Appium 对象,以便我可以运行诸如 UIAutomator.recordElement() 之类的命令,或者沿着这些行来记录我在文件中单击的 Xpath。
我已经使用 Appium 和 UIAutomator 来获取 Xpath,但我必须手动将这些 Xpath/resourceID 从界面复制并粘贴到我的代码中。
Xpath 示例:
//android.widget.LinearLayout[@content-desc=\"Numbers and basic operations\"]/android.view.ViewGroup[1]/android.widget.Button[9]"
以上路径是在 Android 模拟器中使用计算器应用程序时通过手动复制和粘贴从 Appium 获得的。 我需要自动获取。
【问题讨论】:
标签: appium android-uiautomator