UIAutomator2 配置

步骤一:安装

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

猜你喜欢

转载自blog.csdn.net/qq_41236493/article/details/115296592