python+uiautomator2对app自动化测试
1. 安装uiautomator2
pip install -U uiautomator2 / pip3 install -U uiautomator2
2. 安装ATX-agent (守护进程), atx-agent
启动uiautomator2服务(默认7912端口)进行监听
python -m uiautomator2 init
3. 安装weditor
1. 安装 pip install --pre --upgrade weditor
2. 使用 python3 -m weditor
4. 代码
d = u2.connect_usb('0123456789ABCDEF') # usb连接
d = u2.connect('192.168.102.200') # wifi连接
packagename = 'com.HSCloudPos.LS.test.sit'
activity = 'com.HSCloudPos.LS.activity.LanchActivity'
d.app_start(packagename, activity=activity)
查看device id:adb devices
查看ip :adb shell netcfg
adb shell ->netcfg