AirtestProject / AirtestProject/Poco

pocoservice 进行截图时失败

Abierto
#539 1 comentario 0 reacciones 0 asignados Ver en GitHub
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**
我在代码里使用 `b64img, fmt = poco.snapshot(width=screen_size[1])` 进行截图时, 出现 hrpc.exceptions.RpcRemoteException 异常, 异常信息如下:

```
2022-04-12 20:03:22,766 - flybirds_log - WARNING - Traceback (most recent call last):
File "/usr/local/python3/lib/python3.7/site-packages/flybirds/core/plugin/plugins/default/screen.py", line 31, in screen_shot
b64img, fmt = poco.snapshot(width=screen_size[1])
File "/usr/local/python3/lib/python3.7/site-packages/poco/pocofw.py", line 433, in snapshot
return self.agent.screen.getScreen(width)
File "/usr/local/python3/lib/python3.7/site-packages/poco/drivers/android/uiautomation.py", line 75, in getScreen
b64img = self.screen.getScreen(width)
File "/usr/local/python3/lib/python3.7/site-packages/hrpc-1.0.9-py3.7.egg/hrpc/object_proxy.py", line 92, in __call__
return self._client__.evaluate(self.__call_no_evaluate__(remote_obj_cache, *args))
File "/usr/local/python3/lib/python3.7/site-packages/hrpc-1.0.9-py3.7.egg/hrpc/client.py", line 81, in evaluate
raise RpcRemoteException(resp)
hrpc.exceptions.RpcRemoteException: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getHeight()' on a null object reference

|-- Remote Traceback --|

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getHeight()' on a null object reference
at com.netease.open.pocoservice.Screen.getScreen(Screen.java:40)
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:920)

|-- Remote Traceback end --|

```

**复现步骤**
```
from poco.drivers.android.uiautomation import AndroidUiautomationPoco

poco = AndroidUiautomationPoco(
use_airtest_input=True, screenshot_each_action=False
)
screen_size=[1080, 1920]
b64img, fmt = poco.snapshot(width=screen_size[1])

```
**预期效果**
截图成功

**相关截图**
(贴出遇到问题时的截图内容,如果有的话)

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

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

**设备:**
- 型号: [谷歌原生模拟器]
- 系统: [ANDROID26(8.0)]
- (别的信息)

**其他相关环境信息**
(其他运行环境,例如在linux ubuntu16.04上运行异常,在windows上正常。)

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.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.