首页 > 解决方案 > 如何使用 Android uiautomator 查找元素?

问题描述

我正在使用带有 Python 和 Appium 的 android uiautomator。我有以下元素,我需要找到一种方法来点击它。该元素没有唯一的 resourceId、className 或文本。

元素的图像

uiautomator 上的元素详细信息

标签: androidpythonappiumandroid-uiautomator

解决方案


使用Appium-Inspector获取按钮的 xPath,然后通过 xPath 定位按钮:

btn1 = self.driver.find_element_by_xpath("xpath-here")


推荐阅读