script.mts

来自「QTP实例源码(完整)」· MTS 代码 · 共 782 行 · 第 1/5 页

MTS
782
字号
		Else
			Call objTestLib.printfile(file,5,"cannnot find the new structure!")
		End If
	Else
		Browser("Browser_2").Page("Page").Image("close window").Click @@ script infofile_;_ZIP::Page_ssf113.inf_;_hightlight id_;_Browser("Browser_2").Page("Page")_;_NFB_;_1271210_;_
		Call objTestLib.printfile(file,3,"      ---None, cannot find any structure!")
	End If
End Function

Function DeleteStructure ()
	'b. delete the new added structure
	Call objTestLib.printfile(file,3,"        b. delete the new added structure") @@ script infofile_;_ZIP::Delete_Structure_ssf180.inf_;_hightlight id_;_Browser("Accela Automation: 22").Page("Accela Automation: 2").Image("Delete Structure")_;_NFB_;_1431270_;_
	Browser("Accela Automation:_22").Page("Accela Automation:_2").Image("Delete Structure").Click
	Browser("Accela Automation:_22").Dialog("Microsoft Internet").WinButton("OK").Click @@ script infofile_;_ZIP::Microsoft_Internet_Explorer_ssf181.inf_;_hightlight id_;_2_;_
	wait(5)
	If Browser("Accela Automation:_22").Page("Accela Automation:").Image("Add new Structure").Exist Then @@ script infofile_;_ZIP::Accela_Automation__2_ssf182.inf_;_hightlight id_;_Browser("Accela Automation:_22").Page("Accela Automation:_2")_;_NFB_;_1431272_;_
		strInnerText = Browser("Accela Automation:_22").Page("Accela Automation:_2").WebTable("Name").GetROProperty("innertext")
		If instr(strInnerText,strTemp)=0 Then
			Call objTestLib.printfile(file,4)
		Else
			Call objTestLib.printfile(file,5,"the new structure still exist!")
		End If
	Elseif Browser("Accela Automation:_22").Dialog("Microsoft Internet").WinButton("OK").Exist Then
		strMessage = Browser("Accela Automation:_22").Dialog("Microsoft Internet").Static("Warnning").GetROProperty("text")
		Browser("Accela Automation:_22").Dialog("Microsoft Internet").WinButton("OK").Click
		Call objTestLib.printfile(file,5,"updated the Contact failed, the error message is " & strMessage)
	Else
		Call objTestLib.printfile(file,5,"there occurs an unexpected error!")
		Browser("Accela Automation:").back
	End If
End Function

'Browser("Accela Automation:_22").Page("Accela Automation:").Image("tab_menu").Click @@ script infofile_;_ZIP::Add_new_Structure_ssf111.inf_;_hightlight id_;_Browser("Accela Automation: 22").Page("Accela Automation:").Image("Add new Structure")_;_NFB_;_1261208_;_
Browser("Accela Automation:").Page("Accela Automation:").Image("tab_menu").Click

'=====18. Licensed People
Call objTestLib.printfile(file,3,"   18. Licensed People")
objmsgbox.SQAMsgbox "18. Licensed People","AA Auto Test",3,0
Browser("Accela Automation:").Page("Accela Automation:").Link("Licensed").Click @@ script infofile_;_ZIP::Licensed_ssf114.inf_;_hightlight id_;_Browser("Accela Automation:").Page("Accela Automation:").Link("Licensed")_;_NFB_;_1281211_;_
Call AddPeople ()
If Err_Flag=False Then
   call DeletePeople()
End If

