我在用weditor定位微信小程序元素时,定位不到,微信版本是7.0的
底层框架的问题,除非作者升级,不然不好处理。
[I 221120 17:50:47 page:204] Serial: android:
[I 221120 17:50:47 web:2239] 200 GET /api/v1/devices/android%3A/screenshot (::1) 560.46ms
[W 221120 17:50:48 __init__:488] [pid:50719] [SED0221A28030207] jsonrpc call got: -32001 Jsonrpc error: <java.lang.NullPointerException> 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
[E 221120 17:50:48 web:1789] Uncaught exception GET /api/v2/devices/android%3A/hierarchy (::1)
HTTPServerRequest(protocol='http', host='localhost:17310', method='GET', uri='/api/v2/devices/android%3A/hierarchy', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/tornado/web.py", line 1702, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "/usr/local/lib/python3.10/site-packages/weditor/web/handlers/page.py", line 94, in get
self.write(d.dump_hierarchy2())
File "/usr/local/lib/python3.10/site-packages/weditor/web/device.py", line 42, in dump_hierarchy2
page_xml = self._d.dump_hierarchy(pretty=True)
File "/usr/local/lib/python3.10/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/usr/local/lib/python3.10/site-packages/retry/api.py", line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File "/usr/local/lib/python3.10/site-packages/retry/api.py", line 33, in __retry_internal
return f()
File "/usr/local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 973, in dump_hierarchy
content = self.jsonrpc.dumpWindowHierarchy(compressed, None)
File "/usr/local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 475, in __call__
return self.server._jsonrpc_retry_call(self.method, params,
File "/usr/local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 489, in _jsonrpc_retry_call
return self._jsonrpc_call(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/uiautomator2/__init__.py", line 551, in _jsonrpc_call
raise err
uiautomator2.exceptions.NullPointerExceptionError: -32001 Jsonrpc error: <java.lang.NullPointerException> 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
[E 221120 17:50:48 web:2239] 500 GET /api/v2/devices/android%3A/hierarchy (::1) 627.08ms
其实自带的uiautomator也不行
hogwarts: ~ seveniruby$ adb shell uiautomator dump
ERROR: null root node returned by UiTestAutomationBridge.