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

📄 script.mts

📁 QTP实例源码(完整)
💻 MTS
📖 第 1 页 / 共 5 页
字号:
	   If Err_Flag=False Then
		  Call AddDeptToTask()
		  Call AddStaffToTask()
		  Call UpdateTask()
		  Call DeleteTask()
	   End If
	End If
Else
	Call objTestLib.printfile(file,3,"   1. Process --cannot find this link, SKIP")
End If

Function SearchProcess ()
	Err_Flag = True
	'a. Search all Processes
	Call objTestLib.printfile(file,3,"      a. Search all Processes")
	Browser("Accela Automation:_27").Page("Accela Automation:").Image("Submit").Click 35,14 @@ script infofile_;_ZIP::Submit_ssf122.inf_;_hightlight id_;_Browser("Accela Automation: 27").Page("Accela Automation:").Image("Submit")_;_NFB_;_220775_;_
	If Browser("Accela Automation:_28").Page("Accela Automation:").Image("Edit").Exist(10) Then
	    Err_Flag = False
	    Call objTestLib.printfile(file,4)
	Else
	    Call objTestLib.printfile(file,3,"        ---None, no records found, please add process!")
	End If
End Function

Function SwitchView ()
	'b. select the first process, click on the process status view and diagram view
	Call objTestLib.printfile(file,3,"      b. select the first process, click on the process status view and diagram view")
	Browser("Accela Automation:_28").Page("Accela Automation:").Image("Edit").Click @@ script infofile_;_ZIP::Edit_ssf123.inf_;_hightlight id_;_Browser("Accela Automation: 28").Page("Accela Automation:").Image("Edit")_;_NFB_;_220776_;_
	wait(5)
	Browser("Accela Automation:_29").Page("Accela Automation:").Link("Process Status").Click @@ script infofile_;_ZIP::Process_Status_ssf124.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation:").Link("Process Status")_;_NFB_;_220777_;_
	wait(5)
	Browser("Accela Automation:_30").Page("Accela Automation:").Link("Diagram View").Click @@ script infofile_;_ZIP::Diagram_View_ssf125.inf_;_hightlight id_;_Browser("Accela Automation: 30").Page("Accela Automation:").Link("Diagram View")_;_NFB_;_220778_;_
	wait(5)
	Browser("Accela Automation:_31").Page("Accela Automation:").Image("Close Window").Click @@ script infofile_;_ZIP::Close_Window_ssf126.inf_;_hightlight id_;_Browser("Accela Automation: 31").Page("Accela Automation:").Image("Close Window")_;_NFB_;_230780_;_
	wait(5)
	Browser("Accela Automation:_30").Page("Accela Automation:").Link("Process View").Click @@ script infofile_;_ZIP::Process_View_ssf127.inf_;_hightlight id_;_Browser("Accela Automation: 30").Page("Accela Automation:").Link("Process View")_;_NFB_;_240780_;_
	wait(5)
End Function

Function AddTask ()
	Err_Flag = True
	'c. add a new task 
	Call objTestLib.printfile(file,3,"      c. add a new task")
	'Browser("Accela Automation:_29").Page("Accela Automation:_2").Image("Add new Task").Click @@ script infofile_;_ZIP::Add_new_Task_ssf128.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation: 2").Image("Add new Task")_;_NFB_;_240781_;_
	wait(5)
	Browser("Accela Automation:_29").Page("Accela Automation:_5").Image("Add new Task").Click @@ script infofile_;_ZIP::Add_new_Task_ssf477.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation: 5").Image("Add new Task")_;_NFB_;_1721342_;_
	Browser("Accela Automation:_92").Page("Accela Automation:").WebEdit("txtSD_PRO_DES").Set "Agency Testing" @@ script infofile_;_ZIP::txtSD_PRO_DES_ssf478.inf_;_hightlight id_;_Browser("Accela Automation: 92").Page("Accela Automation:").WebEdit("txtSD PRO DES")_;_NFB_;_1731343_;_
	Browser("Accela Automation:_92").Page("Accela Automation:").Image("Submit").Click @@ script infofile_;_ZIP::Submit_ssf479.inf_;_hightlight id_;_Browser("Accela Automation: 92").Page("Accela Automation:").Image("Submit")_;_NFB_;_1731343_;_
	wait(10)
	If Browser("Browser_14").Dialog("Microsoft Internet").WinButton("OK").Exist Then
		strMessage = Browser("Browser_14").Dialog("Microsoft Internet").Static("Warnning").GetROProperty("text")
		Call objTestLib.printfile(file,5,"Add a new task failed,the error message is " & strMessage) @@ script infofile_;_ZIP::Microsoft_Internet_Explorer_ssf384.inf_;_hightlight id_;_1_;_
		Browser("Browser_14").Dialog("Microsoft Internet").WinButton("OK").Click
		Browser("Accela Automation:_92").Page("Accela Automation:").Image("Cancel").Click
	Else if Browser("Accela Automation:_29").Page("Accela Automation:_2").WebEdit("SD_PRO_DES1").Exist Then
		 	Err_Flag = False
			strTemp = Browser("Accela Automation:_29").Page("Accela Automation:_2").WebEdit("SD_PRO_DES1").GetROProperty("value")
			If strTemp="Agency Testing" Then
	           Call objTestLib.printfile(file,4)
			Else
			   Call objTestLib.printfile(file,5,"Add a new task failed!")
		    End If
		 else
		 	 Call objTestLib.printfile(file,5,"Add a new task failed,there occurs an unexpected error!")
		 end if
	End If
End Function

Function AddDeptToTask ()
	'd. add a department to this new task 
	Call objTestLib.printfile(file,3,"      d. add a department to this new task")
	Browser("Accela Automation:_29").Page("Accela Automation:_5").Image("Search for Departmen").Click @@ script infofile_;_ZIP::Search_for_Departmen_ssf514.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation: 5").Image("Search for Departmen")_;_NFB_;_1891374_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc").Link("Organization.").Click @@ script infofile_;_ZIP::Organization._ssf515.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc").Link("Organization.")_;_NFB_;_1901376_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc").Link("Organization.").Click @@ script infofile_;_ZIP::Organization._ssf516.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc").Link("Organization.")_;_NFB_;_1901376_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc").Link("BUILDING").Click @@ script infofile_;_ZIP::BUILDING_ssf517.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc").Link("BUILDING")_;_NFB_;_1901376_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc").Link("CONTRACT").Click @@ script infofile_;_ZIP::CONTRACT_ssf520.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc").Link("CONTRACT")_;_NFB_;_1901376_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc").Link("NA").Click @@ script infofile_;_ZIP::NA_ssf521.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc").Link("NA")_;_NFB_;_1901376_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc").Link("NA_2").Click @@ script infofile_;_ZIP::NA_2_ssf522.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc").Link("NA 2")_;_NFB_;_1901376_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc").Link("NA_3").Click @@ script infofile_;_ZIP::NA_3_ssf523.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc").Link("NA 3")_;_NFB_;_1901376_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc").Link("NA_4").Click @@ script infofile_;_ZIP::NA_4_ssf524.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc").Link("NA 4")_;_NFB_;_1901376_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc2").Image("Submit").Click 24,9 @@ script infofile_;_ZIP::Submit_ssf525.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc2").Image("Submit")_;_NFB_;_1901376_;_
	wait(5)
	If len(Browser("Accela Automation:_29").Page("Accela Automation:_2").WebEdit("deptdisp1").GetROProperty("value")) > 0 Then
        Call objTestLib.printfile(file,4)
	Else
		Call objTestLib.printfile(file,5,"Add a department to this new task failed!")
	End If
End Function

Function AddStaffToTask ()
	'e. add a staff to this new task 
	Call objTestLib.printfile(file,3,"      e. add a staff to this new task")
	Browser("Accela Automation:_29").Page("Accela Automation:_5").Image("Select Department").Click @@ script infofile_;_ZIP::Select_Department_ssf526.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation: 5").Image("Select Department")_;_NFB_;_1911377_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc").Link("Organization.").Click @@ script infofile_;_ZIP::Organization._ssf528.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc").Link("Organization.")_;_NFB_;_1921379_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_3").Frame("toc2").Image("Submit").Click 25,7 @@ script infofile_;_ZIP::Submit_ssf529.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 3").Frame("toc2").Image("Submit")_;_NFB_;_1921379_;_
	Browser("Accela Automation:_32").Page("Accela Automation:_4").Frame("toc3").Link("SOHA  ENGINEERS").Click @@ script infofile_;_ZIP::SOHA__ENGINEERS_ssf530.inf_;_hightlight id_;_Browser("Accela Automation: 32").Page("Accela Automation: 4").Frame("toc3").Link("SOHA  ENGINEERS")_;_NFB_;_1921380_;_
	wait(6)
	If len(Browser("Accela Automation:_29").Page("Accela Automation:_2").WebEdit("StaffFName1").GetROProperty("value")) > 0 Then
       Call objTestLib.printfile(file,4)
	Else
		Call objTestLib.printfile(file,5,"Add a staff to this new task failed!")
	End If
End Function

Function UpdateTask ()
	'e. change the label on that task and click on update 
	Call objTestLib.printfile(file,3,"      e.change the label on that task and click on update ")
	Browser("Accela Automation:_29").Page("Accela Automation:_2").WebEdit("SD_PRO_ID11").Set "000000000000001" @@ script infofile_;_ZIP::SD_PRO_ID11_ssf145.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation: 2").WebEdit("SD PRO ID11")_;_NFB_;_300789_;_
	Browser("Accela Automation:_29").Page("Accela Automation:_2").WebEdit("SD_NXT_ID11").Set "000000000000001" @@ script infofile_;_ZIP::SD_NXT_ID11_ssf146.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation: 2").WebEdit("SD NXT ID11")_;_NFB_;_300789_;_
	Browser("Accela Automation:_29").Page("Accela Automation:_2").Image("Update with").Click @@ script infofile_;_ZIP::Update_with_ssf147.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation: 2").Image("Update with")_;_NFB_;_300789_;_
	If Browser("Accela Automation:_29").Dialog("Microsoft Internet").WinButton("OK").Exist(5)=False Then
        Call objTestLib.printfile(file,4)
	Else
		strMessage = Browser("Accela Automation:_29").Dialog("Microsoft Internet").Static("Warnning").GetROProperty("text")
		Browser("Accela Automation:_29").Dialog("Microsoft Internet").WinButton("OK").Click
		Call objTestLib.printfile(file,5,"Update the task failed!The error message is " & strMessage)
	End If
End Function

Function DeleteTask ()
	'f. Delete the task just created
	Call objTestLib.printfile(file,3,"      f.Delete the task just created")
	Browser("Accela Automation:_29").Page("Accela Automation:_3").Image("Delete this").Click @@ script infofile_;_ZIP::Delete_this_ssf148.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation: 3").Image("Delete this")_;_NFB_;_300790_;_
	Browser("Accela Automation:_29").Dialog("Microsoft Internet").WinButton("OK").Click @@ script infofile_;_ZIP::Microsoft_Internet_Explorer_ssf149.inf_;_hightlight id_;_2_;_
	wait(5)
	If Browser("Accela Automation:_29").Page("Accela Automation:_2").WebEdit("deptdisp1").GetROProperty("value") <> "Agency Testing" Then
        Call objTestLib.printfile(file,4)
	Else
		Call objTestLib.printfile(file,5,"can find the [Agency Testing] tasl")
	End If
End Function

'Browser("Accela Automation:_29").Page("Accela Automation:_4").Image("tab_menu").Click @@ script infofile_;_ZIP::tab_menu_ssf150.inf_;_hightlight id_;_Browser("Accela Automation: 29").Page("Accela Automation: 4").Image("tab menu")_;_NFB_;_300791_;_
Browser("Accela Automation:").Page("Accela Automation:").Image("tab_menu").Click

'=====2.Task Status 
If Browser("Accela Automation:").Page("Accela Automation:").Link("Task Status").Exist Then
	Call objTestLib.printfile(file,3,"   2. Task Status ")
	Browser("Accela Automation:").Page("Accela Automation:").Link("Task Status").Click @@ script infofile_;_ZIP::Task_Status_ssf153.inf_;_hightlight id_;_Browser("Accela Automation:").Page("Accela Automation:").Link("Task Status")_;_NFB_;_300793_;_
	Call SearchStatus()
    If Err_Flag=False Then
   	   call UpdateStatus()
       If Err_Flag=False Then
	   	  call RevertStatus()
	   End If
   End If
Else
	Call objTestLib.printfile(file,3,"   2. Task Status -- cannot find this link, SKIP")
End If

Function SearchStatus ()
	Err_Flag = True
	'a. Search all task status
	Call objTestLib.printfile(file,3,"      a. Search all task status")
	Browser("Accela Automation:_33").Page("Accela Automation:").Image("Submit").Click 20,0 @@ script infofile_;_ZIP::Submit_ssf154.inf_;_hightlight id_;_Browser("Accela Automation: 33").Page("Accela Automation:").Image("Submit")_;_NFB_;_300794_;_
	If Browser("Accela Automation:_34").Page("Accela Automation:").Image("Select").Exist(10) Then
	    Err_Flag = False
	    Call objTestLib.printfile(file,4)
	Else
		Call objTestLib.printfile(file,3,"        ---None, no records found, please add smartchoice group!")
	End If
End Function

Function UpdateStatus ()
	'b. select the first task status and update it
	Call objTestLib.printfile(file,3,"      b. select the first task statu and update it")
	Browser("Accela Automation:_34").Page("Accela Automation:").Image("Select").Click @@ script infofile_;_ZIP::Select_ssf155.inf_;_hightlight id_;_Browser("Accela Automation: 34").Page("Accela Automation:").Image("Select")_;_NFB_;_300795_;_
	arrOriginalValue(1) = Browser("Accela Automation:_35").Page("Accela Automation:_2").WebRadioGroup("rbActStatFlg").GetROProperty("value")
	arrOriginalValue(2) = Browser("Accela Automation:_35").Page("Accela Automation:_2").WebRadioGroup("txtRecStatus").GetROProperty("value")
	arrExpectValue = Array("","U","I")
	Call UpdateStatusValue(arrExpectValue)
	If Err_Flag=True Then
	    Call objTestLib.printfile(file,5,"Updated SmartChoice failed" & strMessage)
	Else
		Call VerifyStatusValue(arrExpectValue)
	End If
End Function

Function UpdateStatusValue (arrExpectValue)
	Err_Flag = True
	Browser("Accela Automation:_35").Page("Accela Automation:").WebRadioGroup("rbActStatFlg").Select arrExpectValue(1)
	Browser("Accela Automation:_35").Page("Accela Automation:").WebRadioGroup("txtRecStatus").Select arrExpectValue(2)
	Browser("Accela Automation:_35").Page("Accela Automation:_2").Image("SaveBtn").Click @@ script infofile_;_ZIP::SaveBtn_ssf531.inf_;_hightlight id_;_Browser("Accela Automation: 35").Page("Accela Automation: 2").Image("SaveBtn")_;_NFB_;_1951385_;_
	If Browser("Accela Automation:_33").Page("Accela Automation:_2").WebRadioGroup("txtActStatFlg").Exist(10) Then
		Err_Flag = False @@ script infofile_;_ZIP::Submit_ssf159.inf_;_hightlight id_;_Browser("Accela Automation: 33").Page("Accela Automation: 2").Image("Submit")_;_NFB_;_300797_;_
		Browser("Accela Automation:_33").Page("Accela Automation:_2").Image("Submit").Click 26,4
		Browser("Accela Automation:_34").Page("Accela Automation:").Image("Select").Click @@ script inf

⌨️ 快捷键说明

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