||
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "ssswan"
Dialog("Login").WinEdit("Password:").SetSecure "54508d17c355b37196ed41bc8d3aca0077d6969f"
Window("Flight Reservation").ActiveX("MaskEdBox").Type "111114"
Window("Flight Reservation").WinComboBox("Fly From:").Select "London"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Frankfurt"
Window("Flight Reservation").WinButton("FLIGHT").Click
'观察一下下面的语法,
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "12500 LON 03:12 PM FRA 03:57 PM AA $105.30"
'
获得列表对象里面的选项个数
n = Window("Flight Reservation").Dialog("Flights Table").WinList("From").GetItemsCount
'使用Step Generator可以查到随机对象的语法;最后写成下面的形式:
r = RandomNumber.Value (0, n)
'最后,综合上面的知识,可以写出:
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select r
'多次测试这个脚本,观察每次都有不一样的航班号
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "qw"
Window("Flight Reservation").WinButton("Insert Order").Click
==========
说明:多次运行测试,可以观察到航班号是随机选择的。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-27 16:28
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社