安卓系统手机用uiautomatorviewer.bat截图失败或者用adb截的图片打不开

很多没有root过的手机经常在使用uiautomatorviewer.bat的时候会报错,所以很多时候想要定位元素,可以用自己写的一个脚本bat文件获取截图和uix文件,详细如下

打开个编辑器,敲上以下命令
网上看了很多资料,最后总结了下以下的几行,命名为ui.bat(文件名字自己喜欢就好,但是文件的后缀要是bat),写完后保存,我是保存在和uiautomatorviewer.bat文件同一目录下,并打开cmd命令符 输入ui即可
安卓系统手机用uiautomatorviewer.bat截图失败或者用adb截的图片打不开_第1张图片

@echo on
adb shell uiautomator dump /sdcard/app.uix
adb pull /sdcard/app.uix E:\shot\app.uix
adb shell rm /sdcard/app.uix
adb shell screencap /sdcard/app.png
adb pull /sdcard/app.png E:\shot\app.png
adb shell rm /sdcard/app.png

你可能感兴趣的:(测试,UI自动化,adb)