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

📄 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,Run_Flag,intNumber,intNumber
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)
'=================================================================
'Retrieve the run flag no.
Run_Flag = DataTable.RawValue("Run_Flag",dtGlobalSheet)
If Run_Flag="1" Then
   ExitAction(0)
End If
'=================================================================
'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:").Link("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
wait(4)
Browser("Accela Automation:").Page("Accela Automation:").Link("New App").Click @@ script infofile_;_ZIP::New_App_ssf1.inf_;_hightlight id_;_Browser("Accela Automation:").Page("Accela Automation:").Link("New App")_;_NFB_;_522203_;_
'a.click on several of the links and make sure they work
Call objTestLib.printfile(file,3,"      a.click on several of the links and make sure they work")
Call SelectAppType("Building","Electrical Permit","Residential","New")
Call VerifyNewAppWindow("Building","Electrical Permit","Residential","New")

'Browser("Accela Automation:_3").Page("Accela Automation:").Link("Menu").Click @@ script infofile_;_ZIP::Menu_ssf7.inf_;_hightlight id_;_Browser("Accela Automation: 3").Page("Accela Automation:").Link("Menu")_;_NFB_;_542206_;_
Browser("Accela Automation:").Page("Accela Automation:").Link("Menu").Click
Browser("Accela Automation:").Page("Accela Automation:").Link("New App").Click @@ script infofile_;_ZIP::New_App_ssf8.inf_;_hightlight id_;_Browser("Accela Automation:").Page("Accela Automation:").Link("New App")_;_NFB_;_542206_;_

'b.click on different folders,click on different items, click on submit to create the application
Call objTestLib.printfile(file,3,"      b.click on different folders,click on different items, click on submit to create the application")
Call SelectAppType("Building","Building Permit","Residential","New Single Family")
Call VerifyNewAppWindow("Building","Building Permit","Residential","New Single Family")

Function SelectAppType (strFirstLink,strSecondLink,strThirdLink,strFourthLink)
		 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 @@ script infofile_;_ZIP::Building_ssf2.inf_;_hightlight id_;_Browser("Accela Automation: 2").Page("Accela Automation:").Frame("toc").Link("Building")_;_NFB_;_532205_;_
		 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::Building_Permit_ssf3.inf_;_hightlight id_;_Browser("Accela Automation: 2").Page("Accela Automation:").Frame("toc").Link("Building Permit")_;_NFB_;_532205_;_
		 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::Residential_ssf4.inf_;_hightlight id_;_Browser("Accela Automation: 2").Page("Accela Automation:").Frame("toc").Link("Residential")_;_NFB_;_532205_;_
		 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::New_Single_Family_ssf5.inf_;_hightlight id_;_Browser("Accela Automation: 2").Page("Accela Automation:").Frame("toc").Link("New Single Family")_;_NFB_;_532205_;_
		 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_;_532205_;_
End Function

Function VerifyNewAppWindow (strFirstLink,strSecondLink,strThirdLink,strFourthLink)
	 Dim  p_strResult1,p_strResult2,p_const1,p_const2
	 p_const1 = "NewApplication"
	 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

'c.Test the search button in address section
Call objTestLib.printfile(file,3,"      c.Test the search button in address section")
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_;_562210_;_
Browser("Accela Automation:_4").Page("Accela Automation:").Image("Submit").Click 25,4 @@ script infofile_;_ZIP::Submit_ssf15.inf_;_hightlight id_;_Browser("Accela Automation: 4").Page("Accela Automation:").Image("Submit")_;_NFB_;_572212_;_
strRowCount = Browser("Accela Automation:_5").Page("Accela Automation:").WebTable("Address").RowCount
If strRowCount=2 Then
   Call objTestLib.printfile(file,5,"None owner information exists in owner table!")
   Browser("Accela Automation:_5").Page("Accela Automation:").Image("Cancel").Click
Elseif strRowCount > 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_;_572213_;_
   wait(4)
   Call VerifyAddress(Ucase(strAddress))
Else
   Call objTestLib.printfile(file,5,"cannot find Address table!")
End If

Function VerifyAddress (strAddress)
	 Dim  p_strStreetNumber,p_strStreetName
	 p_strStreetNumber = Browser("Accela Automation:_3").Page("Accela Automation:").WebEdit("AdrB1_HSE_NBR_START").GetROProperty("value")
	 p_strStreetName = Browser("Accela Automation:_3").Page("Accela Automation:").WebEdit("AdrB1_STR_NAME").GetROProperty("value")
	 If len(p_strStreetNumber) <> 0 And len(p_strStreetName) <> 0 Then
	 	If instr(strAddress,p_strStreetNumber) <> 0 And 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

'd.Test the Get Parcel & Owner button
Call objTestLib.printfile(file,3,"      d.Test the Get Parcel & Owner button")
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_;_582214_;_
wait(4)
strParcel = Browser("Accela Automation:_3").Page("Accela Automation:").WebEdit("vParB1_PARCEL_NBR").GetROProperty("value")
strOwner = Browser("Accela Automation:_3").Page("Accela Automation:").WebEdit("OwnB1_OWNER_FULL_NAME").GetROProperty("value")
If len(strParcel) > 0 And len(strOwner) > 0 Then
    Call objTestLib.printfile(file,4)
Else
	Call objTestLib.printfile(file,5,"Get parcel and owner inforamtion failed!")
End If

'e.Test the search button in parcel section
Call objTestLib.printfile(file,3,"      e.Test the search button in parcel section")
Browser("Accela Automation:_3").Page("Accela Automation:").Image("Search for Parcel").Click @@ script infofile_;_ZIP::Search_for_Parcel_ssf18.inf_;_hightlight id_;_Browser("Accela Automation: 3").Page("Accela Automation:").Image("Search for Parcel")_;_NFB_;_592216_;_
Browser("Accela Automation:_6").Page("Accela Automation:").Image("Submit").Click 30,10 @@ script infofile_;_ZIP::Submit_ssf19.inf_;_hightlight id_;_Browser("Accela Automation: 6").Page("Accela Automation:").Image("Submit")_;_NFB_;_602218_;_
strTemp = Browser("Accela Automation:_7").Page("Accela Automation:").WebTable("Parcel").GetCellData(3,1)
Browser("Accela Automation:_7").Page("Accela Automation:").Image("Select Parcel").Click @@ script infofile_;_ZIP::Select_Parcel_ssf20.inf_;_hightlight id_;_Browser("Accela Automation: 7").Page("Accela Automation:").Image("Select Parcel")_;_NFB_;_602219_;_
wait(4)
strParcel = Browser("Accela Automation:_3").Page("Accela Automation:").WebEdit("vParB1_PARCEL_NBR").GetROProperty("value")
If instr(strTemp,strParcel) <> 0 Then
    Call objTestLib.printfile(file,4)
Else
	Call objTestLib.printfile(file,5,"Get parcel inforamtion failed!")
End If

⌨️ 快捷键说明

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