|
回复 #33 michelle_happy 的帖子
你说的很对,为避免大家看的晕头转向,我把自己做的例子贴出来,方便大家查看。
SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set "lily"
Dialog("Login").WinEdit("Password:").SetSecure "45a8b17dacf40124f0d69b9493df0dd3adff1d48"
Dialog("Login").WinButton("OK").Click
Datatable.AddSheet("TicketName")
Datatable.ImportSheet "C:\ticket_name.xls",1,"TicketName"
Dim i,rowcount
i=0
rowcount=Datatable.GetSheet("TicketName").getrowcount
reporter.ReportEvent 2,"there are "&rowcount,"row in this data table"
Do while i<rowcount
i=i+1
Datatable.Getsheet("TicketName").setcurrentrow(i)
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "011907"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Denver"
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "20260 DEN 08:12 AM LON 03:23 PM AA $112.20"
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set DataTable("Name", 3)
Window("Flight Reservation").WinEdit("Tickets:").SetSelection 0,1
Window("Flight Reservation").WinEdit("Tickets:").Set DataTable("Tickets", 3)
Window("Flight Reservation").WinRadioButton("Business").Set
Window("Flight Reservation").WinButton("Insert Order").Click
Loop
注释:Window("Flight Reservation").WinEdit("Name:").Set DataTable("Name", 3)
Window("Flight Reservation").WinEdit("Tickets:").Set DataTable("Tickets", 3)
'其中的3是指表单的index,即新建的标单TicketName
这两行语句也可以这样写:
Window("Flight Reservation").WinEdit("Name:").Set DataTable("Name", "TicketName")
Window("Flight Reservation").WinEdit("Tickets:").Set DataTable("Tickets", "TicketName")
如果还有疑问,请查看贴子:
http://bbs.51testing.com/thread-56424-1-1.html |
|