这个工具是Android SDK自带的,

日常的工作中经常要使用的,

在C:\Android\sdk\tools\bin目录下:

 

uiautomatorviewer定位App元素

 

双击之,

请注意,

我一般选择第一个机器人小图标Device Screenshot,

而不是第二个Device Screenshot with Compressed Hierarchy,

因为第二个是具有压缩层次结构的设备截图,

有可能不准确;

uiautomatorviewer定位App元素

 

首次启动会报错:

Unable to connect to adb. Check if adb is installed correctly.

uiautomatorviewer定位App元素

 

怎么解决呢?

关闭之,

打开uiautomatorviewer.bat文件,

修改最后一行:

%prog_dir%

 

uiautomatorviewer定位App元素

 

 改为:

C:\Android\sdk\platform-tools

并保存

 

uiautomatorviewer定位App元素

 

 

再次打开uiautomatorviewer:

uiautomatorviewer定位App元素

 

对应关系:

text                     find_element_by_android_uiautomator("new UiSelector().text(\"文字\")")
resource-id         find_element_by_id
class                   find_element_by_class_name
content-desc      find_element_by_accessibility_id

相关文章:

  • 2021-10-19
  • 2021-06-01
  • 2022-02-14
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-01
  • 2021-06-16
  • 2021-09-23
  • 2022-01-18
  • 2021-10-23
  • 2021-08-19
相关资源
相似解决方案