gpt4 book ai didi

qtp - 如何使用QTP截取应用程序的屏幕截图?

转载 作者:行者123 更新时间:2023-12-02 21:24:34 28 4
gpt4 key购买 nike

我想在发生错误时截取应用程序的屏幕截图并将其保存在特定文件夹中。下面的代码可以工作,但它不会截取应用程序的屏幕截图,而是截取 QTP 代码屏幕的屏幕截图。

Function CaptureImage()
Dim Date_Time
Dim Myfile
Date_Time=Now()
Myfile= Date_Time&".png"
Myfile = Replace(Myfile,"/","-")
Myfile = Replace(Myfile,":","-")
Myfile= "C:\"&Myfile
Desktop.CaptureBitmap Myfile, True
End Function

最佳答案

Dim ScreenName

On Error Resume Next

ScreenName = " "

CurrentTime = "_Test_Case"&"_"& Day(Now)&"_"& Month(Now)&"_"& Year(Now)&"_"&

Hour(Now)&"_"& Minute(Now)&"_"& Second(Now)

ScreenShotName = "Name_of_the_Screen" & CurrentTime & ".png"

ScreenName ="Path where the Screenshot needs to be stored"&"\"&ScreenShotName

Desktop.CaptureBitmap ScreenName,True

这应该有效。

关于qtp - 如何使用QTP截取应用程序的屏幕截图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25443498/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com