Forum Discussion

madams's avatar
madams
Occasional Visitor
8 years ago

Using element attributes other than ID to identify web objects.

Hi,

 

I have a .NET web application that I am testing which has a dynamically generated menu tree to access different web modules.  The ID element changes dynamically based on the number of web modules loaded for the user.  Therefore, it is not a reliable element to use to identify objects.  How does one utilize other attibutes in the element in a keyword test?

 

Thanks,

Matt

2 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Without an example to look at, offhand I would say you could use a text field or a label along with wildcards to find your objects.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      I agree with Marsha_R... whether you are using direct element identification in your scripts or if you're using NameMapping, you can use any number of properties and such for any application object to uniquely identify it. If the ID changes dynamically, obviously that's not a useful property so labels, class, type, child objects, etc., all can play a part in uniquely identifying objects. I'd strongly suggest using NameMapping as that allows a great amount of detail in identifying behind the scenes without needing to include that detail in your actual keyword tests or scripts.