【seagull1985-QTP】测试过程屏幕截图保存
'==========================================================================' NAME: User Login
' AUTHOR: heyl
' DATE: 2012-12-21
' COMMENT:
'==========================================================================
Class ScreenCaptureEngine
Public str_ScriptPath
PublicoFSO
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
棒棒哒
页:
[1]