uiautomator2命令行实例

2022-01-20 12:00 评论 0 条

摘要

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目录

adb screenshot

identify命令

Android设备屏幕发生变化,重新初始化uiautomator2

install命令

将本地apk文件安装到Android设备,其实是先执行adb push local_file android_file,再执行adb install android_file

adb install

uninstall命令

卸载指定包名的Android设备中的应用程序

adb uninstall

healthcheck命令

恢复uiautomator2服务。如果uiautomator2运行的服务被杀死,运行该命令重启该服务。

check命令

healthcheck命令的简写,效果和healthcheck命令一样。

start命令

启动指定包名Android设备安装的应用程序。

adb shell start

stop命令

强制停止指定包名Android设备的应用程序

adb stop

current命令

获取当前Android设备显示界面的应用程序信息

doctor命令

检测uiautomator2和Android设备连接的问题

console命令

进入命令行的python和Android设备交互界面,在该界面自由编写python语句操作Android设备,比如:点击按钮

purge命令

清除Android设备运行uiautomator2依赖的应用程序,比如:minicap、minitouch、atx-agent等

当前文章价值7.76元,扫一扫支付后添加微信提供帮助!(如不能解决您的问题,可以申请退款)

你可能感兴趣的文章

来源:每日教程每日一例,深入学习实用技术教程,关注公众号TeachCourse
转载请注明出处: https://www.teachcourse.cn/2938.html ,谢谢支持!

资源分享

分类:python 标签:
Genymotion安装APP出现:INSTALL_FAILED_UPDATE_INCOMPATIBLE Genymotion安装APP出现:IN
如何自定义View视图控件案例开发(一) 如何自定义View视图控件案例开发
php语法与基础详细介绍 php语法与基础详细介绍
IntentService,你了解的多少? IntentService,你了解的多少?

发表评论

呲牙 憨笑 坏笑 偷笑 色 微笑 抓狂 睡觉 酷 流汗 鼓掌 大哭 可怜 疑问 晕 惊讶 得意 尴尬 发怒 奋斗 衰 骷髅 啤酒 吃饭 礼物 强 弱 握手 OK NO 勾引 拳头 差劲 爱你

表情