Handling the 'Unable to Find the Object' Error

Applies to TestComplete 15.63, last modified on April 10, 2024

About the error message

TestComplete considers process, windows and controls as objects. When executing a test command over them, it first checks whether the object exists in the system and then executes the needed method or property of this object. The test engine posts the “Unable to find the object...” message to the test log when it fails to obtain a reference to the object that you specified in your test. Below are two typical examples of the script code, whose execution causes this error (Button1 is the name of the object that does not exist):

JavaScript, JScript

var someVariable = form.Button1;


someVariable = form.Button1


Set someVariable = form.Button1


  someVariable : OleVariant;
  someVariable := form.Button1;

C++Script, C#Script

var someVariable = form["Button1"];

The message indicates that something has changed in the tested application and its state differs from the state it had during test recording or creating. Let’s see how you can find the cause of the problem and eliminate it.

Diagnosing the problem

1. Explore the test log
  1. Find the first error message in the test log. Depending on the command being executed, TestComplete may post several error messages to the log. This happens due to certain specifics of the test and script engines functioning (the script engine is used even when you run keyword tests, not scripts). Typically, the first error message corresponds to the problematic command and further errors are caused by this first error. These instructions assume that the first error message is the “Unable to find the object object_name” error.

  2. To better understand what test command was executed when the error occurred, double-click the error message in the test log. TestComplete will open your test for editing and automatically highlight the line that was executing when the error occurred.

    By exploring your test, you can determine the full name of the missed object.

2. Explore the tested application

Check whether the desired object exists in the tested application. For instance, developers could change the tested application and remove the tested window or control from it. This change could cause the error in your test:

  1. The tested application must be running and have the same state it had when the error occurred. If the application was closed after the test run, you can start it again and pause the run on the problematic test line. To do this:

    1. Set a breakpoint on the problematic line in the script test or keyword test operation. To find that line or operation quickly, double-click the error message in the test log. TestComplete will switch to the test editor and highlight the line or operation that caused the error. To set the breakpoint, click the editor’s gutter next to the line or operation, or press F9.

    2. Run your test. The test engine will automatically pause the test run when it reaches the breakpoint.

  2. Examine your application and check whether the desired object exists. For instance, developers could change the tested application and remove the tested form or button from it. This change could cause an error in your test.

    See instructions for cross-platform web tests

    See instructions for desktop, mobile tests, and web tests that implement the default approach

    If the object does not exist in the application, re-record your test or update its commands to match the tested application.

    If the object exists, then, to find the cause of the error, explore properties of the problematic object:

Possible causes of the problem

Below are typical causes of the problem and typical ways to eliminate them.

Web tests: There is no object that matches the specified search expression

Web tests: The tested web application is not available publicly

The object name is misprinted.

The object name has changed.

The object’s position in the object tree was changed.

The object has not been created by the time TestComplete tries to obtain it.

The tested application stopped responding.

The object tree model differs from the model that was used to create the test.


To learn how TestComplete locates objects in tested applications, why it may fail to find the objects, and how to handle this, you can also take a video course in our SmartBear Academy:


See Also

Other "Object Not Found" Errors
Name Mapping
Object Browser Naming Notation
About Object Browser

Highlight search results