(转载)【QTP】取出WebTable中的数据
上一篇 /
下一篇 2013-06-14 15:51:25
先上一段脚本:
-
- Dim otable
- Set otable = Browser("XXXXX").Page("XXXXX").WebTable("XXXXX")
-
- oRow = otable.RowCount
- print "oRow = " & oRow
- oCol = otable.ColumnCount(2)
- print "oCol = " & oCol
-
- Dim temp
- For i = 1 to oRow
- temp = ""
- For j = 1 to oCol
- temp = temp & otable.GetCellData(i,j) & " | "
- Next
- print temp
- Next
-
- Set otable = Nothing
这段脚本只是打印出WebTable中所有的内容。
然后介绍WebTable中最常用的2个方法
GetCellData的作用是获取指定单元格(指定行,指定列)的值
用法:object.GetCellData(Row, Column)
如:
ChildItem顾名思义就是子对象啦,比如需要勾选WebTable中的一个勾选框(WebCheckBox)。
用法:object.ChildItem (Row, Column, MicClass, Index)
MicClass:对象控件的类名,如List、WebButton等。
Index:一般就填写0就好了。
如:
- Set oWebCheckBox =otable.ChildItem(3,1,"WebCheckBox",0)
- oWebCheckBox.Set"on"
- Set oWebCheckBox =Nothing
收藏
举报
TAG: