摘要
cmd命令行输入uiautomator2 --help
获取命令行帮助文档
usage: uiautomator2 [-h] [-d] [-s SERIAL]
{version,init,screenshot,identify,install,uninstall,healthcheck,check,start,stop,current,doctor,console,purge} ...
positional arguments:
{version,init,screenshot,identify,install,uninstall,healthcheck,check,start,stop,current,doctor,console,purge}
version show version
init install enssential resources to device
screenshot take device screenshot
identify quickly find your device by change device screen color
install install packages
uninstall uninstall packages
healthcheck recover uiautomator service
check alias of healthcheck
start start application
stop stop application
current show current application
doctor detect connect problem
console launch interactive python console
purge remove minitouch, minicap, atx app etc, from device
optional arguments:
-h, --help show this help message and exit
-d, --debug show log (default: False)
-s SERIAL, --serial SERIAL
device serial number (default: None)
version命令
打印出当前uiautomator2版本号
init命令
安装额外的依赖文件到当前Android设备,比如:minicap、minitouch、atx-agent等
screenshot命令
截屏当前Android设备并自动复制到当前cmd目录,如下图:截屏模拟器并复制screenshot.jpg到C:\Users\zhaolin
目录
identify命令
Android设备屏幕发生变化,重新初始化uiautomator2
install命令
将本地apk文件安装到Android设备,其实是先执行adb push local_file android_file
,再执行adb install android_file
uninstall命令
卸载指定包名的Android设备中的应用程序
healthcheck命令
恢复uiautomator2服务。如果uiautomator2运行的服务被杀死,运行该命令重启该服务。
check命令
healthcheck命令的简写,效果和healthcheck命令一样。
start命令
启动指定包名Android设备安装的应用程序。
stop命令
强制停止指定包名Android设备的应用程序
current命令
获取当前Android设备显示界面的应用程序信息
doctor命令
检测uiautomator2和Android设备连接的问题
console命令
进入命令行的python和Android设备交互界面,在该界面自由编写python语句操作Android设备,比如:点击按钮
purge命令
清除Android设备运行uiautomator2依赖的应用程序,比如:minicap、minitouch、atx-agent等
当前文章价值7.76元,扫一扫支付后添加微信提供帮助!(如不能解决您的问题,可以申请退款)