AirtestProject / AirtestProject/Poco

poco初始化参数携带use_airtest_input=True时使用poco.start_gesture方法会报错

Đang mở
#396 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
2k
Fork
341
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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

**(重要!问题分类)**
* 图像识别相关问题 -> https://github.com/AirtestProject/Airtest/issues
* 测试开发环境AirtestIDE使用问题 -> https://github.com/AirtestProject/AirtestIDE/issues
* 控件识别、树状结构、poco库报错 -> 此仓库

**描述问题bug**
1、
之前在使用1.2.2时,poco初始化实例的写法为
```python
poco = AndroidUiautomationPoco(force_restart=False)
```
然后使用poco.start_gesture可以正常使用
2、
在升级airtestIDE1.2.3之后,IDE中的poco初始化实例方法修改为
```python
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)
```
然后我使用poco.start_gesture方法会报错。报错如下:
```shell
ice/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 wait-for-device
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell getprop ro.build.version.sdk
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell dumpsys activity top
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell dumpsys package com.netease.nie.yosemite
local version code is 300, installed version code is 300
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell settings get secure default_input_method
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell ime list -a
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell dumpsys package com.netease.open.pocoservice
installed version is 41, installer version is 41. force_reinstall=False
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell dumpsys package com.netease.open.pocoservice.test
installed version is 0, installer version is 0. force_reinstall=False
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 forward --no-rebind tcp:15145 tcp:10080
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 forward --no-rebind tcp:18554 tcp:10081
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell ps
Traceback (most recent call last):
File "/Users/wjjn3033/dev/idestable/airtest-ide/app/widgets/code_runner/run_manager.py", line 217, in my_exec
File "", line 13, in
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/gesture.py", line 31, in up
self.pocoobj.apply_motion_tracks([self.track])
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/pocofw.py", line 416, in apply_motion_tracks
return self.agent.input.applyMotionEvents(tb.discretize(accuracy))
File "/Applications/AirtestIDE.app/Contents/MacOS/poco/utils/airtest/input.py", line 102, in applyMotionEvents
from airtest.core.android.minitouch import DownEvent, MoveEvent, UpEvent, SleepEvent
ImportError: cannot import name 'DownEvent'

[DEBUG][End debugging....]

```
3、但是当我实例化poco取消参数use_airtest_input=True时,就会变得正常
```python
poco = AndroidUiautomationPoco(screenshot_each_action=False)
```
执行poco.start_gesture就会变得正常。
```shell
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 wait-for-device
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell getprop ro.build.version.sdk
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell dumpsys activity top
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell dumpsys package com.netease.nie.yosemite
local version code is 300, installed version code is 300
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell settings get secure default_input_method
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell ime list -a
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell dumpsys package com.netease.open.pocoservice
installed version is 41, installer version is 41. force_reinstall=False
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell dumpsys package com.netease.open.pocoservice.test
installed version is 0, installer version is 0. force_reinstall=False
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 forward --no-rebind tcp:12437 tcp:10080
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 forward --no-rebind tcp:18350 tcp:10081
/Applications/AirtestIDE.app/Contents/MacOS/airtest/core/android/static/adb/mac/adb -P 5037 -s e66cdc75 shell ps

[DEBUG][End debugging....]
```

**复现步骤**
- 1、实例化poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)

- 2、使用poco.start_gesture方法

- 3、发生ImportError错误

**预期效果**
初始化poco实例不会引起poco方法的报错!

**相关截图**
1、错误的截图
![img](https://tva1.sinaimg.cn/large/007S8ZIlly1gg7tazlvqmj30lt0ixwiz.jpg)
2、正确的截图
![img](https://tva1.sinaimg.cn/large/007S8ZIlly1gg7tc5zxvej30lv0jpjw6.jpg)

**python 版本:** `python3.7`

**poco 版本:** `1.0.79`
> poco版本通过`pip freeze`可以命令可以查到

**设备:**
- 型号: [e.g. 360 N7 lite]
- 系统: [e.g. Android 8.1]
- (别的信息)

**其他相关环境信息**
电脑是MacOS,暂无其他的电脑

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.