Forum Discussion

reshma's avatar
reshma
Occasional Contributor
10 years ago

Test complete is not capturing the customized properties?

In our web application, developer has added 'auto-id' property for all the objects to make our tasks easier to identify the objects by unique id.


We can able to see this property in Firebug of FF. But we couldn't find this property by using object spy and unable to map the object with it.

Is it any way to map the objects by using the newly added property?

  • Object Browser shows only the standard HTML and DOM properties and attributes. Custom attributes are accessible via the getAttribute and setAttribute methods.

    But since custom attributes are included in outerHTML, you can map objects by partial outerHTML. For example, if you have this link:

    <a auto-id="my-link" href="http://example.com">Click me!</a>

    you can map it as follows:

    ObjectType: Link
    outerHTML: *auto-id="my-link"*

     

    Asterisks (*) around the value mean "any string" before and after the value.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I believe that this property should be visible in the HTML markup of the given UI element (check the outerHTML property in the Object Browser). If my guess is correct, than you can search for the object with the required auto-id using .EvaluateXPath and/or .FindChildByXPath methods.

    • reshma's avatar
      reshma
      Occasional Contributor

      Hi Alex,

       

      Thanks for your quick response.

       

      Yes.. You are right. I can see the property in outerHTML.

       

      Is there no way to map the object in namemapping instead of find the object in script by using EvaluateXpath() and FindChildByXpath() ?

       

      We are working in TestComplete for the past few years and we are using NameMapping instead of find the objects in script. Most of the objects in our application dont have unique id, so we fully depent on the object hierarchy. Recently few panels were introduced in between existing objects, so namemapping get broken. To make the script more robust, developers introduced a new property called 'auto-id' for all the objects. I thought that if we map the objects with this new property and enable 'extend find' feature, we can avoid name mapping issues in future though new objects would be included in between the existing one.

       

      Unfortunately object spy didn't capture the newly added property. So I have redo existing scripts by finding the objects by using EvaluateXpath() and FindChildByXpath() and eliminate namemapping? It will take lots of time for us to rework.

       

       

       

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        Object Browser shows only the standard HTML and DOM properties and attributes. Custom attributes are accessible via the getAttribute and setAttribute methods.

        But since custom attributes are included in outerHTML, you can map objects by partial outerHTML. For example, if you have this link:

        <a auto-id="my-link" href="http://example.com">Click me!</a>

        you can map it as follows:

        ObjectType: Link
        outerHTML: *auto-id="my-link"*

         

        Asterisks (*) around the value mean "any string" before and after the value.