1.安装adb,连接安卓设备,打开adb调试
2.安装python的uiautomator2库
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn uiautomator2
3.安装atx-agent
python-m uiautomator2 init
4.安装weditor,cmd运行python -m weditor自动打开http://localhost:17310/页面,可以实时查看页面元素
pip install -U weditor
5.python连接设备进行测试用例编写
import uiautomator2 as u2
d = u2.connect_usb('VBJDU18608004539')
d.app_start('cn.styd.management_app')
print(d.info)