1.雷電模擬器設置網絡橋接
2.安裝uiautomator2
pip install --pre uiautomator2
pip install pillow
3.初始化
python -m uiautomator2 init
安裝完成,設備上會多一個ATX的應用。
打開之后可以看到手機IP
4.weditor 網頁查看控件
# 安裝 pip install --pre --upgrade weditor # 使用 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