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

📄 script.mts

📁 QTP实例源码(完整)
💻 MTS
📖 第 1 页 / 共 5 页
字号:
Option Explicit
'=================================================================
Dim  fso,file,filename,objTestLib,objmsgbox,oDesc,Edits,WebCheckBoxs
Dim  strMessage,strTemp,strValue,strEditValue,strEditName,NumberOfEdits
Dim  strInnertext,intLoop,intFlag,Err_Flag,intNumber,intRowCount
Dim  arrExpectValue,arrOriginalValue(5),arrTempValue(5),strOriginalValue
Dim  strAppNumber1,strAppNumber2,strAppNumber3,strAppNumberTotal
Dim  strAddress,strStreetName,strParcel,strOwner,strLicensed,strBusiness,strInspName1,strInspName2
Dim  strFeeBalance,strPayAmount,strFee
'=================================================================
'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")
'=================================================================
Err_Flag = True
'=================================================================

'On Error Resume Next

Call objTestLib.printfile(file,2,"3 -- Script: Daily Activities")
objmsgbox.SQAMsgbox "Part 3 -- Script: Daily Activities","AA Auto Test",3,0

Browser("Accela Automation:").Page("Accela Automation:").Image("tab_menu").Click

'###############################Section 1:  Application #####################
Call objTestLib.printfile(file,3,"Section 1: Application ")
objmsgbox.SQAMsgbox "Section 1: Application","AA Auto Test",3,0
'=====1. New Application 
Call objTestLib.printfile(file,3,"   1. New Application ")
objmsgbox.SQAMsgbox "1. New Application","AA Auto Test",3,0
Browser("Accela Automation:").Page("Accela Automation:").Link("New App").Click
'a.click on different folders,click on different items, click on submit to create the application
Call objTestLib.printfile(file,3,"      a.click on different folders,click on different items, click on submit to create the application")
Browser("Accela Automation:").Page("Accela Automation:").Link("New App").Click
Call SelectAppType("Building","New Building","Residential","Main Post")
If Err_Flag=False Then
	Call VerifyNewAppWindow("Building","New Building","Residential","Main Post")
		'b.Test the search button in address section
		Call objTestLib.printfile(file,3,"      b.Test the search button in address section")
		Call SearchAddress()
		'c.Test the Get Parcel & Owner button
		Call objTestLib.printfile(file,3,"      c.Test the Get Parcel & Owner button")
		Call GetParcelAndOwner()
		'd.Test the get address & owner button in parcel section
		Call objTestLib.printfile(file,3,"      d. Test the get address & owner button in parcel section")
		Call GetAddressAndOwner()
		'e.Test the search button in parcel section
		Call objTestLib.printfile(file,3,"      e.Test the search button in parcel section")
		Call SearchParcel()
		'f.Test the search button in Licensed Professional Information section
		Call objTestLib.printfile(file,3,"      f.Test the search button in Licensed Professional Information section")
		Call SearchLicensed()
		'g.Test the As Lic. Prof button in Applicant Information section
		Call objTestLib.printfile(file,3,"      g.Test the As Lic. Prof button in Applicant Information section")
		Call AsLif()
		'h.Test the search button in Applicant Information section
		Call objTestLib.printfile(file,3,"      h.Test the search button in Applicant Information section")
		Call SearchApplicant()
		'i. fill in other additional information and submit
		Call objTestLib.printfile(file,3,"      i. fill in other additional information and submit")
		Call FillInSubmit()
		'j.Verify new application details info
		Call objTestLib.printfile(file,3,"      j.Verify new application details info")
		Call VerifySummary()
End If

