Returns the collection of child objects contained
within the object.
返回所有对象中的子对象。
那不是可以不用把当前页面的每个对象都添加到Object
Repository中也可以运行了。
该函数的Example:
Sub ChildObjects_Example()
'The following example uses the ChildObjects
method to find all the
'list objects on a Web page, and then to
select an item in each list. '建立一个空属性的对象
Set oDesc = 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
Function
WebLinkClick_Function_Module(IsHaveFrame,Object_Browser,Object_page,Object_Frame,LinkName)
Dim m_Link
Dim All_Link
Dim Count
Dim AllLinkName(3000)
Dim i,j,k
k = 0
If IsHaveFrame= "" OR
IsHaveFrame>1 Then IsHaveFrame = 1
End If
Set m_Link=Description.Create()
m_Link("Link").Value="link"
If IsHaveFrame = 0 Then Set
All_Link=Browser("" & Object_Browser & "").Page("" &
Object_page & "").ChildObjects(m_Link) Else Set All_Link=Browser("" &
Object_Browser & "").Page("" & Object_page &
"").Frame("" & Object_Frame &
"").ChildObjects(m_Link)
End If
Count=All_Link.Count() For i= 0 To Count -1
AllLinkName(j) =All_Link(i).GetROProperty( "Text" )
If AllLinkName(j) =LinkName Then
All_Link(i).click
Exit For End If j = j +1 Next
End Function