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

webRadionGroup和webtable的使用技巧

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

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

!eJg#Bd6VUg0'   演示环境http://newtours.demoaut.com/mercuryreservation.php51Testing软件测试网jN4[$|,B_2m!KP
Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").Select "oneway"
.qKV2F"s8S O+O}p j0' all items  获取所有单选框的对象,
_"X j#h8^ a4f(k0 msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("all items")
|e |3f"R a%NN0'items count  获取单选框的个数51Testing软件测试网N6Gh0q&efw
  msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("items count")
!g'z&WnO+\_&J2@0 
Mk!SC W&F2Q g.K+I0  'selected item index   获取当前所选对象index51Testing软件测试网#WX1L GE
 msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("selected item index")51Testing软件测试网 `a1]X|
  msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("value")51Testing软件测试网3M)GSirb

:u0EOc$nZ8I0 

H o[aY es1g8]Q051Testing软件测试网p]yF)Fj

如图,知道其中黄色部分,要找到器绿色部分的信息,同时,在本页找不到的情况下,翻页继续找,直到最后一页!51Testing软件测试网4xLL6v!e1J C

V#C2@$Eb{%uN.C_0具体代码如下:

Nk_K#U.w2`s0

&d*fFqLaz0n2WN5o0Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Activate
2@o0g/r#U Deq0'Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").Link("5").Click

4CI!WYmU051Testing软件测试网.C{#U V}w*zDle k9O

If
51Testing软件测试网$l NJ}2?| VX
msgbox Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").GetCellData(2,3)
yM:j }"QO~twgna0Dim row ,link51Testing软件测试网5B*H2yI Acw*Ww \-G
row = Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").GetRowWithCellText(DataTable("p_Text", dtGlobalSheet), 2, 3)51Testing软件测试网]_*`Z XeT'z q
msgbox row51Testing软件测试网{#~:np;}0@ V

51Testing软件测试网D/sgG-Bz.TK k+q^

Set Link = Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").ChildItem(row, 1, "Link", 0)51Testing软件测试网~O/V7a)]T{

51Testing软件测试网$F'VS!Q/OQ D5|

Link.Click51Testing软件测试网0O:RD!xZ+Mp*\C4]

Kvk-mn c0同时,webtable常用的方法还有51Testing软件测试网 hu8t9O5i\8^&VL(]

{5};v,E(I0if  Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").Exist then51Testing软件测试网&z2C A'I*@6y

:o$P9wW+kc,_0reporter.ReportEvent 0,"pass","系统显示了所有的资讯列表!"

.} L:?Yp X;wk4H051Testing软件测试网}H+mQ4X U j

else
?*r$EB5^j7Rl0  reporter.ReportEvent 1,"fail","
系统没有显示资讯列表!51Testing软件测试网6]L` ^QC&j8Dm

?^ X Mp0end if

Ib:o^\1f.G(G0

)yD KbVK0获取表格行数:51Testing软件测试网:j#X)Tw ZvgH V
Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").RowCount
51Testing软件测试网&VSA N;e5BIUx[c


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