Function SelectAppType (strFirstLink,strSecondLink,strThirdLink,strFourthLink)
	Err_Flag = True @@ script infofile_;_ZIP::Building_ssf2.inf_;_hightlight id_;_Browser("Accela Automation: 2").Page("Accela Automation:").Frame("toc").Link("Building")_;_NFB_;_560955_;_
	wait(10)
	Browser("Accela Automation:_2").Page("Accela Automation:").Frame("toc").Link("First_Link").SetTOProperty "text",strFirstLink
	Browser("Accela Automation:_2").Page("Accela Automation:").Frame("toc").Link("First_Link").Click
	Browser("Accela Automation:_2").Page("Accela Automation:").Frame("toc").Link("Second_Link").SetTOProperty "text",strSecondLink
	Browser("Accela Automation:_2").Page("Accela Automation:").Frame("toc").Link("Second_Link").Click @@ script infofile_;_ZIP::Repairs_ssf3.inf_;_hightlight id_;_Browser("Accela Automation: 2").Page("Accela Automation:").Frame("toc").Link("Repairs")_;_NFB_;_560955_;_
	Browser("Accela Automation:_2").Page("Accela Automation:").Frame("toc").Link("Third_Link").SetTOProperty "text",strThirdLink
	Browser("Accela Automation:_2").Page("Accela Automation:").Frame("toc").Link("Third_Link").Click @@ script infofile_;_ZIP::Cultural_ssf4.inf_;_hightlight id_;_Browser("Accela Automation: 2").Page("Accela Automation:").Frame("toc").Link("Cultural")_;_NFB_;_560955_;_
	Browser("Accela Automation:_2").Page("Accela Automation:").Frame("toc").Link("Fourth_Link").SetTOProperty "text",strFourthLink
	Browser("Accela Automation:_2").Page("Accela Automation:").Frame("toc").Link("Fourth_Link").Click @@ script infofile_;_ZIP::Crissy_Field_ssf5.inf_;_hightlight id_;_Browser("Accela Automation: 2").Page("Accela Automation:").Frame("toc").Link("Crissy Field")_;_NFB_;_560955_;_
	Browser("Accela Automation:_2").Page("Accela Automation:").Frame("content").Image("Submit").Click @@ script infofile_;_ZIP::Submit_ssf6.inf_;_hightlight id_;_Browser("Accela Automation: 2").Page("Accela Automation:").Frame("content").Image("Submit")_;_NFB_;_560955_;_
	If Browser("Accela Automation:_2").Dialog("Microsoft Internet").WinButton("OK").Exist(5)=False Then
	    Err_Flag = False
	Else
		strMessage = Browser("Accela Automation:_2").Dialog("Microsoft Internet").Static("Warnning").GetROProperty("text")
		Browser("Accela Automation:_2").Dialog("Microsoft Internet").WinButton("OK").Click @@ script infofile_;_ZIP::Microsoft_Internet_Explorer_ssf229.inf_;_hightlight id_;_2_;_
		Call objTestLib.printfile(file,5,"updated the Contact failed, the error message is " & strMessage)
	End If
End Function

Function VerifyNewAppWindow (strFirstLink,strSecondLink,strThirdLink,strFourthLink)
	 Dim  p_strResult1,p_strResult2,p_const1,p_const2
	 p_const1 = "New Application"
	 p_const2 = strFirstLink & " / " & strSecondLink & " / " & strThirdLink & " / " & strFourthLink
	 p_strResult1 = Browser("Accela Automation:_3").Page("Accela Automation:").WebTable("New Application").GetCellData(1,2)
	 p_strResult2 = Browser("Accela Automation:_3").Page("Accela Automation:").WebTable("Application_Type").GetCellData(1,1)
	 If instr(p_strResult1,p_const1) <> 0 And instr(p_strResult2,p_const2) <> 0 Then
	 	objmsgbox.SQAMsgbox "The Heading is " & p_const1 & " ." & chr(13) & "The app Type is " & p_const2 & " . ","AA Auto Test",3,0
		Call objTestLib.printfile(file,4)
	 Else
	 	objmsgbox.SQAMsgbox "The Heading is " & p_const1 & " ." & chr(13) & "The app Type is " & p_const2 & " . ","AA Auto Test",3,0
		Call objTestLib.printfile(file,5,"Cannot find application type")
	 End If
End Function

