有些手机,如华为P50E,VIVO S16执行自动化报uiautomator2.exceptions.NullPointerExceptionError: -32001 Jsonrpc error

提问 1 212
河呻
河呻 LV2 2023年7月24日 08:49 发表
<p><span style="color: rgb(96, 98, 102); font-family: Avenir, Helvetica, Arial, sans-serif;">File "C:\Users\Diygame\AppData\Local\Programs\Python\Python37\lib\site-packages\uiautomator2\__init__.py", line 480, in __call__ http_timeout)</span><br style="color: rgb(96, 98, 102); font-family: Avenir, Helvetica, Arial, sans-serif;"><span style="color: rgb(96, 98, 102); font-family: Avenir, Helvetica, Arial, sans-serif;">File "C:\Users\Diygame\AppData\Local\Programs\Python\Python37\lib\site-packages\uiautomator2\__init__.py", line 493, in _jsonrpc_retry_call return self._jsonrpc_call(*args, **kwargs)</span><br style="color: rgb(96, 98, 102); font-family: Avenir, Helvetica, Arial, sans-serif;"><span style="color: rgb(96, 98, 102); font-family: Avenir, Helvetica, Arial, sans-serif;">File "C:\Users\Diygame\AppData\Local\Programs\Python\Python37\lib\site-packages\uiautomator2\__init__.py", line 555, in _jsonrpc_call raise err</span><br style="color: rgb(96, 98, 102); font-family: Avenir, Helvetica, Arial, sans-serif;"><span style="color: rgb(96, 98, 102); font-family: Avenir, Helvetica, Arial, sans-serif;">uiautomator2.exceptions.NullPointerExceptionError: -32001 Jsonrpc error:&nbsp;</span><java.lang.nullpointerexception style="color: rgb(96, 98, 102); font-family: Avenir, Helvetica, Arial, sans-serif;">data: java.lang.NullPointerException: Attempt to read from field 'int android.accessibilityservice.AccessibilityServiceInfo.flags' on a null object reference at androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(UiDevice.java:234) at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:295) at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:284) at java.lang.reflect.Method.invoke(Native Method) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251) at com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100) at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244) at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945) at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192) at java.lang.Thread.run(Thread.java:930) , method: dumpWindowHierarchy</java.lang.nullpointerexception><br></p><p><img src="http://talk-cdn.liumatest.cn/0a938cb2-f0f4-437b-b6d7-568e76bd0d78.png" style="max-width:100%;"><br></p>
收藏(0)  分享
相关标签: app自动化
注意:本文归作者所有,未经作者允许,不得转载
1个回复
  • Chras-fu
    2023年7月24日 10:40
    部分高版本手机目前在adb 获取元素控件的时候会失败,先检查一下系统里是否打开了所有授权。如果打开还是不行,建议只能用坐标进行操作了
    0 0
相关帖子
安卓app用例执行过程中报adbutils.errors.AdbError: unknown host service 4
没有相关数据
源码地址
微信扫描二维码添加作者微信加入社区官方交流群
layui