AirtestProject / AirtestProject/Poco
使用poco定位元素,会导致被测试的app crash;
- Dominant language
- Python
- Stars
- 2k
- Forks
- 341
- PR merge metrics
- No merged PRs in 30d
Description
(请尽量按照下面提示内容填写,有助于我们快速定位和解决问题,感谢配合。否则直接关闭。)
**(重要!问题分类)**
* 图像识别相关问题 -> https://github.com/AirtestProject/Airtest/issues
* 测试开发环境AirtestIDE使用问题 -> https://github.com/AirtestProject/AirtestIDE/issues
* 控件识别、树状结构、poco库报错 -> 此仓库
**描述问题bug**
使用poco定位元素时,会导致被测试的app crash(高频偶现);
**复现步骤**
1. 使用poco定位某个元素,点击它,或者查看是否存在
2. 运行脚本,此时被测试的app就会崩溃;

3、此次运行时xcode日志:
` t = 275.14s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 275.26s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 277.41s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 277.51s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 279.66s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 279.77s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 281.92s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 282.04s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 283.99s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 284.11s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 284.23s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 284.35s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 284.58s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 284.76s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 284.85s Get all elements bound by accessibility element for: Descendants matching type Window
t = 284.85s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 284.89s Find: Descendants matching type Window
t = 284.91s Checking existence of `Window`
t = 284.91s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 284.95s Find: Descendants matching type Window
t = 284.95s Find: Identity Binding
t = 284.96s Find the Window
t = 284.96s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 284.99s Find: Descendants matching type Window
t = 284.99s Find: Identity Binding
t = 285.00s Find the Window at {{0.0, 0.0}, {375.0, 667.0}}
t = 285.01s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 285.04s Find: Descendants matching type Window
t = 285.04s Find: Identity Binding
t = 285.05s Tap Window at {{0.0, 0.0}, {375.0, 667.0}}[0.00, 0.00] -> (187.5, 552.5)
t = 285.05s Find the Window at {{0.0, 0.0}, {375.0, 667.0}}
t = 285.05s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 285.08s Find: Descendants matching type Window
t = 285.08s Find: Identity Binding
t = 285.09s Check for interrupting elements affecting Window
t = 285.10s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 285.14s Find: Descendants matching type Alert
t = 285.14s Synthesize event
t = 285.14s Find the Window
t = 285.14s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 285.17s Find: Descendants matching type Window
t = 285.17s Find: Identity Binding
t = 286.50s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 286.67s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 288.08s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 288.23s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 288.59s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 288.81s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 288.93s Get all elements bound by accessibility element for: Descendants matching type Window
t = 288.93s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 288.99s Find: Descendants matching type Window
t = 289.01s Checking existence of `Window`
t = 289.01s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 289.07s Find: Descendants matching type Window
t = 289.07s Find: Identity Binding
t = 289.07s Find the Window
t = 289.07s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 289.13s Find: Descendants matching type Window
t = 289.14s Find: Identity Binding
t = 289.15s Find the Window at {{0.0, 0.0}, {375.0, 667.0}}
t = 289.15s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 289.20s Find: Descendants matching type Window
t = 289.20s Find: Identity Binding
t = 289.21s Tap Window at {{0.0, 0.0}, {375.0, 667.0}}[0.00, 0.00] -> (210.0, 128.0)
t = 289.22s Find the Window at {{0.0, 0.0}, {375.0, 667.0}}
t = 289.22s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 289.27s Find: Descendants matching type Window
t = 289.27s Find: Identity Binding
t = 289.28s Check for interrupting elements affecting Window
t = 289.29s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 289.34s Find: Descendants matching type Alert
t = 289.34s Synthesize event
t = 289.35s Find the Window
t = 289.35s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 289.39s Find: Descendants matching type Window
t = 289.39s Find: Identity Binding
t = 292.25s Get all elements bound by accessibility element for: Descendants matching type Keyboard
t = 292.25s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 292.37s Find: Descendants matching type Keyboard
t = 292.38s Checking existence of `Keyboard`
t = 292.38s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 292.47s Find: Descendants matching type Keyboard
t = 292.48s Find: Identity Binding
t = 292.48s Find the Keyboard
t = 292.48s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 292.58s Find: Descendants matching type Keyboard
t = 292.58s Find: Identity Binding
t = 294.08s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 294.29s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 294.68s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 294.93s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 295.11s Get all elements bound by accessibility element for: Descendants matching type Window
t = 295.11s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 295.21s Find: Descendants matching type Window
t = 295.23s Checking existence of `Window`
t = 295.23s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 295.32s Find: Descendants matching type Window
t = 295.33s Find: Identity Binding
t = 295.33s Find the Window
t = 295.33s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 295.40s Find: Descendants matching type Window
t = 295.41s Find: Identity Binding
t = 295.41s Find the Window at {{0.0, 0.0}, {375.0, 667.0}}
t = 295.41s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 295.47s Find: Descendants matching type Window
t = 295.47s Find: Identity Binding
t = 295.47s Tap Window at {{0.0, 0.0}, {375.0, 667.0}}[0.00, 0.00] -> (205.0, 172.0)
t = 295.47s Find the Window at {{0.0, 0.0}, {375.0, 667.0}}
t = 295.48s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 295.55s Find: Descendants matching type Window
t = 295.55s Find: Identity Binding
t = 295.56s Check for interrupting elements affecting Window
t = 295.57s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 295.63s Find: Descendants matching type Alert
t = 295.63s Synthesize event
t = 295.63s Find the Window
t = 295.63s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 295.71s Find: Descendants matching type Window
t = 295.72s Find: Identity Binding
t = 298.58s Get all elements bound by accessibility element for: Descendants matching type Keyboard
t = 298.58s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 298.67s Find: Descendants matching type Keyboard
t = 298.68s Checking existence of `Keyboard`
t = 298.68s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 298.76s Find: Descendants matching type Keyboard
t = 298.76s Find: Identity Binding
t = 298.76s Find the Keyboard
t = 298.77s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 298.85s Find: Descendants matching type Keyboard
t = 298.86s Find: Identity Binding
t = 302.34s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 313.41s Requesting snapshot of accessibility hierarchy for app with pid 370
t = 313.61s Requesting snapshot of accessibility hierarchy for app with pid 55
t = 320.53s Requesting snapshot of accessibility hierarchy for app with pid 55
t = 320.67s Requesting snapshot of accessibility hierarchy for app with pid 55
t = 353.88s Requesting snapshot of accessibility hierarchy for app with pid 55
t = 354.05s Requesting snapshot of accessibility hierarchy for app with pid 55
t = 356.29s Requesting snapshot of accessibility hierarchy for app with pid 55
t = 356.45s Requesting snapshot of accessibility hierarchy for app with pid 55
`
4、此次运行时,AirtestIDE的日志:
`[Start running..]
save log in '/var/folders/mf/vn5nd8h12q16dtk_l3lvhgbh0000gp/T/AirtestIDE/scripts/535eab88a46933465aaead005a63a697'
retry to connect, error: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))
======================================================================
ERROR: runTest (app.widgets.code_runner.ide_launcher.AirtestIDECase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "airtest/cli/runner.py", line 73, in runTest
File "site-packages/six.py", line 703, in reraise
File "airtest/cli/runner.py", line 70, in runTest
File "/Users/lihanfei/airtest_tg/00_install_and_login_iOS.air/00_install_and_login_iOS.py", line 35, in
A00 = poco("精灵测试006的家").exists()
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/proxy.py", line 72, in wrapped
return func(proxy, *args, **kwargs)
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/proxy.py", line 774, in exists
return self.attr('visible')
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/proxy.py", line 39, in wrapped
return func(self, *args, **kwargs)
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/proxy.py", line 734, in attr
nodes = self._do_query(multiple=False)
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/proxy.py", line 872, in _do_query
self._nodes = self.poco.agent.hierarchy.select(self.query, multiple)
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/freezeui/hierarchy.py", line 90, in select
return self.selector.select(query, multiple)
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/sdk/Selector.py", line 77, in select
return self.selectImpl(cond, multiple, self.getRoot(), 9999, True, True)
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/sdk/Selector.py", line 71, in getRoot
return self.dumper.getRoot()
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/freezeui/hierarchy.py", line 35, in getRoot
root = Node(self.dumpHierarchy())
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/drivers/ios/__init__.py", line 48, in dumpHierarchy
data = ios_dump_json(jsonObj, self.size)
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/drivers/ios/__init__.py", line 65, in ios_dump_json
data = json_parser(jsonObj, screen_size)
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/drivers/ios/__init__.py", line 95, in json_parser
data["payload"]["size"] = [w / screen_w, h / screen_h]
ZeroDivisionError: float division by zero
----------------------------------------------------------------------
Ran 1 test in 65.672s
FAILED (errors=1)
[Finished]`
**预期效果**
希望能正常使用,无crash;
**相关截图**
无
**python 版本:** `Python 2.7.16`
airtest "1.1.6 "
**poco 版本:** pocoui '1.0.80 '
**设备:**
手机:
- 型号: iPhone8
- 系统: 13.0
电脑:
-系统:10.15.1 (19B88)
-AirtestIDE:v1.2.6
**其他相关环境信息**
无
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.