51Testing软件测试论坛
标题:
【seagull1985-QTP】测试过程屏幕截图保存
[打印本页]
作者:
seagull1985
时间:
2016-4-18 18:03
标题:
【seagull1985-QTP】测试过程屏幕截图保存
'==========================================================================
' NAME: User Login
' AUTHOR: heyl
' DATE : 2012-12-21
' COMMENT:
'==========================================================================
Class ScreenCaptureEngine
Public str_ScriptPath
Public oFSO
Private Sub Class_Initialize
str_ScriptPath = str_Test_Path&"Report\"
str_ScriptPath = str_ScriptPath&GetTestName
me.Createreporterfolder(str_ScriptPath)
End Sub
Private Sub Class_Terminate
Set oFSO = nothing
End Sub
'create a folder
Function Createreporterfolder(str_folderpath)
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(str_folderpath) Then
Set f = fso.CreateFolder(str_folderpath)
Set f = Nothing
Set fso = Nothing
Else
Set fso = Nothing
End If
End Function
Public Sub Report()
Dim sFile
Dim sTimeStamp
Set oFSO = createobject("Scripting.FileSystemObject")
sTimeStamp = CStr(Now)
sTimeStamp = Replace(sTimeStamp , "\", "")
sTimeStamp = Replace(sTimeStamp , "/", "")
sTimeStamp = Replace(sTimeStamp , ":", "")
sFile = str_ScriptPath
If Mid(sFile, Len(sFile),1) <> "\" Then sFile = sFile & "\"
sFile = sFile & " " & sTimeStamp & ".png"
While oFSO.FileExists(sFile)
sFile = Mid(sFile ,1,Len(sFile)-4) & "_1" & ".png"
Wend
Desktop.CaptureBitmap(sFile)
End Sub
End Class
Set oScreenCapture = new ScreenCaptureEngine
复制代码
作者:
赵佳乐SMILE
时间:
2016-4-19 09:15
棒棒哒
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2