AirtestProject / AirtestProject/Poco
一台PC连5台手机,用py命令调起airtest的脚本(按id devices区分),会经常出现用例跑着跑着就卡住了
- Lenguaje dominante
- Python
- Estrellas
- 2k
- Forks
- 341
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
(请尽量按照下面提示内容填写,有助于我们快速定位和解决问题,感谢配合。否则直接关闭。)
**(重要!问题分类)**
* 图像识别相关问题 -> https://github.com/AirtestProject/Airtest/issues
* 测试开发环境AirtestIDE使用问题 -> https://github.com/AirtestProject/AirtestIDE/issues
* 控件识别、树状结构、poco库报错 -> 此仓库
**描述问题bug**
一台PC连5台手机,用py命令调起airtest的脚本(按id devices区分),会经常出现用例跑着跑着就卡住了
如果是一台PC连1台手机,同样用py命令调起airtest的脚本,就不会出现卡住现象
下面的log描述的是一个AirTest用例在一台手机上卡住了,但同一个AirTest用例在另外4台手机上是pass的
```
{"tag": "function", "depth": 1, "time": "2018-09-11 14:26:01", "data": {"name": "shell", "call_args": {"cmd": "dumpsys window policy | grep mAwake"}, "start_time": 1536647161.164643, "ret": " mAwake=true\r\n", "end_time": 1536647161.507843}}
{"tag": "function", "depth": 1, "time": "2018-09-11 14:26:02", "data": {"name": "keyevent", "call_args": {"keyname": "BACK", "kwargs": {}}, "start_time": 1536647161.507843, "ret": null, "end_time": 1536647162.599843}}
{"tag": "function", "depth": 1, "time": "2018-09-11 14:26:03", "data": {"name": "keyevent", "call_args": {"keyname": "BACK", "kwargs": {}}, "start_time": 1536647162.599843, "ret": null, "end_time": 1536647163.660643}}
{"tag": "function", "depth": 1, "time": "2018-09-11 14:26:04", "data": {"name": "keyevent", "call_args": {"keyname": "HOME", "kwargs": {}}, "start_time": 1536647163.660643, "ret": null, "end_time": 1536647164.7214432}}
{"tag": "function", "depth": 1, "time": "2018-09-11 14:26:05", "data": {"name": "record_ui", "call_args": {"driver": "", "action": "'click'", "ui": "UIObjectProxy of \"Camera\"", "args": "[0.3055555555555556, 0.726]"}, "start_time": 1536647165.704243, "ret": "UIObjectProxy of \"Camera\"", "end_time": 1536647165.704243}}
{"tag": "function", "depth": 2, "time": "2018-09-11 14:26:10", "data": {"name": "try_log_screen", "call_args": {"screen": null}, "start_time": 1536647167.233043, "ret": "1536647169931.jpg", "end_time": 1536647170.025443}}
{"tag": "function", "depth": 1, "time": "2018-09-11 14:26:13", "data": {"name": "touch", "call_args": {"v": [220.00000000000003, 1089.0], "kwargs": {"duration": 0.01}, "times": 1}, "start_time": 1536647167.233043, "ret": [220.00000000000003, 1089.0], "end_time": 1536647173.566643}}
{"tag": "function", "depth": 3, "time": "2018-09-11 14:26:17", "data": {"name": "_cv_match", "call_args": {"self": {"filename": "tpl1535007750276.png", "_filepath": "testcase\\tc_airtest\\TC_Stre_Camera_Normal_0010.air\\tpl1535007750276.png", "threshold": 0.6, "target_pos": 5, "record_pos": [-0.15, 0.572], "resolution": [720, 1500], "rgb": false, "__class__": "Template"}, "screen": "array([[[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n ...,\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]]], dtype=uint8)"}, "start_time": 1536647175.391843, "ret": null, "end_time": 1536647177.435443}}
{"tag": "function", "depth": 3, "time": "2018-09-11 14:26:18", "data": {"name": "_cv_match", "call_args": {"self": {"filename": "tpl1535007750276.png", "_filepath": "testcase\\tc_airtest\\TC_Stre_Camera_Normal_0010.air\\tpl1535007750276.png", "threshold": 0.6, "target_pos": 5, "record_pos": [-0.15, 0.572], "resolution": [720, 1500], "rgb": false, "__class__": "Template"}, "screen": "array([[[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n ...,\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]]], dtype=uint8)"}, "start_time": 1536647178.043843, "ret": null, "end_time": 1536647178.449443}}
{"tag": "function", "depth": 3, "time": "2018-09-11 14:26:18", "data": {"name": "try_log_screen", "call_args": {"screen": "array([[[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n ...,\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]],\n\n [[0, 0, 0],\n [0, 0, 0],\n [0, 0, 0],\n ...,\n [0, 0, 0],\n [0, 0, 0],\n [0, 0, 0]]], dtype=uint8)"}, "start_time": 1536647178.449443, "ret": "1536647178449.jpg", "end_time": 1536647178.4650428}}
{"tag": "function", "depth": 2, "time": "2018-09-11 14:26:18", "data": {"name": "loop_find", "call_args": {"query": {"filename": "tpl1535007750276.png", "_filepath": "testcase\\tc_airtest\\TC_Stre_Camera_Normal_0010.air\\tpl1535007750276.png", "threshold": 0.6, "target_pos": 5, "record_pos": [-0.15, 0.572], "resolution": [720, 1500], "rgb": false, "__class__": "Template"}, "timeout": 3, "threshold": null, "interval": 0.5, "intervalfunc": null}, "start_time": 1536647175.329443, "traceback": "Traceback (most recent call last):\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\airtest\\utils\\logwraper.py\", line 72, in wrapper\n res = f(*args, **kwargs)\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\airtest\\core\\cv.py\", line 60, in loop_find\n raise TargetNotFoundError('Picture %s not found in screen' % query)\nairtest.core.error.TargetNotFoundError: 'Picture Template(testcase\\\\tc_airtest\\\\TC_Stre_Camera_Normal_0010.air\\\\tpl1535007750276.png) not found in screen'\n", "end_time": 1536647178.527443}}
{"tag": "function", "depth": 1, "time": "2018-09-11 14:26:18", "data": {"name": "exists", "call_args": {"v": {"filename": "tpl1535007750276.png", "_filepath": "testcase\\tc_airtest\\TC_Stre_Camera_Normal_0010.air\\tpl1535007750276.png", "threshold": 0.6, "target_pos": 5, "record_pos": [-0.15, 0.572], "resolution": [720, 1500], "rgb": false, "__class__": "Template"}}, "start_time": 1536647175.329443, "ret": false, "end_time": 1536647178.527443}}
{"tag": "info", "depth": 0, "time": "2018-09-11 14:26:25", "data": {"name": "Final Error", "traceback": "Traceback (most recent call last):\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\poco\\proxy.py\", line 26, in wrapped\n proxy.wait_for_appearance(timeout=proxy.poco._pre_action_wait_for_appearance)\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\poco\\proxy.py\", line 567, in wait_for_appearance\n raise PocoTargetTimeout('appearance', self)\npoco.exceptions.PocoTargetTimeout: Waiting timeout for appearance of \"UIObjectProxy of \"com.mediatek.camera:id/shutter_button\"\"\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\airtest\\cli\\runner.py\", line 62, in runTest\n exec(compile(code.encode(\"utf-8\"), pyfilepath, 'exec'), self.scope)\n File \"E:\\AutoTP\\testcase\\tc_airtest\\TC_Stre_Camera_Normal_0010.air\\TC_Stre_Camera_Normal_0010.py\", line 33, in \n poco(\"com.mediatek.camera:id/shutter_button\").click()\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\poco\\proxy.py\", line 29, in wrapped\n raise e\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\poco\\proxy.py\", line 23, in wrapped\n return func(proxy, *args, **kwargs)\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\poco\\proxy.py\", line 283, in click\n pos_in_percentage = self.get_position(focus)\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\poco\\proxy.py\", line 499, in get_position\n pos = self.attr('pos')\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\poco\\proxy.py\", line 39, in wrapped\n return func(self, *args, **kwargs)\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\poco\\proxy.py\", line 620, in attr\n nodes = self._do_query(multiple=False)\n File \"C:\\Users\\quan.ren\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\poco\\proxy.py\", line 757, in _do_query\n raise PocoNoSuchNodeException(self)\npoco.exceptions.PocoNoSuchNodeException: Cannot find any visible node by query UIObjectProxy of \"com.mediatek.camera:id/shutter_button\"\n"}}
```
**复现步骤**
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**预期效果**
(预期想要得到什么、见到什么)
**相关截图**
(贴出遇到问题时的截图内容,如果有的话)
python 版本: python3.6.4
poco 版本: 1.0.62
系统: [Android 8.1]
PC: windows7
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.