uiautomator2报错内容如下:
Traceback (most recent call last):
File "D:/Desktop/code/Python/Yujiahui/crawler-service/app/core/services/taobao_live_ui2.py", line 160, in <module>
tb.run('303528427679', "10.90.5.19", '5555')
File "D:/Desktop/code/Python/Yujiahui/crawler-service/app/core/services/taobao_live_ui2.py", line 145, in run
self.create(device_id=device_ip)
File "D:/Desktop/code/Python/Yujiahui/crawler-service/app/core/services/taobao_live_ui2.py", line 73, in create
self.d = u2.connect_wifi(device_id)
File "E:\Users\kugai\Anaconda3\envs\py37\lib\site-packages\uiautomator2\__init__.py", line 1902, in connect_wifi
raise ConnectError("addr is invalid or atx-agent is not running", addr)
uiautomator2.exceptions.ConnectError: ('addr is invalid or atx-agent is not running', '10.90.5.19')
步骤一: 排除网络问题,手机跟主机不在一个网络
电脑
使用cmd终端运行ipconfig
手机
我的设备-全部参数-状态信息-IP地址
1.看是不是一个网段
- 主机cmd终端运行ping 手机IP地址
步骤二:可能是atx-agent服务没有启动,可以通过手机后台运行
# 把atx-agent服务拷贝到手机目录
adb push .\atx-agent /data/local/tmp
# 连接手机后台启动服务
adb shell
chmod 755 /data/local/tmp/atx-agent
data/local/tmp/atx-agent version # 查看版本
/data/local/tmp/atx-agent server -d # 启动atx-agent并切换到后台运行