51Testing软件测试论坛

标题: 有关下拉菜单的录制 [打印本页]

作者: lutingting    时间: 2008-3-5 14:06
标题: 有关下拉菜单的录制
我在录制下拉菜单的时候,将选择下拉菜单的一项设置为参数化,为什么在回放的时候总是不能正确地找到要选择的对象
求助~~
作者: hsjzfling    时间: 2008-3-5 14:25
关于下拉菜单的问题之前已经有太多的帖子讨论过了,lz搜索下老帖吧~
作者: wslss007    时间: 2008-3-5 16:48
参考下这个吧,是对flight4a.exe的操作:

Function GetList(i)
   Randomize
   GetList=RandomNumber(0,i)  '随机取0到i之间的数
End Function

Dim get_count,ram,result ,get_count1,ram1,result1

Dialog("Login").WinEdit("Agent Name:").Set "ssss"
Dialog("Login").WinEdit("Password:").SetSecure "47cba4ffdb1b3a2d760d3077d4e2d32062570456"
Dialog("Login").WinEdit("Password:").Type  micReturn
Window("Flight Reservation").WinObject("Date of Flight:").Type("030608")

get_count = window("Flight Reservation").Wincombobox("Fly From:").GetItemsCount  '获取列表中的item总数
ram = GetList(get_count-1)    '随机生成一个值
result=window("Flight Reservation").WinComboBox("Fly From:").GetItem(ram)    '根据随机生成的值取得相应的下拉框值
window("Flight Reservation").WinComboBox("Fly From:").Select result   '值返回到下拉框中
'msgbox(result)

get_count1 = window("Flight Reservation").WinComboBox("Fly To:").GetItemsCount
ram1 = getlist(get_count1-1)
result1 = window("Flight Reservation").WinComboBox("Fly To:").GetItem(ram1)
window("Flight Reservation").WinComboBox("Fly To:").Select result1


window("Flight Reservation").WinButton("FLIGHT").Click

Dim get_count2,ram2,result2

get_count2 = dialog("text:=Flights Table","window id:=0").winlist("attached text:=From","window id:=2001").GetItemsCount
ram2 = getlist(get_count2-1)
result2 = dialog("text:=Flights Table","window id:=0").winlist("attached text:=From","window id:=2001").GetItem(ram2)
dialog("text:=Flights Table","window id:=0").winlist("attached text:=From","window id:=2001").Select result2
dialog("text:=Flights Table","window id:=0").winbutton("text:=OK").Click
window("Flight Reservation").WinEdit("Name:").Set "sslin"
window("Flight Reservation").WinEdit("attached text:=Tickets:","window id:=1029").Set "2"
window("Flight Reservation").WinRadioButton("Business").Set
window("Flight Reservation").WinButton("Insert Order").Click




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2