Forum Discussion

rmnastor's avatar
rmnastor
New Contributor
11 years ago

Obtain list of child aliases


Is there a way I can obtain all of an Alias' children.  



For example I have an alias Alias.SomePage.Panel_Main and has these children Alias.SomePage.Panel_Main.Button_Ok, Alias.SomePage.Panel_Main.Button_Cancel and Alias.SomePage.Panel_Main.TextBox_Name.



What I want is to identify the Button_Ok, Button_Cancel and TextBox_Name dynamically using jscript.  Normally this can be easily achieved through FindAllChildren("MappedName","*",1) but that is not the case if I have an extended find enabed somewhere in the aliases involved.



Thanks in advance!



  



  • Hi Rogelio,


     


    You can use FindAllChildren and specify there the needed properties of the object instead of the mapped name. Refer to the "FindAllChildren Method" article - it contains several examples demonstrating this approach.


     

  • rmnastor's avatar
    rmnastor
    New Contributor


    Unfortunately FindAllChildren or any of the Find variants is not useful in this case because the MappedName will not have the correct alias.  This case happens if the Extended Find is used.  The only moment the object's mapped name property to have correct value is when the alias is used as the TC tries to find an exact match.



    My question is, is there a way we can have the children's correct aliases even before we actually use the alias. 


  • rmnastor's avatar
    rmnastor
    New Contributor


    We are interested with the MappedName to have correct alias.  Using findallchildren or any of its variant will not achieve this.



     



    It is like this. 



    Enter Alias: [ Alias.SomePage.Panel_Login                 ] <Show All Children>



        Children List



                TextBox_Login



                TextBox_Password



                TextBox_OK



                TextBox_Cancel



                TextBox_Reset