求助QTP循环脚本问题

woaisunyingli 2011-03-30 01:15:18
不知道发到这个版块对么,我是菜鸟,帮帮我啊
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

...全文
97 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
woaisunyingli 2011-03-31
  • 打赏
  • 举报
回复

没人知道么,算了,我用datatable遍历吧

4,009

社区成员

发帖
与我相关
我的任务
社区描述
它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。
社区管理员
  • vbScript社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