不谋万世者,不足谋一时;不谋全局者,不足谋一域。君子敏于事而慎于言 新浪微薄:土司阿哈

webRadionGroup和webtable的使用技巧

上一篇 / 下一篇  2008-04-16 20:53:57 / 个人分类:qtp

1208328177
  • 自动化测试:
  • 测试文档:

!H$~Vo#Ws6o~0'   演示环境http://newtours.demoaut.com/mercuryreservation.php
c$L'QA7~M0Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").Select "oneway"51Testing软件测试网,n&WGTd\OD
' all items  获取所有单选框的对象,
Ex1?2Nkrm?0 msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("all items")51Testing软件测试网{} d&V&k`(~X Cw
'items count  获取单选框的个数
qn]5A#?M2yZ0  msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("items count")51Testing软件测试网:y)H| ~m.S
 51Testing软件测试网9Tqi5F]D Q
  'selected item index   获取当前所选对象index51Testing软件测试网&H:g"A8B:h;teZj
 msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("selected item index")51Testing软件测试网6Fl~F ly
  msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("value")

b#Ky!E P051Testing软件测试网0K9N9[1d!H OF5L-G

 51Testing软件测试网R9k.P"W&d$Qt;p%X

/J:u4p(dT0jB0如图,知道其中黄色部分,要找到器绿色部分的信息,同时,在本页找不到的情况下,翻页继续找,直到最后一页!

qI5gsh7\1t5\e,o0

TO/c@y-`mzP0具体代码如下:51Testing软件测试网R;Dh8O D ?+v

d:pO:i.O;FU}0Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Activate
F&b'w vM0'Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").Link("5").Click

1L,CxiDx(A051Testing软件测试网-\0p6\Y4v,B\

If

&gHT&{j1e~0msgbox Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").GetCellData(2,3)
l5A$a8sD0Dim row ,link51Testing软件测试网 gb#w;l'mFp-^
row = Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").GetRowWithCellText(DataTable("p_Text", dtGlobalSheet), 2, 3)
Q2G$]peFn.k:bB0msgbox row51Testing软件测试网9dXwd}$hh!J

)O Q Vc rc&ma0Set Link = Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").ChildItem(row, 1, "Link", 0)51Testing软件测试网.{b1b5_9H!J

h`A;`B:PO0Link.Click

q_z C)O7Ve JP051Testing软件测试网I(jR*V+y*H/KD

同时,webtable常用的方法还有51Testing软件测试网 h3O6SPQ!^A0x]1y1H

[L [Za!_"N?0if  Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").Exist then

a zu J~l3u:q;v0

G*Sz:Rc!Yb6}0reporter.ReportEvent 0,"pass","系统显示了所有的资讯列表!"

3V0A+Qo7Q\.RL0

u}g)SS G0else51Testing软件测试网~/B;_bon\f9{*N
  reporter.ReportEvent 1,"fail","
系统没有显示资讯列表!

3S:y U%[.p}]!r051Testing软件测试网]T1u5N]5{

end if

6} U7^-x'xcHq051Testing软件测试网8l4CZ:Q0F0D-M+r

获取表格行数:51Testing软件测试网+\^SD?
Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").RowCount

,Ckg8Y s3cg0

TAG: QTP qtp

土司*阿哈空间 引用 删除 wonew1228   /   2008-11-03 15:37:24
str="Blue Skies Airlines$361$271$7:10"
aa=split(str,"$")
xx= aa(0)&aa(1)&aa(2)
msgbox xx
angelia_liu的个人空间 引用 删除 angelia_liu   /   2008-10-29 16:35:21
您好,这样的话我取出来的值是"Blue Skies Airlines$361$271$7:10".
请问怎么把这个"$"去掉?
谢谢
土司*阿哈空间 引用 删除 wonew1228   /   2008-10-27 22:18:03
可以把所选的值设为参数,存在excel中,以供后面使用;
或者用GetROProperty("value") 去得他所选的值,如下:
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("value")
angelia_liu的个人空间 引用 删除 angelia_liu   /   2008-10-27 15:58:51
Browser("Find a Flight: Mercury\").Page("Find a Flight: Mercury").WebRadioGroup("tripType").Select "oneway"51Testing软件测试网^L'Y4t3h'KX0N.M
' all items  获取所有单选框的对象,
t w*IER169422 msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("all items")51Testing软件测试网`#\Z2I*nk` G
'items count  获取单选框的个数51Testing软件测试网1b5Jm-lWi9?PV'a6GYx
  msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("items count")
(C%?@4B)az q169422  51Testing软件测试网7sm\*lSl
  'selected item index   获取当前所选对象index 51Testing软件测试网jQ:f%Uy;T
msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("selected item index")
"j.|+^VfHp8b"`4f(N169422  msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("value")

我有一个问题,希望您帮忙解答,
就是当我获取了我们选择的这个选项的值后,如何把这个值保存起来以备后面要用.
 

评分:0

我来说两句

Open Toolbar