Function SearchAddress ()
	Browser("Accela Automation:_3").Page("Accela Automation:").Image("Search for Address").Click @@ script infofile_;_ZIP::Search_for_Address_ssf14.inf_;_hightlight id_;_Browser("Accela Automation: 3").Page("Accela Automation:").Image("Search for Address")_;_NFB_;_590961_;_
	Browser("Accela Automation:_4").Page("Accela Automation:").Image("Submit").Click 33,8 @@ script infofile_;_ZIP::Submit_ssf15.inf_;_hightlight id_;_Browser("Accela Automation: 4").Page("Accela Automation:").Image("Submit")_;_NFB_;_600963_;_
	intRowCount = Browser("Accela Automation:_5").Page("Accela Automation:").WebTable("Address").RowCount
	If intRowCount=2 Then
	    Call objTestLib.printfile(file,5,"None owner information exists in owner table!")
		Browser("Accela Automation:_5").Page("Accela Automation:").Image("Cancel").Click
'		Browser("Accela Automation:_3").Page("Accela Automation:").WebEdit("AdrFullAddr").Set "Agency Testing"
	Elseif intRowCount > 2 Then
	   strAddress = Browser("Accela Automation:_5").Page("Accela Automation:").WebTable("Address").GetCellData(3,1)
	   Browser("Accela Automation:_5").Page("Accela Automation:").Image("Selbtn").Click @@ script infofile_;_ZIP::Selbtn_ssf16.inf_;_hightlight id_;_Browser("Accela Automation: 5").Page("Accela Automation:").Image("Selbtn")_;_NFB_;_600964_;_
	   wait(5)
	   Call VerifyAddress(Ucase(strAddress))
	Else
	   Call objTestLib.printfile(file,5,"cannot find Address table!")
	End If
End Function

Function VerifyAddress (strAddress)
	 Dim  p_strStreetName
	 p_strStreetName = Browser("Accela Automation:_3").Page("Accela Automation:").WebEdit("AdrFullAddr").GetROProperty("value")
	 If len(p_strStreetName) <> 0 Then
	 	If instr(strAddress,p_strStreetName) <> 0 Then
		    Call objTestLib.printfile(file,4)
		Else
			Call objTestLib.printfile(file,5,"The street number and name displayed incorrectly!")
		End If
	 Else
	 	Call objTestLib.printfile(file,5,"Get address inforamtion failed!")
	 End If
End Function

Function GetParcelAndOwner ()
	Browser("Accela Automation:_3").Page("Accela Automation:").Image("Get Parcel and").Click @@ script infofile_;_ZIP::Get_Parcel_and_ssf17.inf_;_hightlight id_;_Browser("Accela Automation: 3").Page("Accela Automation:").Image("Get Parcel and")_;_NFB_;_610965_;_
	wait(5)
	strParcel = Browser("Accela Automation:_3").Page("Accela Automation:").WebEdit("vParB1_PARCEL_NBR").GetROProperty("value")
	If len(strParcel) > 0 Then
        Call objTestLib.printfile(file,4)
	Else
		Call objTestLib.printfile(file,5,"Get parcel and owner inforamtion failed!")
	End If
End Function

Function GetAddressAndOwner ()
	Browser("Accela Automation:_3").Page("Accela Automation:").Image("Get Address").Click @@ script infofile_;_ZIP::Get_Address_ssf21.inf_;_hightlight id_;_Browser("Accela Automation: 3").Page("Accela Automation:").Image("Get Address")_;_NFB_;_640969_;_
	if Browser("Browser_6").Dialog("Microsoft Internet").WinButton("OK").Exist(5) then
	   Broser("Browser_6").Dialog("Microsoft Internet").WinButton("OK").Click @@ script infofile_;_ZIP::Microsoft_Internet_Explorer_ssf248.inf_;_hightlight id_;_2_;_
    else
	    wait(5)
	   	strStreetName = Browser("Accela Automation:_3").Page("Accela Automation:").WebEdit("AdrFullAddr").GetROProperty("value")
		If len(strStreetName) <> 0 Then

⌨️ 快捷键说明

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