Function AddPeople ()
	Err_Flag = True
	'a. Add a Licensed People
	Call objTestLib.printfile(file,3,"        a. Add a Licensed People")
	'(1) search an existed Licensed People
	Call objTestLib.printfile(file,3,"        (1) search an existed Licensed People")
	Browser("Accela Automation:_23").Page("Accela Automation:").Image("Add new Licensed").Click @@ script infofile_;_ZIP::Add_new_Licensed_ssf115.inf_;_hightlight id_;_Browser("Accela Automation: 23").Page("Accela Automation:").Image("Add new Licensed")_;_NFB_;_1281212_;_
	Browser("Accela Automation:_24").Page("Accela Automation:").Image("Search for Licensed").Click @@ script infofile_;_ZIP::Search_for_Licensed_ssf116.inf_;_hightlight id_;_Browser("Accela Automation: 24").Page("Accela Automation:").Image("Search for Licensed")_;_NFB_;_1281213_;_
	Browser("Accela Automation:_25").Page("Accela Automation:").Image("Search").Click 44,11 @@ script infofile_;_ZIP::Search_ssf117.inf_;_hightlight id_;_Browser("Accela Automation: 25").Page("Accela Automation:").Image("Search")_;_NFB_;_1291215_;_
	Browser("Accela Automation:_26").Page("Accela Automation:").Image("Select Licensed").Click @@ script infofile_;_ZIP::Select_Licensed_ssf118.inf_;_hightlight id_;_Browser("Accela Automation: 26").Page("Accela Automation:").Image("Select Licensed")_;_NFB_;_1291216_;_
	wait(5)
	strTemp = Browser("Accela Automation:_24").Page("Accela Automation:_2").WebEdit("CAEB1_LICENSE_NBR").GetROProperty("value")
	If len(strTemp) <> 0 Then
        Call objTestLib.printfile(file,4)
	Else
		Call objTestLib.printfile(file,5,"cannot search any licensed people!")
	End If
	'(2) modify the Licensed number and submit
	Call objTestLib.printfile(file,3,"        (2) modify the Licensed number and submit")
	Browser("Accela Automation:_24").Page("Accela Automation:_2").WebEdit("CAEB1_LICENSE_NBR").Set "Agency Testing" @@ script infofile_;_ZIP::CAEB1_LICENSE_NBR_ssf119.inf_;_hightlight id_;_Browser("Accela Automation: 24").Page("Accela Automation: 2").WebEdit("CAEB1 LICENSE NBR")_;_NFB_;_1301218_;_
	Browser("Accela Automation:_24").Page("Accela Automation:").WebRadioGroup("CaeB1_PRINT_FLAG").Select "N" @@ script infofile_;_ZIP::CaeB1_PRINT_FLAG_ssf125.inf_;_hightlight id_;_Browser("Accela Automation: 24").Page("Accela Automation:").WebRadioGroup("CaeB1 PRINT FLAG")_;_NFB_;_1301224_;_
	Browser("Accela Automation:_24").Page("Accela Automation:_2").Image("Save").Click 33,10
	If Browser("Accela Automation:_23").Page("Accela Automation:").Image("Add new Licensed").Exist(5)=False Then
	   	Browser("Accela Automation:_37").Page("Accela Automation:").Image("Close window").Click @@ script infofile_;_ZIP::Close_window_ssf186.inf_;_hightlight id_;_Browser("Accela Automation: 37").Page("Accela Automation:").Image("Close window")_;_NFB_;_1581314_;_
	End If
	If Browser("Accela Automation:_23").Page("Accela Automation:").Image("Add new Licensed").Exist Then
		If Browser("Accela Automation:_23").Page("Accela Automation:").Link("Agency Testing").Exist Then
    	    Err_Flag = False
			Call objTestLib.printfile(file,4)
		Else
			Call objTestLib.printfile(file,5,"cannot find the new Licensed professional")
		End If
	Else
		Call objTestLib.printfile(file,5,"there occurs an unexpected error!")
		Browser("Accela Automation:").back
	End If
End Function

Function DeletePeople ()
	'b. delete the new added Licensed professional
	Call objTestLib.printfile(file,3,"        b. delete the new added Licensed professional")
	Browser("Accela Automation:_23").Page("Accela Automation:").Image("Delete Licensed").Click @@ script infofile_;_ZIP::Delete_Licensed_ssf121.inf_;_hightlight id_;_Browser("Accela Automation: 23").Page("Accela Automation:").Image("Delete Licensed")_;_NFB_;_1301220_;_
	Browser("Accela Automation:_23").Dialog("Microsoft Internet").WinButton("OK").Click @@ script infofile_;_ZIP::Microsoft_Internet_Explorer_ssf122.inf_;_hightlight id_;_2_;_
	wait(5)
	If Browser("Accela Automation:_23").Page("Accela Automation:").Image("Add new Licensed").Exist Then
		If Browser("Accela Automation:_23").Page("Accela Automation:").Link("Agency Testing").Exist=False Then
		    Call objTestLib.printfile(file,4)
		Else
			Call objTestLib.printfile(file,5,"the new Licensed professional still exists!")
		End If
	Elseif Browser("Accela Automation:_23").Dialog("Microsoft Internet").WinButton("OK").Exist Then
		strMessage = Browser("Accela Automation:_23").Dialog("Microsoft Internet").Static("Warnning").GetROProperty("text")
		Browser("Accela Automation:_23").Dialog("Microsoft Internet").WinButton("OK").Click
		Call objTestLib.printfile(file,5,"updated the Contact failed, the error message is " & strMessage)
	Else
		Call objTestLib.printfile(file,5,"there occurs an unexpected error!")
		Browser("Accela Automation:").back
	End If
End Function

'Browser("Accela Automation:_23").Page("Accela Automation:").Image("tab_menu").Click @@ script infofile_;_ZIP::tab_menu_ssf123.inf_;_hightlight id_;_Browser("Accela Automation: 23").Page("Accela Automation:").Image("tab menu")_;_NFB_;_1301222_;_
Browser("Accela Automation:").Page("Accela Automation:").Image("tab_menu").Click @@ script infofile_;_ZIP::Accela_Automation__ssf124.inf_;_hightlight id_;_Browser("Accela Automation:").Page("Accela Automation:")_;_NFB_;_1301223_;_

