QTP 中的ChildObjects

上一篇 / 下一篇  2011-03-30 13:49:49 / 个人分类:QTP

Description

Returns the collection of child objects contained within the object.

返回所有对象中的子对象。

那不是可以不用把当前页面的每个对象都添加到Object Repository中也可以运行了。之后详细的看了该函数的Example:

SubChildObjects_Example()
      '建立一个空属性的对象
       Set Desc = Description.Create()
       '在空的对象中添加属性micclass,并赋值为“WebList”
      oDesc("micclass").Value = "WebList"
       '在制定界面上获取所有属性值为”“weblist”的对象,并赋值给List(注意:赋值后lists类型一个对象数组)
       Set Lists = Browser("Mercury Interactive").Page("Mercury Interactive").ChildObjects(oDesc)
       '获取lists里面所有对象的总数
       NumberOfLists = Lists.Count()
       '遍历数组中所有对象
       For i = 0 To NumberOfLists - 1
       '使用了WebList对象的select的方法
       Lists(i).Select i + 1
       Next
       End Sub


TAG:

 

评分:0

我来说两句

Open Toolbar