openatx / uiautomator2

Android Uiautomator2 Python Wrapper
MIT License
6.67k stars 1.42k forks source link

通过adb wlan连接手机时,修改adb掉线重连的次数 #634

Open old-eight800 opened 3 years ago

old-eight800 commented 3 years ago

你好,我通过adb wlan的方法连接到手机,但是wifi偶尔会不稳定,导致adb掉线几十秒后自己用重新连接上。我看到你们打印的log中有重连的操作,但是只操作了两次,现在我想修改重连的逻辑,修改源码中关于重连的次数。请问源码中在哪个地方修改,谢谢。 附上部分日志

[I 201224 09:20:22 init:262] USB disconnected, fallback to WiFi, ATX_AGENT_URL=http://192.0.0.1:7912 [W 201224 09:20:24 init:203] atx-agent has something wrong, auto recovering [I 201224 09:20:24 init:262] USB disconnected, fallback to WiFi, ATX_AGENT_URL=http://192.0.0.1:7912 [I 201224 09:20:27 init:262] USB disconnected, fallback to WiFi, ATX_AGENT_URL=http://192.0.0.1:7912 [W 201224 09:20:29 init:203] atx-agent has something wrong, auto recovering Exception in thread Thread-1: Traceback (most recent call last): File "F:\gree\test1\TestCase\AiqiyiTest.py", line 41, in aiqiyitest d.watcher.run() File "D:\Program Files\Python\Python37\lib\site-packages\uiautomator2\watcher.py", line 106, in ru n

Traceback (most recent call last): File "D:\Program Files\Python\Python37\lib\threading.py", line 926, in _bootstrap_inner self.run() File "D:\Program Files\Python\Python37\lib\threading.py", line 870, in run self._target(*self._args, self._kwargs) File "F:\gree\test1\mainRun.py", line 38, in run_test AiqiyiTest().aiqiyitest() File "F:\gree\test1\TestCase\AiqiyiTest.py", line 75, in aiqiyitest d.app_stop("com.qiyi.video") File "D:\Program Files\Python\Python37\lib\site-packages\uiautomator2__init.py", line 1398, in app_stop self.shell(['am', 'force-stop', package_name]) File "D:\Program Files\Python\Python37\lib\site-packages\uiautomator2\init__.py", line 390, in s hell ret = self.http.post("/shell", data=data, timeout=timeout+10) File "D:\Program Files\Python\Python37\lib\site-packages\requests\sessions.py", line 581, in post return self.request('POST', url, data=data, json=json, kwargs) File "D:\Program Files\Python\Python37\lib\site-packages\uiautomator2__init.py", line 208, in r equest self.client._prepare_atxagent() File "D:\Program Files\Python\Python37\lib\site-packages\uiautomator2__init__.py", line 291, in prepare_atx_agent raise RuntimeError("USB device %s is offline" % self._serial) RuntimeError: USB device 192.0.0.1:5555 is offline

yshan2028 commented 3 years ago

你这个问题解决了嘛?我发觉我这边也是这样的问题