Forum Discussion

naveens33_'s avatar
naveens33_
Contributor
3 years ago

Desktop: Want to find a element in the hierarchy through the Sibling

In the below image, I want to find the highlighted element via its sibling WPFObject("TextBlock","FirstName",1). Any hope?

 

  • naveens33_'s avatar
    naveens33_
    3 years ago

    Currently I did a workaround for this

     

    find_following_sibling_element = lambda child1,element_name,depth=0 : child1.Parent.FindChild('Name',element_name,depth)
    • naveens33_'s avatar
      naveens33_
      Contributor

      Marsha_R 

       

      I am looking for any optimized way or build-in methods of TC to find element through its sibling.
      Currently I did a workaround like this,

      Aliases.TactService.HwndSource_MainWindow.CommonWindow.ItemsControl1.ListBox.TextblockFirstName.Parent.FindChild('Name','WPFObject("TextBox","",1)')

       

      • naveens33_'s avatar
        naveens33_
        Contributor

        Currently I did a workaround for this

         

        find_following_sibling_element = lambda child1,element_name,depth=0 : child1.Parent.FindChild('Name',element_name,depth)