woaisunyingli 2011年03月30日
求助QTP循环脚本问题
不知道发到这个版块对么,我是菜鸟,帮帮我啊
QTP自带的订票系统,目的地是固定的London,然后起始地做循环,但起始地不能是London,怎么加个if语句啊

Dim IntNumber_flyfrom,IntNumber_flytime
Dim Str_flyfrom,Str_flytime
Window("Flight Reservation").Activate
IntNumber_flyfrom=Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
For i=0 to IntNumber_flyfrom-1

Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "040411"
Str_flyfrom=Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)
Window("Flight Reservation").WinComboBox("Fly From:").Select Str_flyfrom
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
'是这里要加个if语句么
Window("Flight Reservation").WinButton("FLIGHT").Click
IntNumber_flytime=Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetItemsCount
For k=0 to IntNumber_flytime-1
Str_flytime=Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetItem(k)
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select Str_flytime
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "qwe"
Window("Flight Reservation").WinRadioButton("First").Set
Window("Flight Reservation").WinEdit("Tickets:").SetSelection 0,1
Window("Flight Reservation").WinEdit("Tickets:").Set "2"
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "040411"
Str_flyfrom=Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)
Window("Flight Reservation").WinComboBox("Fly From:").Select Str_flyfrom
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").WinButton("FLIGHT").Click
Next
Window("Flight Reservation").Dialog("Flights Table").WinButton("Cancel").Click
Next

...全文
50 点赞 收藏 1
写回复
1 条回复

还没有回复,快来抢沙发~

发动态
发帖子
vbScript
创建于2007-09-28

3684

社区成员

3502

社区内容

它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。
社区公告
暂无公告