Closed 5368 closed 7 years ago
你把 /sdcard/atx-agent.log
最后面中记录的错误发出来看看。这个错误说明 uiautomator 异常退出了
atx-agent.log ----------------------------------------------
2017/10/22 10:57:41 main.go:653: Ignore SIGUP
2017/10/22 10:57:41 main.go:657: Kill server
2017/10/22 10:57:41 main.go:663: Get http://127.0.0.1:7912/stop: dial tcp 127.0.0.1:7912: getsockopt: connection refused
Listen on http://192.168.168.111:7912
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner
at com.android.commands.am.Am.runInstrument(Am.java:1093)
at com.android.commands.am.Am.onRun(Am.java:371)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:100)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:332)
2017/10/22 10:57:42 uiautomator.go:39: uiautomator quit: exit status 1
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner
at com.android.commands.am.Am.runInstrument(Am.java:1093)
at com.android.commands.am.Am.onRun(Am.java:371)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:100)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:332)
2017/10/22 10:57:46 uiautomator.go:39: uiautomator quit: exit status 1
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner
at com.android.commands.am.Am.runInstrument(Am.java:1093)
at com.android.commands.am.Am.onRun(Am.java:371)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:100)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:332)
2017/10/22 10:57:49 uiautomator.go:39: uiautomator quit: exit status 1
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner
at com.android.commands.am.Am.runInstrument(Am.java:1093)
at com.android.commands.am.Am.onRun(Am.java:371)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:100)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:332)
2017/10/22 10:57:53 uiautomator.go:39: uiautomator quit: exit status 1
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner}
INSTRUMENTATION_STATUS_CODE: -1
android.util.AndroidException: INSTRUMENTATION_FAILED: com.github.uiautomator.test/android.support.test.runner.AndroidJUnitRunner
at com.android.commands.am.Am.runInstrument(Am.java:1093)
at com.android.commands.am.Am.onRun(Am.java:371)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
at com.android.commands.am.Am.main(Am.java:100)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:332)
2017/10/22 10:57:56 uiautomator.go:39: uiautomator quit: exit status 1
2017/10/22 10:57:58 uiautomator.go:46: uiautomator can not started
2017/10/22 10:58:15 reverseproxy.go:316: http: proxy error: dial tcp 127.0.0.1:9008: getsockopt: connection refused
---------------------------------
8-10分钟没有操作,就会出现这个错误,我暂时使用了判断是否能读出d.info,如果不能则重启com.github.uiautomator来解决,就是等待UiaError这个时间有点长
#
try:
print d.info['naturalOrientation']
return True
except:
os.system('adb shell am start com.github.uiautomator/.MainActivity')
#d.press("home")
time.sleep(1)
return True
你这个是具体什么型号的手机,最好能给个手机的链接
小米4c MIUI 8.5.2.0 Android 6.0.1 骁龙801
QQ加我聊下具体问题 646890627
我使用的场景是定时执行操作[每十分钟] 下次执行时就会链接不上,如果一直有交互的话不会出现这个问题. 我明天回去再加你的号 ------------------ 问题已解决 [手机开启节能模式导致进程被杀死导致] ------------------
这个真的挺不错,感谢你的分享!
lenovo A688T/Android 4.4 python -m uiautomator2 init atx-agent install错误
------------------ 问题已解决 [手动atx-agent安装解决] ------------------
错误提示:
jet@debian:~/wtm$ python -m uiautomator2 init
2017-10-24 06:12:01,004 - main.py:251 - INFO - Device(T4CQGE6HQS55EYTO) initialing ...
2017-10-24 06:12:01,172 - main.py:159 - INFO - apk already installed, skip
2017-10-24 06:12:01,172 - main.py:175 - INFO - atx-agent is installing, please be patient
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/uiautomator2/main.py", line 276, in
bug吗?
File "t1.py", line 108, in wtm
if self.wx():
File "t1.py", line 60, in wx
if self.d(text=u"确定").wait(timeout=1):
File "/usr/local/lib/python2.7/dist-packages/uiautomator2/__init__.py", line 588, in wait
return self.jsonrpc.waitForExists(self.selector, int(timeout*1000))
File "/usr/local/lib/python2.7/dist-packages/uiautomator2/__init__.py", line 149, in __call__
return self.server.jsonrpc_call(self.method, params)
File "/usr/local/lib/python2.7/dist-packages/uiautomator2/__init__.py", line 183, in jsonrpc_call
raise err
JsonRpcError: -32001 Server error: None
关机后链接不上[python -m uiautomator2 init解决] {机型:Xiaomi 4C/Android 6.0.1,lenovo A688T/Android 4.4}
链接正常后停10分钟还会连不上[再次打开com.github.uiautomator可解决]
{机型:Xiaomi 4C/Android 6.0.1}
_原由是手机上开启节电导致app限制运行.
这个问题算以解决_
-----------------------------
关机连不上提示:
jet@debian:~wtm$ python tt.py
Traceback (most recent call last):
File "tt.py", line 13, in
增加了一个d.healthcheck()
方法,用来重启uiautomator2,你的问题我暂时复线不了,你每次运行测试的时候,跑下这个方法,看看好使不
麻烦你了! 这个错误呢? 是不是我写错了?
if self.d(text=u"确定").wait(timeout=1): File "/usr/local/lib/python2.7/dist-packages/uiautomator2/init.py", line 588, in wait return self.jsonrpc.waitForExists(self.selector, int(timeout*1000)) File "/usr/local/lib/python2.7/dist-packages/uiautomator2/init.py", line 149, in call return self.server.jsonrpc_call(self.method, params) File "/usr/local/lib/python2.7/dist-packages/uiautomator2/init.py", line 183, in jsonrpc_call raise err JsonRpcError: -32001 Server error: None
这个提示的信息不是很全,我代码里面新增加了更详细的输出信息,你下次遇到问题的时候,重新贴出来看看
好的谢谢!
链接正常后停10分钟还会连不上[再次打开com.github.uiautomator可解决] {机型:Xiaomi 4C/Android 6.0.1}
原由**是手机上开启节电导致app限制运行.
这个问题算以解决**
这都被你发现了
healthcheck() 这个函数,重新做了调整,先启动com.github.uiautomator
然后返回桌面,等待uiautomator连接恢复
每次开始测试时运行一下healthcheck()
这个函数就好了
uiautomator2.UiaError: ('http://192.168.168.111:7912/jsonrpc/0', '{"params": {}, "jsonrpc": "2.0", "id": "0cb0b4a2b27f2377e139075a549b60bf", "method": "deviceInfo"}', 502, u'', 'HTTP Return code is not 200') 对于这个异常是否有超时设置? 是否有重启ATX-Agent的函数?