步骤一:安装
pip install --pre -U uiautomator2
步骤二:手机通过usb插在电脑上(需要开启开发者模式,勾选USB调试与安装)
百度查询自己手机机型开启开发者模式
步骤三: 配置adb
从谷歌官网下载Android Platform Tools https://developer.android.com/studio/releases/platform-tools.html,解压,并加包含adb.exe
的目录加入到系统的PATH中
环境安装后验证代码
adb devices
步骤四: 安装手机插件
通过电脑命令安装Android应用
python -m uiautomator2 init
# 如果系统中有python2和python3,请使用
python3 -m uiautomator2 init
image.png
步骤四: 安装控件识别
使用weditor进行元素识别,
安装方法如下:
pip3 install --pre weditor
网友评论