Handling 'The window is invisible and thus cannot be activated' Error

Applies to TestComplete 15.69, last modified on November 13, 2024

This topic explains how to diagnose and resolve the “The window is invisible and thus cannot be activated” error that occurs during the test run. The topic contains the following sections:

About the Error Message

Before simulating a click or other action on a control, TestComplete first tries to activate it. If it is impossible, it posts this error message to the log. The message indicates that something has changed in the tested application and that its state differs from the state it had during test recording. This topic explains how you can diagnose and fix this problem.

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. Also, make sure that there is no ambiguous identification warning message.

    The instructions in this topic assume that the first error message is the “The window is invisible and thus cannot be activated” 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.

2. Explore properties

Explore the properties of the desired objects, find the cause of the problem and fix it.

  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 web tests running in remote environments

    See instructions for desktop, mobile tests, and web tests that run on your local computer

    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:

    1. In TestComplete, select Display Object Spy from the Tools toolbar. This will open the Object Spy.

    2. Use the Object Spy to select the needed object on the screen:

      • You typically select a window or control by dragging the target icon () to it. See how it works.

      • If you need to select a hint, menu item or another popup object, use the “Point and fix” mode. See how it works.

      After you select the object, the Object Spy will display its properties.

Possible Causes of the Problem

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

The tested object is invisible.

The object’s identification properties are not valid.

See Also

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

Highlight search results