openatx / uiautomator2

Android Uiautomator2 Python Wrapper
MIT License
6.25k stars 1.36k forks source link

screenshot截图函数http读取失败返回:screencap: exit status 1 #769

Closed swordsoky closed 1 week ago

swordsoky commented 2 years ago

截图函数: def screenshot(self, filename: Optional[str] = None, format="pillow"):
r = self.http.get("/screenshot/0", timeout=10)

调试:r返回的text属性中的值为:screencap: exit status 1 正常情况下应该是图片数据, 我们是做手机方案的,有的版本是好的,有的存在这个问题,有的开始是好的后来存在这个问题, 请问怎么解决?
或者怎么在手机端定位这个问题? ATX有对应的log?

codeskyblue commented 2 years ago

这个可能跟你截图的界面有关系,比如登录界面,截图的时候就会失败

swordsoky commented 2 years ago

这个可能跟你截图的界面有关系,比如登录界面,截图的时候就会失败

应该没关系,此问题出现后,任何界面都无法截图,重启手机也是同样。 只有重新烧录手机版本才能解决此问题,也不是100%解决,还有一定概率重新烧录后也无法截图。 请问怎么通过ATX log查看更详细的异常信息?

mingyuan-xia commented 1 year ago

/sdcard/atx-agent.log

h1code2 commented 5 months ago

这个问题是否有解决方法,最近我也遇到了, def screenshot(self, filename: Optional[str] = None, format="pillow"): r = self.http.get("/screenshot/0", timeout=10) 调试:r返回的text属性中的值为:screencap: exit status 1

