AirtestProject / AirtestProject/Poco

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

Offen
#396 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
2k
Forks
341
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

**(重要!问题分类)**
* 图像识别相关问题 -> 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,暂无其他的电脑

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.