|
If not Browser("Browser").Page("Page").WebEdit("name:=userName").Exist Then
Muser=DataTable("用户名",gtGlobalSheet)
Mpwd=DataTable("密码",gtGlobalSheet)
If Muser<>"" and Mpwd<>"" Then
SystemUtil.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE","","C:\Documents and Settings\Administrator","open"
Browser("Browser").Page("Page").Sync
Browser("Browser").Navigate "http://newtours.mercuryinteractive.com"
Browser("Browser").Page("Page").WebEdit("name:=userName").Set Muser
Browser("Browser").Page("Page").WebEdit("name:=password").Set Mpwd
Browser("Browser").Page("Page").Image("name:=login").Click
Browser("Browser").Page("Page").Sync
End If
End If
MType=DataTable("Type",gtGlobalSheet)
If MType="Round Trip" Then
Browser("Browser").Page("Page").WebRadioGroup("name:=tripType","index:=0").Select "#0"
Else
Browser("Browser").Page("Page").WebRadioGroup("name:=tripType","index:=0").Select "#1"
End If
MUserCount=DataTable("Passengers",gtGlobalSheet)
MDepartingFrom=DataTable("DepartingFrom",gtGlobalSheet)
MDay1=DataTable("Day1",gtGlobalSheet)
MMonth1=DataTable("Month1",gtGlobalSheet)
MDay2=DataTable("Day2",gtGlobalSheet)
MMonth2=DataTable("Month2",gtGlobalSheet)
MArrivingIn=DataTable("ArrivingIn",gtGlobalSheet)
MServiceClass=DataTable("ServiceClass",gtGlobalSheet)
MAirline=DataTable("Airline",gtGlobalSheet)
Browser("Browser").Page("Page").WebList("name:=passCount").Select MUserCount
Browser("Browser").Page("Page").WebList("name:=fromPort").Select MDepartingFrom
Browser("Browser").Page("Page").WebList("name:=fromMonth").Select MMonth1
Browser("Browser").Page("Page").WebList("name:=fromDay").Select MDay1
Browser("Browser").Page("Page").WebList("name:=toPort").Select MArrivingIn
Browser("Browser").Page("Page").WebList("name:=toMonth").Select MMonth2
Browser("Browser").Page("Page").WebList("name:=toDay").Select MDay2
If MServiceClass="" and MServiceClass="Economy class" Then
Browser("Browser").Page("Page").WebRadioGroup("name:=servClass").Select "#0"
ElseIf MServiceClass="Economy class" Then
Browser("Browser").Page("Page").WebRadioGroup("name:=servClass").Select "#1"
Else
Browser("Browser").Page("Page").WebRadioGroup("name:=servClass").Select "#2"
End If
Browser("Browser").Page("Page").WebList("name:=airline").Select MAirline
Browser("Browser").Page("Page").Image("name:=findFlights").Click
Browser("Browser").Page("Page").Sync
MDEPART=DataTable("DEPART",gtGlobalSheet)
MRETURN=DataTable("RETURN",gtGlobalSheet)
If MDEPART="" and MDEPART="1" Then
Browser("Browser").Page("Page").WebRadioGroup("name:=outFlight").Select "#0"
ElseIf MDEPART="2" Then
Browser("Browser").Page("Page").WebRadioGroup("name:=outFlight").Select "#1"
ElseIf MDEPART="3" Then
Browser("Browser").Page("Page").WebRadioGroup("name:=outFlight").Select "#2"
Else
Browser("Browser").Page("Page").WebRadioGroup("name:=outFlight").Select "#3"
End If
If MRETURN="" and MRETURN="1" Then
Browser("Browser").Page("Page").WebRadioGroup("name:=inFlight").Select "#0"
ElseIf MRETURN="2" Then
Browser("Browser").Page("Page").WebRadioGroup("name:=inFlight").Select "#1"
ElseIf MRETURN="3" Then
Browser("Browser").Page("Page").WebRadioGroup("name:=inFlight").Select "#2"
Else
Browser("Browser").Page("Page").WebRadioGroup("name:=inFlight").Select "#3"
End If
Browser("Browser").Page("Page").Image("name:=reserveFlights").Click
Browser("Browser").Page("Page").Sync
MCustomerF=DataTable("CustomerF",gtGlobalSheet)
MCF=Split(MCustomerF,"/",-1,1)
MCustomerL=DataTable("CustomerL",gtGlobalSheet)
MCL=Split(MCustomerL,"/",-1,1)
MMeal=DataTable("Meal",gtGlobalSheet)
MM=Split(MMeal,"/",-1,1)
MCardType=DataTable("CardType",gtGlobalSheet)
MNumber=DataTable("Number",gtGlobalSheet)
MFirstName=DataTable("FirstName",gtGlobalSheet)
MMiddle=DataTable("Middle",gtGlobalSheet)
MExpirationM=DataTable("ExpirationM",gtGlobalSheet)
MExpirationY=DataTable("ExpirationY",gtGlobalSheet)
MLast=DataTable("Last",gtGlobalSheet)
MBillingAddress=DataTable("BillingAddress",gtGlobalSheet)
For i=0 to (MUserCount-1)
Browser("Browser").Page("Page").WebEdit("name:=passFirst"&i).Set MCF(i)
Browser("Browser").Page("Page").WebEdit("name:=passLast"&i).Set MCL(i)
If MM(i)<>"" Then
Browser("Browser").Page("Page").WebList("name:=pass."&i&".meal").Select MM(i)
End If
Next
If MCardType<>"" Then
Browser("Browser").Page("Page").WebList("name:=creditCard").Select MCardType
End If
Browser("Browser").Page("Page").WebEdit("name:=creditnumber").Set MNumber
If MExpirationM<>"" Then
Browser("Browser").Page("Page").WebList("name:=cc_exp_dt_mn").Select MExpirationM
End If
If MExpirationY<>"" Then
Browser("Browser").Page("Page").WebList("name:=cc_exp_dt_yr").Select MExpirationY
End If
MFirstName=DataTable("FirstName",gtGlobalSheet)
MMiddle=DataTable("Middle",gtGlobalSheet)
MLast=DataTable("Last",gtGlobalSheet)
Browser("Browser").Page("Page").WebEdit("name:=cc_frst_name").Set MFirstName
Browser("Browser").Page("Page").WebEdit("name:=cc_mid_name").Set MMiddle
Browser("Browser").Page("Page").WebEdit("name:=cc_last_name").Set MLast
Browser("Browser").Page("Page").WebEdit("name:=cc_last_name").Set MLast
MBillAddress=DataTable("BillingAddress",gtGlobaiSheet)
MBillAddress1=DataTable("BillAddress1",gtGlobalSheet)
MBillAddress2=DataTable("BillAddress2",gtGlobaiSheet)
MBillCity=DataTable("BillCity",gtGlobalSheet)
MBillStateProvince=DataTable("BillStateProvince",gtGlobaiSheet)
MBillPostalCode=DataTable("BillPostalCode",gtGlobalSheet)
MBillCountry=DataTable("BillCountry",gtGlobalSheet)
If MBillAddress<>"" Then
Browser("Browser").Page("Page").WebCheckBox("name:=ticketLess","index:=0").Set "on"
Browser("Browser").Page("Page").WebEdit("name:=billAddress1").Set MBillAddress1
Browser("Browser").Page("Page").WebEdit("name:=billAddress2").Set MBillAddress2
Browser("Browser").Page("Page").WebEdit("name:=billCity").Set MBillCity
Browser("Browser").Page("Page").WebEdit("name:=billState").Set MBillStateProvince
Browser("Browser").Page("Page").WebEdit("name:=billZip").Set MBillPostalCode
Browser("Browser").Page("Page").WebList("name:=billCountry").Select MBillCountry
End If
MDeliveryAddress=DataTable("DeliveryAddress",gtGlobaiSheet)
MdelAddress1=DataTable("delAddress1",gtGlobalSheet)
MdelAddress2=DataTable("delAddress2",gtGlobaiSheet)
MdelCity=DataTable("delCity",gtGlobalSheet)
MdelStateProvince=DataTable("delStateProvince",gtGlobaiSheet)
MdelPostalCode=DataTable("delPostalCode",gtGlobalSheet)
MdelCountry=DataTable("delCountry",gtGlobalSheet)
If MDeliveryAddress<>"" Then
Browser("Browser").Page("Page").WebCheckBox("name:=ticketLess","index:=1").Set "on"
Browser("Browser").Page("Page").WebEdit("name:=delAddress1").Set MdelAddress1
Browser("Browser").Page("Page").WebEdit("name:=delAddress2").Set MdelAddress2
Browser("Browser").Page("Page").WebEdit("name:=delCity").Set MdelCity
Browser("Browser").Page("Page").WebEdit("name:=delState").Set MdelStateProvince
Browser("Browser").Page("Page").WebEdit("name:=delZip").Set MdelPostalCode
Browser("Browser").Page("Page").WebList("name:=delCountry").Select MdelCountry
End If
If Browser("Browser").Dialog("Microsoft Internet Explorer").WinButton("确定").Exist Then
Browser("Browser").Dialog("Microsoft Internet Explorer").WinButton("确定").Click
End If
Browser("Browser").Page("Page").Image("name:=buyFlights").Click
Browser("Browser").Page("Page").Sync
MChangeWeb=DataTable("ChangeWeb",gtGlobalSheet)
If MChangeWeb="BACK TO FLIGHTS" Then
Browser("Browser").Page("Page").Image("url:=http://newtours.mercuryinteractive.com/tour/mercuryreservation.php").Click
ElseIf MChangeWeb="BACK TO HOME" Then
Browser("Browser").Page("Page").Image("url:=http://newtours.mercuryinteractive.com/tour/mercurywelcome.php").Click
Browser("Browser").Close
ElseIf MChangeWeb="LOG OUT" Then
Browser("Browser").Page("Page").Image("url:=http://newtours.mercuryinteractive.com/tour/mercurysignoff.php").Click
Browser("Browser").Close
End If
慢慢来。。。已经基本写好了。。。基本代码,我现在问别人怎么检查机票的正确性~~!!
[ 本帖最后由 sogoc 于 2007-4-26 14:37 编辑 ] |
|