【已解决】appium 报错 unable to capture screen

在调试安卓设备的时候出现这样的报错:

Matched W3C error code 'unable to capture screen' to UnableToCaptureScreen

[WD Proxy] Matched '/wd/hub/session/fe541bfa-6b17-4aad-a327-b4a688261ec6/window/current/size' to command name 'getWindowSize'

[WD Proxy] Proxying [GET /wd/hub/session/fe541bfa-6b17-4aad-a327-b4a688261ec6/window/current/size] to [GEThttp://127.0.0.1:8200/wd/hub/session/269e635c-10ef-48c8-8989-c2b408faccc2/window/current/size] with body: {}

[MJSONWP (fe541bfa)] Encountered internal error running command: io.appium.uiautomator2.common.exceptions.TakeScreenshotException: Failed to capture a screenshot. Does the current view have 'secure' flag set?

可以先试试 

adb shell screencap -p /sdcard/screen.png

看当前页面是否可以截图保存在手机的scard页面。如果可以先排除app本身的问题,如果用这个命令都没有截图保存在手机,那么有可能当前app本身的问题。

还有一种就是安卓手机当前页面如果有系统键盘的存在,也是会出现这种报错。(点击屏幕,把系统键盘隐藏在定位就搞定了)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。