问题描述:sonic-uia2-client升级到0.0.4后,find_element报错了,我降级回到0.0.3就可以。find_element(AndroidSelector.XPATH, "//android.widget.TextView[@text='Cancel']")
Server版本:2.5.5
Agent版本与部署方式:2.5.5 jar
手机型号与系统版本:小米6 安卓9
截图:

相关日志:
[2023-06-09 18:27:38,993]:[welcomePage.py[49]][INFO]:连接uiautomator2-server成功
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1496, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/lijiguang/projects/aelfuiautomator2/page_object/welcomePage.py", line 51, in <module>
e = driver.find_element(AndroidSelector.XPATH, "//android.widget.TextView[@text='Cancel']")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lijiguang/projects/Env/aelfuiautomator2/lib/python3.11/site-packages/uia2/driver.py", line 50, in find_element
return self._client.find_element(selector, value, retry, interval)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lijiguang/projects/Env/aelfuiautomator2/lib/python3.11/site-packages/client/uia_client.py", line 194, in find_element
).body(json.dumps(data))
^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type AndroidSelector is not JSON serializable