如果晚上月亮升起的时候,月光照到我的门口,我希望月光女神能满足我一个愿望,我想要一双人类的手。我想用我的双手把我的爱人紧紧地拥在怀中,哪怕只有一次。如果我从来没有品尝过温暖的感觉,也许我不会这样寒冷;如果我从没有感受过爱情的甜美,我也许就不会这样地痛苦。如果我没有遇到善良的佩格,如果我从来不曾离开过我的房间,我就不会知道我原来是这样的孤独.

QTP描述型编程--学习

上一篇 / 下一篇  2012-02-25 22:20:29 / 个人分类:QTP

51Testing软件测试网lW;F:Q&_"mpc

'行描述方式,只要用SPY探测出对象的属性,不用捕获在对象库中51Testing软件测试网U&U4VX6O!r7H\cW
'下面是简单的小飞机订票代码,当然代码还可以优化这里只是为了熟悉行描述编程的思想51Testing软件测试网&{1UF(e{.?%uG3P
systemutil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
u"dd*nM le0R%Z0dialog("text:=Login").winedit("attached text:=Agent name:").Set "mercury"51Testing软件测试网._da*S8Wc hG"X
dialog("text:=Login").winedit("attached text:=Password:").Set "mercury"51Testing软件测试网\.G[ P}@[iLu
dialog("text:=Login").winbutton("text:=OK").Click '登录
?&V|'e{#LA_a0wait 251Testing软件测试网X2qr:h+Z+S
window("text:=Flight Reservation").ActiveX("acx_name:=MaskEdBox").Type "121212"
1e6|4f.BK)M/SG,o0window("text:=Flight Reservation").WinComboBox("attached text:=Fly From:").select  "London"
S h3R;c;Ob7WG0window("text:=Flight Reservation").WinComboBox("attached text:=Fly To:").select  "Paris"
.w"rt9J;b ]%m R0window("text:=Flight Reservation").WinButton("text:=FLIGHT").Click

2O3Z)?,r+Y;n^051Testing软件测试网d"Bq8_4f3?)H~x5S D

window("text:=Flight Reservation").Dialog("regexpwndtitle:=Flights Table").WinList("attached text:=From").Select "12510   LON   12:48 PM   PAR   02:48 PM   AF     $165.60"
2z~ L;p~0window("text:=Flight Reservation").Dialog("regexpwndtitle:=Flights Table").WinButton("text:=OK").Click51Testing软件测试网By ](t2@7AbY
window("text:=Flight Reservation").WinEdit("attached text:=Name:").Set "test"51Testing软件测试网w ^C9x Dy6z
window("text:=Flight Reservation").WinRadioButton("text:=First ").Click
,h8|&tL5Os8``0'对象描述方式:此方法也无需添加对象在库中,对无法识别的对象可以采用此法51Testing软件测试网9M^5v$k?!cV$Sy.}W
'Flight登录演示程序
\JR+}.M e9iEx|0systemutil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"51Testing软件测试网o];XH2I$y zy6x#O
Set penLog=description.Create()
,[QzdGLDo0OpenLog("text").value="Login"51Testing软件测试网l2?:k9\%d*P

m^VSlmm0Set username=description.Create()51Testing软件测试网mJ1Q"]3[ b2T {
username("attached text").value="Agent Name:"51Testing软件测试网n@g+}k2q2U1{
dialog(openlog).winEdit(username).Set "mercury"51Testing软件测试网/qQ(f(fj

51Testing软件测试网vh.XiDq LAY

Set passwd=description.Create()51Testing软件测试网wX2jpBW
passwd("attached text").value="Password:"
`{&y$gTp!a a*|.g)]0dialog(openlog).winEdit(passwd).Set "mercury"

~?y4@,WQE3Q0

w ~ [ n$U'kZ-J f0Set logbutton=description.Create()51Testing软件测试网 x6y"N[6h#j~5B{PF
logbutton("text").value="OK"
^ Au ~.G4f0dialog(openlog).winbutton(logbutton).Click51Testing软件测试网0p0~H$Zz'C.Q
51Testing软件测试网VsbA&`Tj(` J


TAG:

 

评分:0

我来说两句

Open Toolbar