Solve object description problems
Relevant for: GUI tests and components
Use this topic to identify and resolve object description issues that can cause object identification failures during a run session.
Identify test object description problems
If you receive a Cannot identify object error even though you can see the object in your application, there is a mismatch between the test object description saved in the object repository and the object description in the application.
Use the following conditions to determine the next step:
| Condition | Next step |
|---|---|
| This problem is due to an intentional change in your application |
If you expect additional discrepancies due to application changes, stop the current run and use Maintenance Run Mode. In Maintenance Run Mode, the test runs and then guides you through updating your steps and object repository when a step fails because of an object repository discrepancy. |
| The object description problem is an isolated occurrence |
Find the discrepancy and fix the description manually. Start by comparing the property values of the test object with the property values of the corresponding object in your application (using the Object Repository and the Object Spy). For step-by-step instructions on how to perform this comparison, see Compare values in the test object to the corresponding values in the run-time object. |
Based on your findings, choose the appropriate next step:
- If one or more object property values conflict: Investigate the object description issue. For details, see Resolve the identified problems.
- If no object property values conflict: Check for parent object description issues. For details, see Identify parent object description problems.
Identify parent object description problems
Each object in your test or component is identified relative to its parent objects.
If you received a Cannot identify object error and the object in the application appears to have matching property values in the object repository and Object Spy, the issue may be in a parent object description. Alternatively, the object may now have a different hierarchy than when it was learned.
To identify which object in the object's hierarchy is causing the problem, try one of the following:
-
Re-record a step on the object and compare the parent objects of the newly learned object with those of the problematic object. If the parent hierarchies are the same, compare the parent object descriptions in the object repository.
For step-by-step instructions, see Re-record an object to identify parent object description problems.
-
Insert an Exist statement for each parent object in the object hierarchy and run this part of the test or component.
For step-by-step instructions on how to create the Exist statements, see Use Exist statements to identify problems.
Tip: You can also use the Highlight in Application option in the Object Repository window to locate a selected object in your application.
After you find the problem with the object's parent hierarchy, try one of the following solutions:
- Fix the object description of the problematic parent object. For details, see Resolve the identified problems.
- Find all instances of the old hierarchy in the Editor and replace them with the correct object hierarchy. For details, see Re-record an object to identify parent object description problems.
Re-record an object to identify parent object description problems
- Open your application to the page containing the object that caused the error.
- Record an operation on the problematic object, such as Click. Then stop recording.
-
Compare the parent hierarchy of the newly recorded object with that of the problematic object. Then use the relevant option below.
Both steps contain the same parent objects The problem stems from a different set of parent objects in the hierarchy - Right-click the new step and select Object Properties.
- In the Object Properties Dialog Box, click View in Repository. The Object Repository opens with the new object selected.
- If you find a problem with a parent description, fix that description. For details, see Resolve the identified problems.
-
Update all instances of the old hierarchy and replace them with the new object hierarchy.
For tests and scripted components: Update all instances of the old hierarchy in the Editor.
- Delete the newly recorded step, because it is not part of your test or component.
- Remove the problematic object from the repository.
- If you are working with a shared object repository, update it with the new object added to the local object repository when you recorded the new step.
Use Exist statements to identify problems
When you record an operation on an object, that object is learned with its full parent hierarchy. If any parent object cannot be identified during a run session, the object itself cannot be identified.
You can easily identify the problematic parent object by using a Msgbox with the Exist method to check each object in the hierarchy.
Suppose you receive a Cannot Identify Object message for the following statement, even though the Link description in the Object Properties dialog box matches the Object Spy description:
Browser("MyCompany").Page("MyCompany").Frame("Navigate").Link("Arts & Humanities").Click
Insert the following statements directly before the problematic statement:
Msgbox Browser("MyCompany").Exist
Msgbox Browser("MyCompany").Page("MyCompany").Exist
Msgbox Browser("MyCompany").Page("MyCompany!").Frame("Navigate").Exist
Msgbox Browser("MyCompany").Page("MyCompany!").Frame("Navigate").Link("Arts & Humanities").Exist
When you run the test or component from the beginning, you find that the first and second lines run successfully and the message box for each displays True.
However, when the third step runs, it is unable to find the Frame object and the message box displays False. This indicates a problem with the Frame test object description.
After you identify a problematic parent object description, fix the description. For details, see Resolve the identified problems.
Resolve the identified problems
An object in your test or component has one or more property values in its description that differ from the corresponding values in your application. Determine whether this problem affects one object or many objects in the same object class.
Determine the next step based on the scope of the problem:
| Condition | Next step |
|---|---|
| The problem applies to all or many objects of the same object class. | Improve the test object class identification. For details, see Solve test object class identification problems. |
| The problem applies to a specific individual object. | Improve the specific object's description. For details, see Solve individual test object description problems. |
Solve individual test object description problems
Choose one of the following methods of fixing the test object description:
-
If you know that the new description in your application is a permanent or long-term change, you can manually modify the property's constant value.
For details, see Maintain test objects in an object repository.
-
If the value of the property depends on a previous step or another object, parameterize the object property, so that it uses the output values from another step.
For details on parameterization, see:
For details about output values, see: Output values in GUI testing.
-
If you expect part of the property value to stay constant, while other parts change dynamically, modify the property value using a regular expression.
For details on regular expressions, see Regular expressions.
-
If you expect the property to change regularly or in an unpredictable way, remove the property from the test object description and add one or more additional properties that will enable unique object identification.
For details, see Remove properties from a test object description and Add Properties Dialog Box.
-
If you can access the property values only during the run session, use programmatic descriptions to identify the object using values retrieved earlier in the run.
For components: You use programmatic descriptions inside user-defined functions.
For details on programmatic descriptions, see Programmatic descriptions.
- In some cases, your object was unique when it was learned, but there are now multiple objects in your application with identical properties. To differentiate between objects based on location on the page, add an ordinal identifier (index or location) to the test object description in the Object Properties or Object Repository window. For details on ordinal identifiers, see Ordinal identifiers.
Solve test object class identification problems
If the description used for a certain object class is not suitable for objects in your application, or if you expect frequent property-value changes, configure how objects are learned and identified.
You can change the learned properties for objects of the problematic class. You can also define Smart Identification so objects can still be recognized when learned properties change during the run session.
For details on changing learned properties, see Object Identification Dialog Box.
For details on configuring Smart description properties, see Smart identification.
Note: Changing how objects are learned does not affect properties of objects already saved in the object repository. You still need to manually modify object properties in the Object Repository or perform an update run operation (Run > Update Run Mode) to update them automatically.

