如何遍历WebTable中的单元格

上一篇 / 下一篇  2009-09-05 23:10:45

QTP中的WebTable测试对象提供了RowCount和ColumnCount,可用于遍历WebTable中的所有单元格。

  1. Set wtObj = Browser(XXX).Page(XXX).WebTable(XXX)
  2. For i = 1 To wtObj.RowCount
  3. For j =1 To wtObj.ColumnCount(i)
  4. 'Set cellLink = wtObj.ChildItem(i,j,"Link",0) '取每个单元格中的链接对象
  5. msgbox wtOjb,GetCellData(i,j) '取每个单元格的内容
  6. Next
  7. Next

其中用到了两个方法
object.ChildItem (Row, Column, MicClass, Index)
object.GetCellData(Row, Column)
Row – 行号
Column – 列号
MicClass – 对象的类型
Index – 对象的索引序号,比如如果取第一个符合条件的对象,则index=0


TAG:

 

评分:0

我来说两句

Open Toolbar