Forum Discussion

Aerlock's avatar
Aerlock
Occasional Contributor
9 years ago
Solved

Getting a list of unmapped items on a web page?

Hi all, I'm new to Test Complete and am trying to work with my Developmnet team to get our app into shape to fully support automation with Test Complete. We've run into several issues with similar or ambiguous names/ids on multiple pages within our app. I would like to know if there is a way I can get a list of the objects that aren't mapped on a web page and some of the properties of those items (name, id, etc.).

 

Is this doable or am I chasing a pipe dream?

 

Thanks,

Mike

  • Hi,

     

    You can iterate through all children objects of your page and check for the MappedName property. If the property contains a value, the object was mapped. Here is a sample code for this:

    function CheckMappedName(obj)
    {
       var chCount = obj.ChildCount;
       if (chCount == 0) return;
       for (i = 0 ; i < chCount ; i++)
       {
        if (obj.Child(i).MappedName == "")
        {
          Log.Message(obj.Child(i).FullName + " isn't mapped");
        }
        CheckMappedName(obj.Child(i));
       }
          
    }
    
    function Test()
    {
      var obj = Sys.Process("notepad"); // specify your object here
      CheckMappedName(obj); 
    }
    

6 Replies

    • Aerlock's avatar
      Aerlock
      Occasional Contributor

      I should have been clearer in my OP. I am looking for a report or export that I can hand to the devs and say "Here's what we need changed to fully support our automation efforts." Currently its a large manual effort to go through and document all the objects that are visible in the Object browser but for one reason or another (usually name, id, or both are missing or unusable) are un-mappable. 

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        I understand what you're trying to do, but how would TestComplete know all about the objects if you haven't mapped them?

         

        The devs should know what their objects, frames, etc. are.  I'd try showing them one that's labeled properly and say "do them all this way please".