Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows下,连接到一些程序时,使用句柄截图时只能截取特定的图片,导致所有涉及截图操作的功能都失效 #981

Open
Hzbeta opened this issue Nov 5, 2021 · 0 comments

Comments

@Hzbeta
Copy link

Hzbeta commented Nov 5, 2021

描述问题bug
win平台连接到一些程序,使用窗口句柄调用截图时,只能截取到该程序最初的图片,程序窗口的画面改变后,还是只能截到程序最初的画面,导致依赖截图操作的功能都失效了。此bug有几率复现,尚不清楚原因。

看了源码发现win下有两种截图方式,一种是用句柄只截目标窗口,一种是全屏截图后裁剪,前一种有几率失效,我现在手动修改了一下源码,强制使用第二种方式,目前工作正常。

#if self.handle:
if False:   #这里强制用第二种方法
    screen = screenshot(filename, self.handle)
else:
    screen = screenshot(filename)
    #下面是裁剪操作,这里省略

预期效果
希望可以添加一个自定义设置screenshot_mode,这样在遇到使用第一章方式失败的程序时,可以手动选择第二种方式。

python 版本: python3.9

airtest 版本: 1.2.3

设备:

  • 系统: [win10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant