uiautomator2巨坑

uiautomator2巨坑
Flawuiautomator2巨坑
windows安装相关包:
1 | pip install --pre uiautomator2 |
这里安装雷电模拟器,这里要记住,要用雷电模拟器自带的adb
1 | where adb |
启动雷电模拟器,开启开发者选项,以及USB调试,以及配置下模拟器IP地址。
重启下adb
1 | adb kill-server |
再查询是否检测到设备:
1 | adb devices |
查询到了,再安装ATX。
1 | python -m uiautomator2 init |
安装完后,会有这个图标:
点开他,按下:
发现启动不了。
这里直接进入shell,操作手机,进行打开。
1 | adb shell |
这样就打开了。不会提示Uiautomator not starting
下面安装weditor
1 | pip install --pre -U weditor |
然后启动
1 | weditor |
注意遇到的天坑:
1.weditor连不上
今天因业务需求需要用到 uiautomator2 和 webitor, 但是在下载webitor 的时候一直报错, 在网上差了1个小时也没搞定,
最后找到了解决办法, 指定版本下载
1 | pip install weditor==0.6.4 |
结果,安装是成功了, 但是因为版本冲突,链接不上手机,白费, 继续找方法- -
最后的最后 让我成功解决了,浪费劳资将近2个小时。。。
先git clone https://github.com/openatx/weditor,下载源码 再 pip3 install -e weditor
2.不显示安装的atx
一、python -m uiautomator2 init,报错:由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败;尝试手动安装
1 | https://github.com/openatx/atx-agent/releases |
1.访问该网站,下载以linux_armv7.tar.gz结尾的二进制包
2.解压出atx-agent文件
二、控制台输入:
1 | #push 到手机指定路径下 |
三、uiautomator2版本匹配的apk
PS:uiautomator2版本匹配可以在pip安装的uiautomator2的目录下有个versiopn.py的文件里
1 | https://github.com/openatx/android-uiautomator-server/releases |
1.访问网址下载对应版本app-uiautomator.apk、app-uiautomator-test.apk进行安装
1 | adb install app-uiautomator.apk |
2.再次执行python -m uiautomator2 init 成功安装




















