与其临渊羡鱼,不如退而结网!

QTP参数化实例——应用程序

上一篇 / 下一篇  2007-01-17 18:43:02 / 个人分类:QTP

y L&Vx bH [0刚刚看了 xiaonan 博客中的《QTP参数化实例(续)》不禁手痒,就按照 xiaonan 的例子,完成了 “课后练习题”^_^51Testing软件测试网 I2{QmD
QTP自带的windows程序fight.其中有一个WinRadioButton对象.如下图:
iy0TM/u-]0现在将修改后的完整脚本贴出来,给自己留个印记~~~
P6e[6Vs t9?:P V6N0Dialog("Login").WinEdit("Agent Name:").Set "ddddd"
,U{:u/?1_l&x&zz0Dialog("Login").WinEdit("Password:").SetSecure "45adf43a0fd43490f85d6c773e624a56d97576d1"51Testing软件测试网,])V BX C1E
Dialog("Login").WinButton("OK").Click
T'J }5M&V;h0Window("Flight Reservation").ActiveX("MaskEdBox").Type "111111"51Testing软件测试网9Zz OgvjaoOd
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
5unwZQL-i{r0Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
DQ |Qg0[P ~"A)k^0Window("Flight Reservation").WinButton("FLIGHT").Click
`)vde8B&{&t/pn0Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "20330   FRA   08:12 AM   LAX   03:23 PM   AA     $112.20"
oZ ykT F0Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
+d(^E"N0}0Window("Flight Reservation").WinEdit("Name:").Set "123"
L#Q1Y v8WC)G{~0Dim i, b51Testing软件测试网.Y;TRc!b d
For i = 1 to 351Testing软件测试网)_/Dh3nLG8H
 Select Case i
W5m8m4A2_O"Lx(l0        Case 1 b = "First"51Testing软件测试网)pe0qrSW} J
        Case 2 b = "Business"51Testing软件测试网#E I }"a,cd/mEV
        Case 3 b = "Economy"
1r {I0n2`W#eLG0 End Select51Testing软件测试网u,MHTp(z7r
    Window("Flight Reservation").WinRadioButton("Business").SetTOProperty "text",b51Testing软件测试网#A d|A^$L/R
    Window("Flight Reservation").WinRadioButton("Business").Set'51Testing软件测试网$wQ'K,d3S1V9e_&_-e
Next51Testing软件测试网*x7P-_Hv c
Window("Flight Reservation").WinButton("Insert Order").Click51Testing软件测试网u1~'B:~']6yFf+NT,v
Window("Flight Reservation").Close51Testing软件测试网mWO?O6[

P{"L.z X%C/Y0参考链接:http://blog.51testing.com/html/49/26649_itemid_3098.html51Testing软件测试网s r K3G$d,b:]3MF!Z
 

$f Q#m@/JwF$R)k3kg\5Q0

TAG: QTP

luochunfeng的个人空间 引用 删除 luochunfeng   /   2012-02-16 20:07:38
哦,上面说错了,应该是“Business”标示不唯一,修改如下,已在9.2中验证了

Dialog("Login").WinEdit("Agent Name:").Set "ddddd"
Dialog("Login").WinEdit("assword:").SetSecure "45adf43a0fd43490f85d6c773e624a56d97576d1"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").ActiveX("MaskEdBox").Type "111111"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select "20330   FRA   08:12 AM   LAX   03:23 PM   AA     $112.20"
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "123"
Dim i, b
For i = 1 to 3
Select Case i
        Case 1 b = "First"
        Case 2 b = "Business"
        Case 3 b = "Economy"
End Select
    Window("Flight Reservation").WinRadioButton("Business").SetTOProperty "text",b
    Window("Flight Reservation").WinRadioButton("text"=&b).Set'
Next
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").Close
luochunfeng的个人空间 引用 删除 luochunfeng   /   2012-02-16 18:13:12
Next放这里不对吧
luochunfeng的个人空间 引用 删除 luochunfeng   /   2012-02-16 18:12:43
1
heqingdan的个人空间 引用 删除 heqingdan   /   2007-12-04 17:17:59
有意思,你俩
xiaonan的个人空间 引用 删除 xiaonan   /   2007-01-19 15:21:22
呵呵,客气!说的我怪不好意思的.我可不敢当老师啊.继续努力!加油!
gp_jl的个人空间 引用 删除 gp_jl   /   2007-01-18 21:32:31
谢谢,老师鼓励!
本想偷师学艺,没想到被老师抓到,呵呵。以后还请老师多多指点!
xiaonan的个人空间 引用 删除 xiaonan   /   2007-01-18 09:27:37
呵呵,课后练习题完成的非常好.
 

评分:0

我来说两句

Open Toolbar