Forum Discussion

praveenRV's avatar
praveenRV
New Contributor
8 years ago

Identify WPF object uniquely which is best practise.

My application will generate more tree view items where all tree view items is similar i cant able to verify this part unless and untill if we get a unique value to automate. kindly provide me suggestion on this.

  • What I would do then would be to not map, specifically, that object but, in your code, grab it dynamically by creating a function to find it based upon a parameterized text string.  Reference the "FindChild" method.  In looking over the object properties, there is little else that I would trust as being able to give a unique property.  I would suggest using the class name and the ID, but I know ID's sometimes shift and change.

     

    Your other option would be to utilize configurations in your name mapping.  Create a configuration for each locale and change the value of "Text" appropriately for each configuration.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Well, I think the basics are usually ObjectType and ObjectIdentifier... those are universal for most objects in TestComplete.  From there, you can start looking at things like Caption, contentText, classname, etc.  

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Also, object hiearchy plays a part.  Aliases.MyApp.Form1.TreeView is different than Aliases.MyApp.Form2.TreeView.  The TreeViews could have the same identifying properties but, because they are child objects of two different forms, they are identified uniquely.

      • Marsha_R's avatar
        Marsha_R
        Moderator

        Can you show us ObjectSpy results for two or three of the views?