一、抓取元素工具
- (1)android SDK自帶uiautomatorviewer.bat可以查看元素
- (2)appium desktop自帶的start inspector session也可以查看元素
- (3)weditor也可以抓取元素,比前面兩個更好用
二、weditor安裝
- 使用pip安裝weditor,github地址https://github.com/openatx/weditor
pip install —pre weditor
或者
pip install --upgrade weditor
- 創建桌面快捷圖標
python -m weditor —shortcut
- 也可以用命令行啓動
python -m weditor
三、Atx-agent(守護進程)的安裝
-
安裝adb
-
使用以下命令安裝atx最新版
pip install --pre -U uiautomator2
-
手機接到電腦上之後,需要先運行一下命令,將需要的程序部署到手機上(一次即可):
`python -m uiautomator2 init -s 127.0.0.1:62026
-
最後需要在模擬器中停止ATX-Agent,才能正常運行
-
若使用weditor時報錯:cannot identify image file ,則啓動UIAUTOMATOR
四、weditor連接模擬器
- 查看夜神模擬器ip:
adb devices
List of devices attached
127.0.0.1:62001 device
- 連接模擬器,輸入模擬器IP,點擊connect