uiautomator2+雷电模拟器

1.雷电模拟器设置网络桥接

2.安装uiautomator2

pip install --pre uiautomator2

pip install pillow

3.初始化

python -m uiautomator2 init

安装完成,设备上会多一个ATX的应用。

打开之后可以看到手机IP

4.weditor 网页查看控件

# 安装
pip install --pre --upgrade weditor
pip install weditor==0.6.4 # 如果安装其他版本可能会出现 UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xad in position 825: illegal multibyte sequence
# 或者把python默认环境改为utf8
set PYTHONUTF8=1
# 使用 Python3 -m weditor

在页面左上角选择Android,输入设备IP(192.168.1.102),点击Connect按钮。

5.Python连接手机

import uiautomator2

uiautomator2.connect_wifi('192.168.1.102')

 5. 如果atx提示 非 am instrument 那就使用adb链接上手机并使用以下命令启动atx

adb shell  /data/local/tmp/atx-agent server -d

 

posted on 2020-04-02 21:50  信奉上帝的小和尚  阅读(2696)  评论(0编辑  收藏  举报

导航