|
qtp中循环部分代码未执行就跳过了怎么回事,代码中执行到for之后直接跳到最后一行了
下面是代码(测试程序是自带的订票系统,代码主要功能是删除已经订票的信息)
Dim i
Dim j
'登录部分
Dialog("Login").WinEdit("Agent Name:").Set "zhangq"
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure "5214c29da9670b6102ec4ae0509cb28227ffc292"
Dialog("Login").WinEdit("Password:").Type micReturn
'查询订票信息
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "zhangq"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
'获取列表中数据的数目
i = Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").GetROProperty("items count")
'此处想使用msgbox将i的值弹出框显示,如何编写????
'使用循环将已订票信息删除
For j = 0 to (i-1)
Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").WinList("Flight No.").Select j
Window("Flight Reservation").Dialog("Open Order").Dialog("Search Results").WinButton("OK").Click
Window("Flight Reservation").WinButton("Delete Order").Click
Window("Flight Reservation").Dialog("Flight Reservations").WinButton("是(Y)").Click
'判断是否还存在删除的数据,不存在则退出循环
If j = i -1Then
'Window("Flight Reservation").WinMenu("Menu").Select("File;exit")
Exit for
End If
Window("Flight Reservation").WinButton("Button").Click
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Customer Name").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "zhangq"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Next
'退出系统
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit" |
|