Forum Discussion

teefryingpan's avatar
teefryingpan
New Contributor
8 years ago

Why do my dropdown objects in GUI windows change identity each time I run my tested application?

I'm new to TC.

 

I am running and recording keyword tests on an Excel Add-In Toolbar which is primarily GUI with many buttons and controls.

 

There is one button that when clicked opens a Window. TC can properly find this window and identify it as a .NET ObjectBuilderForm.

 

In the window there is a drop down menu. When clicked, TC identifies this menu as elementHost13. Now when I run the keyword test, it works ok. But when I close Excel and reopen and rerun, it never works again. With more investigation, it turns out that the same exact drop down bar in the same exact Window that is opened through the same exact strokes is unable to be found, because it's now known as elementHost14. And repeating everything again, the next time I try it's now known as elementHost15.

 

Why is the same element always changing? This is making it impossible for me to run tests because the object I need to access can never be recognized.

 

Thanks in advance.

1 Reply

  • NisHera's avatar
    NisHera
    Valued Contributor

    May be object property that TC is mapping is created crated dynamically eg.  name = elementHost12 where 12 can be changed on run time. Or simply when TC looking for object it is not fully created and could not recognized.

     

    Anyway letting TC to AutoMap object is not a good practice. You will end up with huge amount of unwanted object mapped and face wired situation such as this one.

     

    so I recommend manually map objects what you really need. Specially once that are in top of object hierarchy and search most child objects using those mapped objects.

     

    for this particular situation try manually mapping the object using unique properties.

     

    you can read more in here