Aerlock
10 years agoOccasional Contributor
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); }