Applies to TestComplete 14.30, last modified on November 21, 2019

This topic explains how to diagnose and resolve the “Unable to recognize the image of the current desktop” error that occurs when the test engine fails to find an image on screen during the test run.

If you get this error message when running an image-based test recorded with TestComplete version 10.20 or earlier on an Android device emulator or on an Android virtual machine, read the sections below.

About the Error Message

To interact with black-box applications, TestComplete can use images of objects displayed on the screen.

  • You capture images of the tested controls and save them to the Image Repository.

    Note: For Android applications, TestComplete can capture images and store them to the repository automatically during test recording.
  • You create tests that identify the needed controls by their captured images and simulate user actions over the controls.

  • During the test run, TestComplete searches for image on the screen. If the image is found, TestComplete simulates the user action over the control. If TestComplete fails to find the image, it posts an error message to the test log.

This message indicates that something has changed either in the tested application and its state differs from the state it had when you captured the image.

See the sections below to learn how you can find the cause of the problem and fix it.

Diagnosing the Problem

  1. Explore the test log and find the “Unable to recognize the image on the current desktop” error.

  2. Select the error message in the log and switch to the Details panel in the Test Log panel.

  3. In the Details panel, click the ImageRepository.ImageSet_Name.Item_Name link to open and explore the image in the Image Set editor.

  4. In the Picture panel of the log, examine the image of your screen captured during the test run and check whether the needed control is present on screen.

    As an alternative, examine your actual screen and check whether the needed control is present on it.

    For mobile devices, to explore the tested application and search for the problematic image, you need to connect the mobile device under test to the computer.

    Your tested application must be running. If the application was closed after the test was over, run it again and pause the run on the problematic test command:

    • Set a breakpoint on the command that caused the error.

      Double-click the error message in the test log. TestComplete will open the test for editing and highlight the command that was being executed when the error occurred.

      To set a breakpoint, click the editor’s gutter next to the command or press F9. After the breakpoint is set, the line will be highlighted in red.

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

  5. If the control is not on the screen (for instance, the developers could remove the control from it), than you need to update your test to address the changes in the application.

    If the object is present on the device screen, but TestComplete fails to find it, than to find the cause if the error, perform the step below.

  6. Check the screen resolution, orientation, color scheme, brightness and other visual settings.

    Controls in applications may look different depending on the screen resolution, orientation, color scheme and so on. If TestComplete fails to find an object because the visual representation of the application under test has changed, you need to add images for all possible control representations to the image collection. To learn how to do this, see The screen resolution, orientation or color scheme has changed section below.

Possible Causes of the Problem

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

The object is not present on the screen.

The object has not appeared on the screen by the time TestComplete tries to find it.

The screen resolution, orientation or color scheme has changed.

You are running a test for an Android device emulator or virtual machine recorded with an earlier version of TestComplete.

See Also

Handling Playback Errors
Image-Based Testing
Working With Image Set Editor

Highlight search results