Why Do I Get an Invalidated-Handle Error?

This topic describes what you can do when Silk Test Classic displays the following error message: The handle for this object has been invalidated.

This message indicates that something caused the object on which you called a method, for example Click, to disappear. For example, if something causes the browser to navigate to a new page, during a method call in a web application, all objects on the previous page are automatically invalidated.

When testing a web application, the reason for this problem might be the built-in synchronization. For example, suppose that the application under test includes a shopping cart, and you have added an item to this shopping cart. You are waiting for the next page to be loaded and for the shopping cart to change its status to contains items. If the action, which adds the item, returns too soon, the shopping cart on the first page will be waiting for the status to change while the new page is loaded, causing the shopping cart of the first page to be invalidated. This behavior will result in an invalidated-handle error.

As a workaround, you should wait for an object that is only available on the second page before you verify the status of the shopping cart. As soon as the object is available, you can verify the status of the shopping cart, which is then correctly verified on the second page.