Object recognition hints in the test log can help you troubleshoot “object not found” errors that occur due to outdated property values in Name Mapping. These hints suggest partial matches for unfound objects. You can check if the candidate is indeed the correct object, and if so, update its mapping properties with just a couple of clicks.
Sometimes, an object is not found because the object or one of its parent objects was renamed in the application, or some of its properties were changed.
Suppose you are testing a web application with the following object hierarchy:
The objects are mapped as follows:
form ObjectType = "Form", ObjectIdentifier = "aspnetForm"
Form("aspnetForm") object was renamed in the application and now it appears in the Object Browser as
Since the new ID loginForm differs from the value aspnetForm specified in Name Mapping, the form and its child objects can no longer be found, which will trigger “object not found” errors.
Understanding object recognition hints
When an object is not found by the property-value pairs specified in Name Mapping, TestComplete checks the neighboring objects in the tested application to see if there is a partial match. This can be, for example, a an object of the same type with a slightly different text. If your tested application has been updated recently, this partial match may be the object your test needs.
If a partial match exists, TestComplete logs a hint that informs you about that. The hint lists the property values of the found object compared to those specified in Name Mapping. Mismatching properties are marked with a red icon.
|The object described in the hint (the one that is in red) is not necessarily the same object as in the “object not found” error. It can be one of its parent objects that was not found, and which actually caused the error.
If Test Visualizer is enabled in the project, you can see the image of the candidate object on the Picture tab. The candidate is highlighted with a blue frame in the application screenshot.
Where in the test does the problem occur?
Double-click the hint in the test log to jump to the test command that triggered the object recognition hint.
In the test log, click the object name (in red) in Details to jump to the mapped object in the Name Mapping editor so that you can see this object in the context.
Is the candidate the right object?
Compare the expected and actual properties listed in the hint. Do the differences indicate that it is the same object that was renamed or changed?
Check the image on the Picture tab. Does the image match the object name mentioned in the hint? Is the candidate object in the right part of the application?
If so, fix the identification properties.
If the suggested candidate is the right object indeed, you can use the links in Details to update the identification properties in Name Mapping. The links work as follows:
Update - Replaces the property value in Name Mapping with the corresponding property value of the candidate object. This action is available only for intermediate objects in the hierarchy.
Delete - Deletes this property from Name Mapping so that it will not be used to identify this object anymore.
After you update Name Mapping, run the test again to see if it works as expected now.
How candidates are chosen
Candidates are chosen among sibling objects on the same level of the object hierarchy, or, if Extended Find is used, among objects on the levels below.
The candidate is the object that has the same
ClassName (whichever property is used in Name Mapping). The other properties may differ.
TestComplete picks just one candidate - the first one found - and does not search further.
Object recognition hints are limited to two hints per an “object not found” error.