Forum Discussion

Novari-QA's avatar
Novari-QA
Frequent Contributor
7 years ago

Custom HTML Attributes not being found by TestComplete?

I cannot get TestCompletes name mapping feature to find html objects based on custom html attributes.  


I have a textbox for example that looks like this
<input class="classname" id="textboxID45874486997" type="text" data-auto="mytextboxid">

 

However, We have a lot going on right now with our project changing around and elements changing names etc.  I want the ability to tell the developers "Hey, you see this attribute called data-auto, yah, do not ever touch it"

This way, my scripts aren't breaking all the time when they do things like change ids. I find it very bizarre that TestComplete doesn't have this feature. Am i missing something?

  • I found it. 

    I needed to switch from basic mode to conditional Mode
    Then select Property and the type "Type Property Name"

    Click enter, and then select value to be what ever you want.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    When you're mapping the object, if you scroll down the list of properties, you should see something that says "attributes [object]". Click in that field and an ellipses will show up.  Click that and you'll go to the attributes on the object.  Highlight the one you want and click the button to add it to your selected list.

     

    • Novari-QA's avatar
      Novari-QA
      Frequent Contributor

      Sorry, I have tried that. It only shows me the Length. I want it to look for the element with this data attribute.  See Image

       

    • Novari-QA's avatar
      Novari-QA
      Frequent Contributor

      I can do this. 
      Aliases.browser.page_General_Login.Find("data-Automation","username", 1000, true);
      However i do not want to write it out in code. I want to be able to find it via the name mapping feature.

      • Novari-QA's avatar
        Novari-QA
        Frequent Contributor

        I found it. 

        I needed to switch from basic mode to conditional Mode
        Then select Property and the type "Type Property Name"

        Click enter, and then select value to be what ever you want.