以下是:/sdcard/atx-agent.log内容(我删除了重复的level=info msg="startservice com.github.uiautomator/.Service" 内容): time="2024-02-06T06:17:59Z" level=info msg="atx-agent version 0.10.0\n" time="2024-02-06T06:18:00Z" level=info msg="killProcessByName apk-agent.cli" time="2024-02-06T06:18:00Z" level=info msg="[minitouch] Args: [/data/local/tmp/minitouch]" time="2024-02-06T06:18:00Z" level=info msg="[minitouch] args: [/system/bin/sh -c /data/local/tmp/minitouch], env: []" time="2024-02-06T06:18:00Z" level=info msg="[minitouch] program pid: 7642" time="2024-02-06T06:18:00Z" level=info msg="ArgsFunc error: exit status 1" time="2024-02-06T06:18:00Z" level=info msg="[apkagent] program finished" time="2024-02-06T06:18:01Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-06T06:18:01Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-06T06:18:02Z" level=info msg="[uiautomator] program pid: 7689" time="2024-02-06T06:18:05Z" level=info msg="[uiautomator] idle for 500ms" time="2024-02-06T06:18:05Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-06T06:18:05Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-06T06:18:05Z" level=info msg="[uiautomator] program pid: 7784" time="2024-02-06T06:23:07Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-06T13:08:13Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-06T13:11:54Z" level=info msg="uiautomator has not activity for 3 minutes, closed" time="2024-02-06T13:11:54Z" level=info msg="[uiautomator] program finished" time="2024-02-06T13:13:13Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-07T01:03:24Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-07T01:05:42Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-07T01:05:42Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-07T01:05:42Z" level=info msg="[uiautomator] program pid: 21740" time="2024-02-07T01:05:50Z" level=info msg="[uiautomator] idle for 500ms" time="2024-02-07T01:05:50Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-07T01:05:50Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-07T01:05:50Z" level=info msg="[uiautomator] program pid: 21834" time="2024-02-07T01:08:24Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-07T08:58:31Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-07T09:01:55Z" level=info msg="uiautomator has not activity for 3 minutes, closed" time="2024-02-07T09:01:55Z" level=info msg="[uiautomator] program finished" time="2024-02-07T09:03:31Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-08T06:03:50Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-08T06:04:29Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-08T06:04:29Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-08T06:04:29Z" level=info msg="[uiautomator] program pid: 1501" time="2024-02-08T06:04:32Z" level=info msg="[uiautomator] idle for 500ms" time="2024-02-08T06:04:33Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-08T06:04:33Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-08T06:04:33Z" level=info msg="[uiautomator] program pid: 1576" time="2024-02-08T06:09:35Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-08T07:44:36Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-18T06:37:10Z" level=info msg="atx-agent version 0.10.0\n" time="2024-02-18T06:37:10Z" level=info msg="killProcessByName apk-agent.cli" time="2024-02-18T06:37:10Z" level=info msg="[minitouch] Args: [/data/local/tmp/minitouch]" time="2024-02-18T06:37:10Z" level=info msg="[minitouch] args: [/system/bin/sh -c /data/local/tmp/minitouch], env: []" time="2024-02-18T06:37:10Z" level=info msg="[minitouch] program pid: 31284" time="2024-02-18T06:37:10Z" level=info msg="[apkagent] Args: [CLASSPATH=/data/app/com.github.uiautomator-a_Trggbq7SkaU5rkgrcCBA==/base.apk exec app_process /system/bin com.github.uiautomator.Console]" time="2024-02-18T06:37:10Z" level=info msg="[apkagent] args: [/system/bin/sh -c CLASSPATH=/data/app/com.github.uiautomator-a_Trggbq7SkaU5rkgrcCBA==/base.apk exec app_process /system/bin com.github.uiautomator.Console], env: []" time="2024-02-18T06:37:10Z" level=info msg="[apkagent] program pid: 31290" time="2024-02-18T06:37:11Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-18T06:37:11Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-18T06:37:11Z" level=info msg="[uiautomator] program pid: 31307" time="2024-02-18T06:37:12Z" level=info msg="cmd args: [/data/local/tmp/minicap -S -P 1080x1920@800x800/0]" time="2024-02-18T06:37:12Z" level=info msg="Rotation --> 0" time="2024-02-18T06:37:14Z" level=info msg="[uiautomator] idle for 500ms" time="2024-02-18T06:37:14Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-18T06:37:14Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-18T06:37:14Z" level=info msg="[uiautomator] program pid: 31400" time="2024-02-18T06:42:16Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-18T06:47:16Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-18T06:52:16Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-18T06:57:52Z" level=info msg="atx-agent version 0.10.0\n" time="2024-02-18T06:57:52Z" level=info msg="killProcessByName apk-agent.cli" time="2024-02-18T06:57:52Z" level=info msg="[minitouch] Args: [/data/local/tmp/minitouch]" time="2024-02-18T06:57:52Z" level=info msg="[minitouch] args: [/system/bin/sh -c /data/local/tmp/minitouch], env: []" time="2024-02-18T06:57:52Z" level=info msg="[minitouch] program pid: 2304" time="2024-02-18T06:57:52Z" level=info msg="[apkagent] Args: [CLASSPATH=/data/app/com.github.uiautomator-a_Trggbq7SkaU5rkgrcCBA==/base.apk exec app_process /system/bin com.github.uiautomator.Console]" time="2024-02-18T06:57:52Z" level=info msg="[apkagent] args: [/system/bin/sh -c CLASSPATH=/data/app/com.github.uiautomator-a_Trggbq7SkaU5rkgrcCBA==/base.apk exec app_process /system/bin com.github.uiautomator.Console], env: []" time="2024-02-18T06:57:52Z" level=info msg="[apkagent] program pid: 2309" time="2024-02-18T06:57:52Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-18T06:57:52Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-18T06:57:52Z" level=info msg="[uiautomator] program pid: 2330" time="2024-02-18T06:57:54Z" level=info msg="cmd args: [/data/local/tmp/minicap -S -P 1080x1920@800x800/0]" time="2024-02-18T06:57:54Z" level=info msg="Rotation --> 0" time="2024-02-18T06:57:55Z" level=info msg="[uiautomator] idle for 500ms" time="2024-02-18T06:57:56Z" level=info msg="[uiautomator] Args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner]" time="2024-02-18T06:57:56Z" level=info msg="[uiautomator] args: [am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner], env: []" time="2024-02-18T06:57:56Z" level=info msg="[uiautomator] program pid: 2438" time="2024-02-18T07:02:58Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-18T07:07:58Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-18T07:12:58Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-18T07:17:58Z" level=info msg="startservice com.github.uiautomator/.Service" time="2024-02-18T07:22:58Z" level=info msg="startservice com.github.uiautomator/.Service"

codeskyblue commented 1 week ago

已修改为uiautomator2截图