偶是测试新手,希望前辈们能多多指教。

webRadionGroup和webtable的使用技巧

上一篇 / 下一篇  2009-11-17 16:03:30 / 个人分类:QTP学习相关

 
2009-01-06 10:31

'   演示环境http://newtours.demoaut.com/mercuryreservation.php51Testing软件测试网 F V G c1? J Z
Browser("Find a Flight:Mercury\").Page("Find a Flight: Mercury").WebRadioGroup("tripType").Select "oneway"
g e M G w!v L X10393' all items 获取所有单选框的对象,51Testing软件测试网 ^ z L Y x ^ v
msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("all items")51Testing软件测试网-c!n,p ^ B(t*F Z N&~ o[
'items count 获取单选框的个数51Testing软件测试网 | S%x Q7y!b7h*V3f
msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("items count")
M y$Q f @(L R H'x10393
W W ~&n g-N10393'selected item index   获取当前所选对象index51Testing软件测试网3s;p a N N9O m b k b
msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("selected item index")51Testing软件测试网 R3a ^.v ?2A A#^
msgbox Browser("Find a Flight: Mercury").Page("Find a Flight: Mercury").WebRadioGroup("tripType").GetROProperty("value")

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

具体代码如下:

Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Activate
)k,@;m `/? J#g-@ e a#F10393'Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").Link("5").Click

If
51Testing软件测试网/f"{ @3M3f'H T E6K
msgbox Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").GetCellData(2,3)51Testing软件测试网 k { [ [(b
Dim row ,link
3~$~ D e*B A[10393row = Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").GetRowWithCellText(DataTable("p_Text", dtGlobalSheet), 2, 3)51Testing软件测试网6V F g V3H c B
msgbox row

Set Link = Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").ChildItem(row, 1, "Link", 0)

Link.Click

同时,webtable常用的方法还有

ifBrowser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").Existthen

reporter.ReportEvent 0,"pass","系统显示了所有的资讯列表!"

else
;k*q {&s { C10393reporter.ReportEvent 1,"fail","
系统没有显示资讯列表!

end if获取表格行数:51Testing软件测试网'i D C7t2i T `4pb l
Browser("欢迎使用信贷综合管理系统").Window("查询 -- 网页对话框").Page("查询").WebTable("序号").RowCount


TAG:

 

评分:0

我来说两句

Open Toolbar