官宣介绍:
uiautomator2 是一个Android UI自动化框架,支持Python编写测试脚本对设备进行自动化。底层基于Google uiautomator,
个人开发环境:
- Python2.7
- adb(加入到环境变量中)
开发工具 - Pycharm
使用教程
-
安装uiautomator2
pip install uiautomator2 init -
Deploy associated daemons to a device
电脑连接上一个手机或多个手机, 确保adb已经添加到环境变量中,执行下面的命令会自动安装本库所需要的设备端程序:# init 所有的已经连接到电脑的设备 python -m uiautomator2 init有时候init会出错,官方说参考Init指南,但经过多次测试,init时候使用科学上网即可解决问题。
也可以使用–serial可以指定单个设备
python -m uiautomator2 init --mirror --serial $SERIAL -
Install weditor (UI Inspector)
pip install -U weditor命令行启动 python -m weditor 会自动打开浏览器,输入设备的ip或者序列号,点击Connect即可。
本文详细介绍如何使用UIAutomator2进行Android UI自动化测试。包括环境搭建、Python脚本编写及weditor安装教程,适合初学者快速上手。
5192

被折叠的 条评论
为什么被折叠?



