欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-04-12 09:12:56
很多没有root过的手机经常在使用uiautomatorviewer.bat的时候会报错,所以很多时候想要定位元素,可以用自己写的一个脚本bat文件获取截图和uix文件,详细如下打开个编辑器,敲上以下命令网上看了很多资料,最后总结了下以下的几行,命名为ui.bat(文件名字自己喜欢就好,但是文件的后缀要是bat),写完后保存,我是保存在和uiautomatorviewer.bat文件同一目录下,并打开cmd命令符 输入ui即可@echo onadb shell uiautomator dump...

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

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

@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

本文地址:https://blog.csdn.net/qq_40126958/article/details/107412935