QTP如何获取动态对话框
脚本是这样的Dialog("Login").WinEdit("Agent Name:").Set "mercury"
Dialog("Login").WinEdit("Agent Name:").TypemicTab
Dialog("Login").WinEdit("Password:").SetSecure "4bd3fa8da7ae2d2dd1b624468f740abb77ffd1ff"
Dialog("Login").WinEdit("Password:").TypemicReturn
Window("Flight Reservation").ActiveX("MaskEdBox").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "London"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Activate "13512 FRA 12:48 PM LON 01:33 PM SR $161.70"
Window("Flight Reservation").WinEdit("Name:").Set "wer"
Window("Flight Reservation").WinRadioButton("First").Set
Window("Flight Reservation").WinButton("Insert Order").Click
window("Flight Reservation").ActiveX("Threed Panel Control").WaitProperty "Text","Insert Done...",10000
a = window("Flight Reservation").WinEdit("Order No:").GetROProperty("Text")
Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order..."
'用描述性编程
Set MyDes = description.Create()
FaxName = "Fax Order No.*"
MyDes("Name").value= FaxName
MyDes("Text").value = FaxName
Window("Flight Reservation").Dialog(MyDes).Activate
'替换描述性编程
b = "Fax Order No. "&a
Window("Flight Reservation").Dialog(b).Activate
我用print b查过b在运行时的结果,和运行时的窗口名是一样的,不过就是报错。
难道说还要动态地添加对象库?
Window("Flight Reservation").Dialog(MyDes).Activate 关注中。。。 Set MyDes = description.Create()
FaxName = "Fax Order No.*"
-----这个正则表达式不可以这么用的,需要做一下转换。或者就不要用描述性编程,直接在对象库里头用正则表达式。 Window("Flight Reservation").Dialog(b).Activate
写错,应该是类似这样的
Window("Flight Reservation").Dialog("Name:="&b).Activate
回复 4# 的帖子
多谢,不过应该是这样写Window("Flight Reservation").Dialog("Text:="&b).Activate
回复 3# 的帖子
直接在对象库里用正则表达式该如何操作 或者这样:b = "text:=Fax Order No. "&a
Window("Flight Reservation").Dialog(b).Activate 打开对象库里 某个对象的某一个值的设置窗口value configuration options
里面勾上Regular expression
这个属性值就支持使用正则了
回复 8# 的帖子
多谢,回家试试
页:
[1]