如何在 android 9 中使用 UIAUTOMATOR 检查元素

How to inspect element using UIAUTOMATOR in android 9

环境 1. ANDROID 版本 9.0 2. Android SDK工具版本25.2.5 3. 应用类型 Hybrid app 4. Java 版本 1.8.0_181

问题

每当我尝试使用 uiautomatorviewer 获取我的应用程序的 UI 转储时,它会显示以下错误。

Unexpected error while obtaining UI hierarchy java.lang.reflect.InvocationTargetException

我还观察到,当我使用 android 版本 7,6 和 5 连接设备时,它工作正常。

在 android 8 和 9

中检查元素的最佳方法是什么

伙计们,经过调查我找到了解决方案, 为此,我们可以使用 Appium 检查器。

特别是我认为 Appium Desktop 消耗了我们机器的大量性能,所以为了避免这种性能损失,我使用 "App Inspector":https://macacajs.github.io/app-inspector/

使用 "App Inspector" 您可以通过网络检查 iOS/Android 个元素。