Ask a Question

Common approaches to the 'Object Not Found' error


Common approaches to the 'Object Not Found' error

This error is the most common issue you will run against when doing automated testing, reliably finding controls in your application. With that there are a few methods you can follow to do basic troubleshooting and ideally fix the problem.


1) Get familiar with the Object Spy:


This little buddy is the object spy. This is used to take a look at your application and find all the properties, values and various other helpful info. The first thing you should do when you have an object recognition error is to use the spy to look at your control and get familiar with it. Find out if there is a unique name, property values that look dynamic, etc. The more you know about the control the easier it will be to fix.




2) Understand what the error is saying


There are two sections in the Additional Info tab for the Object Not Found error that you want to pay attention to. The first section is the control TestComplete was looking for and the second is the control we couldn't find. There are only two choices really, you couldn't find the control you were looking for or you couldn't find one of it's ancestors. If you are dealing with the control not being found you will want to look at tip #3, if it is an ancestor tip #4.


Now we need to get into the name map to deal with these issues. Clicking on the bottom link next to 'Name mapping item' will take you directly to the offending control!




3) Editing a control that can't be found


Once in the name map we will need to get our Object Spy back in action. The big thing here is that we need to know what is different about the control than what we have in the name map. After you have the object selected in the spy, search for the properties listed in the name map and see what is different. Sometimes an index has changed, a controls text may be different, or really anything could have changed.


Your job is to now figure out what properties won't change so that you can uniquely find the control every playback. Right-clicking on the control in the name map gives you the ability to edit the control and add/remove properties and change their values. There is also an option to 'Highlight on-screen' which will, if TC can see the control based on the name map, highlight your object. Some typical properties to look for are text values, object types, inner html, etc. These will generally have something stable to key off from. 


The last tip is to use the wildcard "*". This will allow you to ignore portions of a property that may change. Say your URL is and that number sequence changes each time. You can change the property to look for "**.html". Then no matter what the URL changes to, as long as it matches that pattern you will find the object!


4) Bypassing difficult parents


This tip is just for getting around parent items that can't be found. If I am looking for a button that says 'Login', I'm sure that can be found reliably. If I can't find the panel that it lives in though, we have a problem. That is where the 'Extended Find' option comes into play.


Turn on 'Extended Find' for your control and then, in the name map items area, drag it up to a stable parent. To find that stable parent use the 'Highlight on screen' option up and up the hierarchy until you find something that works reliably. Then just drag your newly extended control up to that stable parent. This is telling TestComplete 'Somewhere in the hierarchy below this control is a button called 'Login', search all the children paths until you find it'. 


These articles will detail the tips and features above. Hopefully they help!


About the object spy:

Other methods for working with Object Not Found errors:

Using Extended Find:


- G -

Super Contributor


Showing results for 
Search instead for 
Did you mean: