Forum Discussion

at1_olsb's avatar
at1_olsb
New Contributor
14 years ago

How to obtain Child window (depth > 1) using FindID method

Hello,



I faced problem to obratin child window(depth>1) using FindID method. 

It seemds that FindID method works only for first level childs of parent.... Please correct me if i wrong.



Example of my code.



set child_window = Sys.FindId("id",true)



child_window.exists - always == false, because searching window exists on depth > 1...



4 Replies

  • Here is the recommandation solution for your problem/issue.



    use FindChild() method, that find out child window depth > 1



    below is the code snippet:



    function ABC()

    {

     -----;

    ----;

    var TestObj =  xyz.WinFormsObject("abc");

    var ChildObj = TestObj.FindChild(Array("ObjectType","ObjectIdentifier"),Array("CheckBox","CheckBOX_ID2"),1) ;

    -----;

    ---;



    }



    OR



    FindChild(Array("ObjectType","CheckBox"),1) ;




  • Hi Alex,


     


    The FindId method looks for the window based on the object ID. As you are searching for the window, you'd better use the FindChild method as Kumar suggested. BTW, by default, the method finds only children. If your object is located deeper in the object tree, you may specify Depth for search.


     

  • at1_olsb's avatar
    at1_olsb
    New Contributor

    Thank you for quick response!


     


    I used FindChild method ... but sometimes i didn't know what depth should be for particular window. So i thought that FindID will help me. Also if i have a huge object tree FindChild method works too slow if depth>8 for example...


    But anyway thanks


  • Hi Alex,


     


    The test execution is expected to get slower when you set a big depth. The method is iterating through all the children of the object from which you call it in the object tree.