⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 script.mts

📁 QTP实例源码(完整)
💻 MTS
字号:
Option Explicit 
'=================================================================
Dim  fso,file,filename,objTestLib,objmsgbox
Dim  UI_Flag,TrueOrFlase
'fetch filename form the global sheet
'filename = "c:\log.txt"
filename = DataTable.RawValue("filename",dtGlobalSheet)
'=================================================================
'create a new file system object to output information
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(filename,8,True)
Set objTestLib = createobject("TestLib.CLib")
'create a new sqamsgbox object
Set objmsgbox = CreateObject("SQAMsgbox.CMsgbox")
'=================================================================

Call objTestLib.printfile(file,2,"1 -- Script: Log in AA system ")
objmsgbox.SQAMsgbox "Part 1 -- Script: Log in AA system","AA Auto Test",3,0

Do while("True")
	TrueOrFlase = Browser("index:=0").Exist
	If(TrueOrFlase = "False") then
	    Exit do
	Else
		Browser("index:=0").close 
	End if
Loop

Call objTestLib.printfile(file,3,"1. log in AA system by using admin account")

'SystemUtil.Run "iexplore.exe","http://aa.achievo.com"
SystemUtil.Run "iexplore.exe","http://aa.beta.accela.com"

If Browser("Browser").Dialog("Security Alert").WinButton("Yes").Exist(15) Then
    Browser("Browser").Dialog("Security Alert").WinButton("Yes").Click @@ script infofile_;_ZIP::Security_Alert_ssf2.inf_;_hightlight id_;_11_;_
End if
Browser("Accela - Accela").Page("Accela - Accela").WebEdit("servProvCode").Set "Presidio" @@ script infofile_;_ZIP::servProvCode_ssf4.inf_;_hightlight id_;_Browser("Accela - Accela").Page("Accela - Accela").WebEdit("servProvCode")_;_NFB_;_10690_;_
Browser("Accela - Accela").Page("Accela - Accela").WebEdit("username").Set "admin" @@ script infofile_;_ZIP::username_ssf5.inf_;_hightlight id_;_Browser("Accela - Accela").Page("Accela - Accela").WebEdit("username")_;_NFB_;_10690_;_
Browser("Accela - Accela").Page("Accela - Accela").WebEdit("password").Set "testok"
Browser("Accela - Accela").Page("Accela - Accela").WebButton("Login").Click @@ script infofile_;_ZIP::Login_ssf6.inf_;_hightlight id_;_Browser("Accela - Accela").Page("Accela - Accela").WebButton("Login")_;_NFB_;_10690_;_
Browser("Accela Automation:").Page("Accela Automation:").Sync @@ script infofile_;_ZIP::Accela_Automation__ssf8.inf_;_hightlight id_;_Browser("Accela Automation:").Page("Accela Automation:")_;_NFB_;_10692_;_

If Browser("Accela Automation:").Page("Accela Automation:").Link("Logout").Exist(35) Then
    UI_Flag = 1
    Call objTestLib.printfile(file,4)
ElseIf Browser("Accela Automation:").Page("Accela Automation:").Image("tab_logout").Exist(10) Then
    UI_Flag = 0
    Call objTestLib.printfile(file,4)
Else
	Call objTestLib.printfile(file,5,"cannot find AA home page!")
	ExitRun(0)
End If
DataTable("UI_Flag",dtGlobalSheet) = UI_Flag

Call objTestLib.printfile(file,3,"2. Verify the back button after log in AA system")
Browser("Browser").Back
Browser("Accela Automation:").Page("Accela Automation:").Sync
If Browser("Accela Automation:").Page("Accela Automation:").Link("New App").Exist(10) then
   Call objTestLib.printfile(file,4)
Else
   Call objTestLib.printfile(file,5,"cannot find AA home page")
End If

Call objTestLib.printfile(file,3,"3. Verify the back button after log out AA system")
If UI_Flag=1 Then
    Browser("Accela Automation:").Page("Accela Automation:").Link("Logout").Click
Else
	Browser("Accela Automation:").Page("Accela Automation:").Image("tab_logout").Click @@ hightlight id_;_Browser("Accela Automation:").Page("Accela Automation:").Image("tab logout")_;_script infofile_;_ZIP::tab_logout_ssf9.inf_;_
End if
wait(5)
Browser("Browser").Back
If Browser("Accela Automation:").Page("Accela Automation:").Link("New App").Exist(10)=False then
   Call objTestLib.printfile(file,4)
   Browser("Accela - Accela").Page("Accela - Accela").WebEdit("servProvCode").Set "Presidio" 
   Browser("Accela - Accela").Page("Accela - Accela").WebEdit("username").Set "admin" @@ script infofile_;_ZIP::username_ssf5.inf_;_hightlight id_;_Browser("Accela - Accela").Page("Accela - Accela").WebEdit("username")_;_NFB_;_10690_;_
   Browser("Accela - Accela").Page("Accela - Accela").WebEdit("password").Set "testok"
   Browser("Accela - Accela").Page("Accela - Accela").WebButton("Login").Click 
Else
   Call objTestLib.printfile(file,5,"cannot find AA login page")
End if

Browser("Accela Automation:").Page("Accela Automation:").Sync

'===========================================
Call objTestLib.printfile(file,6)

Set objmsgbox = nothing
Set objTestLib = nothing
Set fso = nothing
Set file = nothing

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -