TA的每日心情 | 奋斗 2022-7-13 15:22 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
'####################################################################################################################################
' 描述性编程,事先把所有的IE窗口全部关闭 #
'#############################################
Dim WinIe,Ie,i,m
Set WinIe=description.Create()
WinIe("regexpwndtitle").value=" Microsoft Internet Explorer" '所有页面的regexpwndtitle属性值都是" Microsoft Internet Explorer",也可以用其他属性
Set Ie=desktop.ChildObjects(WinIe)
m=Ie.count
For i=1 to m
Ie(i-1).close ' 0为最后打开的一个,可关闭打开的几个,,循环改成for i=1 to m
Next
'####################################################################################################################################
systemutil.Run "iexplore","http://newtours.mercuryinteractive.com "
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Sync
'Browser("Welcome: Mercury Tours").Close
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "jie.wu"
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("password").SetSecure "463fe0d035b4df752e83110ce83e3cd8c3722b639b31" '97210125
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click 29,10
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebRadioGroup("tripType").Select "oneway"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromPort").Select DataTable("departure", dtLocalSheet)
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromMonth").Select "February"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromDay").Select "30"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toPort").Select "Frankfurt"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toPort").Select "London"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toMonth").Select "July"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toDay").Select "31"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebRadioGroup("servClass").Select "Business"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("airline").Select "Unified Airlines"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").Image("findFlights").Click 69,9
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").Output CheckPoint("271")
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebRadioGroup("outFlight").Select "Blue Skies Airlines$361$271$7:10"
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebRadioGroup("inFlight").Select "Blue Skies Airlines$631$273$14:30"
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").Image("reserveFlights").Click 45,11
'Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Check CheckPoint("Book a Flight: Mercury")
If Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Check (CheckPoint("Book a Flight: Mercury")) then
reporter.ReportEvent 0,"检查页面","页面正常"
else
reporter.ReportEvent 1,"检查页面","页面不正常"
end if
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passFirst0").Set "aaa"
' 添加一个bitmap CheckPoint
'If Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury_2").Image("banner2").Check (CheckPoint("banner2_2")) then
' reporter.ReportEvent 0,"bitmap Checkpoint","successful"
'else
' reporter.ReportEvent 1,"bitmap Checkpoint","fail"
'end if
' 添加一个Table CheckPoint
If Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebTable("Frankfurt to London").Check (CheckPoint("Frankfurt to London")) then
reporter.ReportEvent 0,"Table checking","Table checking 正确!"
else
reporter.ReportEvent 1,"Table checking","Table checking 不正确!"
end if
'添加一个Object CheckPoint
If Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passFirst0").Check (CheckPoint("passFirst0") ) then
reporter.ReportEvent 0,"标准检查点","检查点数值正确!"
else
reporter.ReportEvent 1,"标准检查点","检查点数值不正确!"
end if
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passLast0").Set "aa"
'添加一个Output
reporter.ReportEvent 2,"检查Output输出值","检查Output输出值"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passLast0").Output CheckPoint("passLast0")
'使用GetRoproperty方法获取属性值
Dim value
value= Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passLast0").GetROProperty ("value")
reporter.ReportEvent 2,"属性输出值GetROProperty","输出值为:" & value
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("creditnumber").Set "123345"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebList("pass.0.meal").Select "Bland"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebList("cc_exp_dt_mn").Select "01"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebList("cc_exp_dt_mn").Select "02"
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Image("buyFlights").Click 72,14
'检查点 Insert Text Checkpoint
If Browser("Welcome: Mercury Tours").Page("Flight Confirmation: Mercury").Check (CheckPoint("Frankfurt")) then
reporter.ReportEvent 0,"text Checkpoint","检查结果正确"
else
reporter.ReportEvent 1,"text Checkpoint","检查结果不正确"
end if
Browser("Welcome: Mercury Tours").Page("Flight Confirmation: Mercury").Image("Logout").Click
Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").Sync
Browser("Welcome: Mercury Tours").Close |
|