|
'以代码方式启动浏览器并打开登陆首页
Sub use_login()
Browser1 = "IE"
StartURL = "http://at2.mangocity.com/TMC/index.jsp"
If Browser1 = "IE" Then
Set IE = Createobject("InternetExplorer.Application")
IE.Visible = true
IE.Navigate = StrartURL
End If
End Sub
'创建一个日志文件
Function CreateLog(message)
Dim fso,filespec,filefolder,folder_path
Dim CurrentDate,CurrentTime
CurrentDate = Date
CurrentTime = Time
TestName = "Log"
Set fso = createobject("scripting.FileSystemObject")
'创建日志文件夹
If Not(fso.FolderExists("D:\LOG")) Then
Set filefolder = fso.createfolder("D:\LOG")
folder_path = filefolder.path
'msgbox(folder_path)
Set filefolder = Nothing
else
folder_path = "D:\LOG"
End If
'创建日志文件
filespec = folder_path&"\"&CurrentDate &TestName& ".txt"
If not(fso.FileExists(filespec)) Then
Set LogFile = fso.CreateTextFile(filespec, Forwriting, true)
LogFile.writeline("#######################################################################")
LogFile.writeline(CurrentDate & CurrentTime & "Test:" & environment.Value("TestName"))
LogFile.writeline("#######################################################################")
LogFile.close
Set LogFile = Nothing
else
Set LogFile = fso.OpenTextFile(filespec, ForAppending, False)
LogFile.writeline(CurrentDate & CurrentTime & " " & message)
LogFile.close
Set LogFile = Nothing
End If
Set fso = Nothing
End Function |
|