AirtestProject / Airtest

UI Automation Framework for Games and Apps
http://airtest.netease.com/
Apache License 2.0
8.21k stars 1.29k forks source link

airtest多次run case以后手机变得卡顿 #949

Closed ZhangOscar closed 3 years ago

ZhangOscar commented 3 years ago

(请尽量按照下面提示内容填写,有助于我们快速定位和解决问题,感谢配合。否则直接关闭。)

(重要!问题分类)

描述问题bug 使用"python3 -m airtest run {case} --device Android:///”启动airtest run case,多次run以后手机(MI9SE 安卓10 MIUI12.0.3/华为nova7SE 安卓10 EMUI10.1.1都有出现)变得卡顿,甚至出现poco crash(已向poco team report)。

(在这里粘贴traceback或其他报错信息) [11:16:49][INFO] Try finding: Template(D:\code_py3\pandsta\scripts\cases\run_time\pic_android\ConfActivityNormal\btnLeaveBO.png) [11:16:50][DEBUG] try match with SURFMatching Traceback (most recent call last): File "D:\environment\Python37-32\lib\site-packages\airtest\aircv\keypoint_matching_contrib.py", line 118, in init_detector self.detector = cv2.xfeatures2d.SURF_create(self.HESSIAN_THRESHOLD, upright=self.UPRIGHT) cv2.error: OpenCV(4.5.2) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-14oozfdh\opencv_contrib\modules\xfeatures2d\src\surf.cpp:1029: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'cv::xfeatures2d::SURF::create'

[11:16:50][DEBUG] 'surf'/'sift'/'brief' is in opencv-contrib module. You can use 'tpl'/'kaze'/'brisk'/'akaze'/'orb' in CVSTRATEGY, or reinstall opencv with the contrib module. [11:16:50][DEBUG] try match with TemplateMatching [11:16:50][DEBUG] [Template] threshold=0.7, result={'result': (547, 456), 'rectangle': ((103, 384), (103, 528), (991, 528), (991, 384)), 'confidence': 0.9999993443489075} [11:16:50][DEBUG] find_best_result() run time is 0.09 s. [11:16:50][DEBUG] match result: {'result': (547, 456), 'rectangle': ((103, 384), (103, 528), (991, 528), (991, 384)), 'confidence': 0.9999993443489075} airtest: run case exception: com.netease.open.libpoco.sdk.exceptions.NodeHasBeenRemovedException: Node was no longer alive when query attribute "name". Please re-select.

|-- Remote Traceback --|

com.netease.open.libpoco.sdk.exceptions.NodeHasBeenRemovedException: Node was no longer alive when query attribute "name". Please re-select. at com.netease.open.libpoco.Node.getAttr(Node.java:81) at com.netease.open.libpoco.sdk.AbstractNode.enumerateAttrs(AbstractNode.java:71) at com.netease.open.libpoco.sdk.AbstractDumper.dumpHierarchyImpl(AbstractDumper.java:34) at com.netease.open.libpoco.sdk.AbstractDumper.dumpHierarchy(AbstractDumper.java:24) at com.netease.open.libpoco.sdk.AbstractDumper.dumpHierarchy(AbstractDumper.java:20) at java.lang.reflect.Method.invoke(Native Method) at com.netease.open.hrpc.backend.RpcServer.onRequest(RpcServer.java:171) at com.netease.open.hrpc.backend.RpcServer.serve(RpcServer.java:57) at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:840) at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:189) at java.lang.Thread.run(Thread.java:929)

|-- Remote Traceback end --| server-mode: case result :{"case_name": "leave_bo", "case_result": "False", "info": {}, "ostype": "android"} executor: receive case result: {"case_name": "leave_bo", "case_result": "False", "info": {}, "ostype": "android", "ip": "10.100.162.238"} executor: send case result success: {"case_name": "leave_bo", "case_result": "False", "info": {}, "ostype": "android", "ip": "10.100.162.238"} executor: received case: {"case_name": "uninstall", "uninstall_param": {}} server-mode: received stop run server-mode: received case: uninstall server-mode: get run case :>>{"case_name": "uninstall", "stop": "True"}

相关截图 (贴出遇到问题时的截图内容,如果有的话) (在AirtestIDE里产生的图像和设备相关的问题,请贴一些AirtestIDE控制台黑窗口相关报错信息)

我没有使用AirtestIDE运行项目,而是先使用poco获取到ui_tree后把相关控件截图出来,然后再进行touch等操作。截图如下: image

预期效果 不卡顿

python 版本: python3.7

airtest 版本: 1.1.3 pocoui 版本: 1.0.82

设备:

其他相关环境信息 (PC端使用windows 10)

ZhangOscar commented 3 years ago

重复初始化poco导致的

ivoidcat commented 3 years ago

+1

ivoidcat commented 3 years ago

最后解决了嘛