Hi Jay,
It is possible that you have a button (e.g.
Next) mapped by a specific name (e.g.
btnNext). When a new screen is opened in your application, a new button which is a copy of the original
Next button is created and displayed. At the same time, the original button is not destroyed, but it is just made invisible.
In this situation, when a TestComplete test works with the
btnNext object for the first time, it searches for the
Next button and assigns a reference to this button to the
btnNext name. When the second screen is displayed, the test tries to access the
btnNext object again. The tool sees that a reference to an object was already assigned to this mapping name and checks whether the referenced object is live. Since the old button exists, the tool does not try to search for the
Next button again in performance reasons and try to use the old button. Since the old button is not visible, the test fails.
If this is the case, you need to modify the mapping criteria of the
btnNext object in order to make it reference the valid button. You can do this by adding the
Visible or
VisibleOnScreen properties with the
true value to the mapping scheme of the
btnNext object. Information on how to do this can be found in the
Modifying Mapping Criteria help topic.
Please note that in addition to the above step, you need to tell TestComplete to search for the
Next button even if the
btnNext object has a reference to an existing object. You can do this by calling the
RefreshMappingInfo method for the
btnNext object right before trying to access this object for the second time. You can find information on this method in the
RefreshMappingInfo Method help topic.
Please let me know if the above information helps.