Forum Discussion

Natasha_2012's avatar
Natasha_2012
Contributor
8 years ago
Solved

how to find all children of a test object regardless of its property names and values

I have a window object, i want to grasp all of its objects inside that window object, regardless of the its property name and values.  Could you please help me show me how.  The FindAll and findAllObjects require the property names and values

 

 

  • You can capture the object whose child objects are required.

    Later ChildCount property could be used to get the count and Child (Index) to iterate through the children.

     

    Consider the following VBScript snippet:

    Dim iChildCount,arrChildObj
    
    Set objParent = page.find(arrProp,arrValue,Depth)     'get the parent Object
    iChildCount = objParent.ChildCount                          ' no of child object
    
    For i = 0 To iChildCount
      Set arrChildObj(i) = objParent.Child(i)
    Next

     

3 Replies

  • You can capture the object whose child objects are required.

    Later ChildCount property could be used to get the count and Child (Index) to iterate through the children.

     

    Consider the following VBScript snippet:

    Dim iChildCount,arrChildObj
    
    Set objParent = page.find(arrProp,arrValue,Depth)     'get the parent Object
    iChildCount = objParent.ChildCount                          ' no of child object
    
    For i = 0 To iChildCount
      Set arrChildObj(i) = objParent.Child(i)
    Next

     

      • Colin_McCrae's avatar
        Colin_McCrae
        Community Hero

        Presume you could also use "FindAllChildren" as normal as well.

         

        Except use "Id" as your property (as all objects have an Id don't they?), "*" as the property value (so it'll find everything) and a depth of 1 (to only get direct children of the parent).

         

        You could also modify this to exclude hidden objects by expanding the search parameter arrays.