上一步已经把环境搭建好了,先不要急着写脚本,测试APP以前首先要知道app上每个控件的‘地址’,如何准确的定位到这个控件呢?android
一、adb 链接shell
把手机链接上电脑,开启文件传输模式,开启开发者模式,发开USB调试。app
在cmd命令输入adb devices,查看是否能找到手机设备,能找到说明手机链接到电脑没问题了。工具
在手机上打开要测试的APP, 输入 cmd中输入adb shell dumpsys window w | findstr \/ | findstr name=测试
查看app的'appActivity'spa
二、APP控件定位3d
在上一步android SDK中打开控件监控工具:调试
D:\android\sdk\tools\hierarchyviewer.bat blog
若是出现如下报错须要先关闭appium:开发
Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist! Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!
resource-id处就是数字8的id地址了