'=====19. Contact
Call objTestLib.printfile(file,3,"   19. Contact")
objmsgbox.SQAMsgbox "19. Contact","AA Auto Test",3,0
Browser("Accela Automation:").Page("Accela Automation:").Link("Contact").Click @@ script infofile_;_ZIP::Contact_ssf126.inf_;_hightlight id_;_Browser("Accela Automation:").Page("Accela Automation:").Link("Contact")_;_NFB_;_1301225_;_
Call AddContact()
If Err_Flag=False Then
   Call DeleteContact()
End If

Function AddContact ()
	Err_Flag = True
	'a. Add a Contact
	Call objTestLib.printfile(file,3,"        a. Add a Contact")
	'(1) search an existed Contact
	Call objTestLib.printfile(file,3,"        (1) search an existed Contact")
	Browser("Accela Automation:_27").Page("Accela Automation:").Image("Add new Contact").Click @@ script infofile_;_ZIP::Add_new_Contact_ssf127.inf_;_hightlight id_;_Browser("Accela Automation: 27").Page("Accela Automation:").Image("Add new Contact")_;_NFB_;_1301226_;_
	Browser("Accela Automation:_28").Page("Accela Automation:").Image("Copy Contact").Click @@ script infofile_;_ZIP::Copy_Contact_ssf128.inf_;_hightlight id_;_Browser("Accela Automation: 28").Page("Accela Automation:").Image("Copy Contact")_;_NFB_;_1301227_;_
	Browser("Accela Automation:_29").Page("Accela Automation:").WebList("CNT_TYPE").Select "#0" @@ script infofile_;_ZIP::CNT_TYPE_ssf129.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation:").WebList("CNT TYPE")_;_NFB_;_1311228_;_
	Browser("Accela Automation:_29").Page("Accela Automation:").Image("Submit").Click 33,0 @@ script infofile_;_ZIP::Submit_ssf130.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation:").Image("Submit")_;_NFB_;_1311228_;_
	Browser("Accela Automation:_30").Page("Accela Automation:").Image("Select Contact").Click @@ script infofile_;_ZIP::Select_Contact_ssf131.inf_;_hightlight id_;_Browser("Accela Automation: 30").Page("Accela Automation:").Image("Select Contact")_;_NFB_;_1311229_;_
	wait(5)
	strTemp = Browser("Accela Automation:_28").Page("Accela Automation:_2").WebEdit("AppB1_FNAME").GetROProperty("value")
	If len(strTemp) <> 0 Then
        Call objTestLib.printfile(file,4)
	Else
		Call objTestLib.printfile(file,5,"search all contact failed!")
	End If
	'(2) modify the contact name and submit
	Call objTestLib.printfile(file,3,"        (2) modify the contact name and submit")
	Browser("Accela Automation:_28").Page("Accela Automation:_2").WebEdit("AppB1_FNAME").Set "Kiki" @@ script infofile_;_ZIP::AppB1_FNAME_ssf132.inf_;_hightlight id_;_Browser("Accela Automation: 28").Page("Accela Automation: 2").WebEdit("AppB1 FNAME")_;_NFB_;_1321231_;_
	Browser("Accela Automation:_28").Page("Accela Automation:_2").WebEdit("AppB1_LNAME").Set "Zhao" @@ script infofile_;_ZIP::AppB1_LNAME_ssf133.inf_;_hightlight id_;_Browser("Accela Automation: 28").Page("Accela Automation: 2").WebEdit("AppB1 LNAME")_;_NFB_;_1321231_;_
	wait(5)
	Browser("Accela Automation:_28").Page("Accela Automation:_2").Image("Save").Click 24,6 @@ script infofile_;_ZIP::Save_ssf134.inf_;_hightlight id_;_Browser("Accela Automation: 28").Page("Accela Automation: 2").Image("Save")_;_NFB_;_1321231_;_
	Browser("Accela Automation:_27").Page("Accela Automation:").Sync
	If Browser("Accela Automation:_27").Page("Accela Automation:").Image("Add new Contact").Exist(5) Then
		If Browser("Accela Automation:_27").Page("Accela Automation:_2").Link("Kiki Zhao").Exist Then
    	    Call objTestLib.printfile(file,4)
		Else
			Call objTestLib.printfile(file,5,"cannot find the new contact")
		End If
'	Elseif Browser("Accela Automation:_28").Dialog("Microsoft Internet").WinButton("OK").Exist Then
'		strMessage= Browser("Accela Automation:_28").Dialog("Microsoft Internet").Static("Warnning").GetROProperty("text")
'		Browser("Accela Automation:_28").Dialog("Microsoft Internet").WinButton("OK").Click
'		Call objTestLib.printfile(file,5,"updated the Contact failed, the error message is " & strMessage)
	Else
		Call objTestLib.printfile(file,5,"there occurs an unexpected error!")
		Browser("Accela Automation:").back
	End If
End Function

⌨️ 快捷键说明

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