|
3#
楼主 |
发表于 2011-1-18 09:37:36
|
只看该作者
这个是我的代码,麻烦大家帮忙看一下!
问题一:不能在发生错误的时候截图。该怎么修改?
问题二:怎么修改才能对于程序错误和脚本错误都记录下来?
Function RecoverFunctions(Object,Method,Argument,retVal)
Dim objFSO
Dim strDesktopFolder
Dim objFolder
Dim PathWay
Dim FileName
Dim TimeStamp
Dim WshShell
Dim strStepinfo
Dim strDetails
Dim CheckFolderExists
strDesktopFolder ="C:\ErrorScreenCapture"
Set objFSO=CreateObject ("Scripting.FileSystemObject")
CheckFolderExists =objFSO.FolderExists(strDesktopFolder)
If CheckFolderExists=True Then
Set objFolder=objFSO.GetFolder(strDesktopFolder)
else CreateFolderDemo strDesktopFolder
End If
PathWay="C:\ErrorScreenCapture"
TimeStamp=year(now) & month(now) & day(now) & hour(now) & minute(now)
msgbox TimeStamp
FileName=PathWay&TimeStamp&".bmp"
msgbox FileName
Desktop.CaptureBitmap FileName
reporter.Filter=0
reporter.ReportEvent 1,"测试失败","将error截图保存下来"
reporter.Filter=3
On Error Resume Next
Err.Raise
strStepinfo="T发生非预期错误,测试退出"
strDetails = "错误编号:" & CStr(Err.Number) & ",错误描述:" & Err.Description
reporter.Filter = 0
Reporter.ReportEvent micFail, strStepInfo, " " & Arguments(0) & " 出现错误,错误编号:" & retVal
reporter.Filter = 3
Err.clear
On Error GoTo 0
'End Function
Function CreateFolderDemo(sFlodername)
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateFolder(strDesktopFolder)
End Function |
|