Selecting Objects for Keyword Test Operations

Applies to TestComplete 14.40, last modified on April 22, 2021

TestComplete includes operations that call methods and properties of windows, controls, and other objects, or simulate user actions on them. All of these operations have a parameter that specifies the object, with which the operation will work. Usually, when you add such an operation to a test or edit the operation, TestComplete shows the Select Object page where you can select the needed object.

The image below shows the Select Object page of the On-Screen Action operation. For other operations, the page looks similarly:

Select Object Page

You can point to the needed object on the screen, enter the object name manually or choose the object by its alias from the list.

Selecting an Object From Screen

There are two ways to select an object from screen:

  1. Pick the desired object with the target glyph ().

  2. Point to the object with the mouse.

To specify the object with the target glyph
  • Click the target glyph () and keep the mouse button pressed as if you are going to drag the icon. In doing so, the TestComplete window minimizes.

  • Drag the icon to the desired window or control and release the mouse button over this object (while dragging, a red frame will indicate the object that is under the mouse pointer).

TestComplete will display the full name of the selected object in the Object box. If automatic name mapping is enabled, this will be the mapped name. See below.

To point to the object with the mouse
  • Click . This will minimize the TestComplete window.

  • Activate the desired window or control and position the mouse pointer over it (while moving the mouse pointer, a red frame will indicate the object that is under it).

  • Press the Select object shortcut, Shift+Ctrl+A. The shortcut can be changed in the Global Shortcuts dialog.

TestComplete will display the full name of the selected object in the Object box. If automatic name mapping is enabled, this will be the mapped name. See below.

Selecting Objects On Mobile Screen

The Mobile Screen window displays the screen of the mobile device (or virtual machine) under test. If your tested mobile application is Open, you can select its objects in the Mobile Screen window:

To specify an object with the target glyph
  • Click the target glyph () and keep the mouse button pressed as if you are going to drag the icon. the TestComplete window will minimize.

  • Drag the icon to the desired control in the Mobile Screen window and release the mouse button over this control (while dragging, a red frame will indicate the object that is under the mouse pointer).

TestComplete will display the full name of the selected object in the Object box. If automatic name mapping is enabled, this will be the mapped name. See below.

To point to an object with the mouse
  • Click . The TestComplete window will minimize.

  • Switch to the Mobile Screen window and position the mouse pointer over the desired control (while you are moving the mouse pointer, a red frame will indicate the object that is under it).

  • Press the Select object shortcut, Shift+Ctrl+A. The shortcut can be changed in the Global Shortcuts dialog.

TestComplete will display the full name of the selected object in the Object box. If automatic name mapping is enabled, this will be the mapped name. See below.

Selecting an Object From Visualizer Frame

A keyword test operation may have a Test Visualizer image (frame) associated with it. The frame indicates the state of the tested application before the operation is executed. Test Visualizer can record frames during test recording or execution (see Test Visualizer -- Overview). If the Capture tested objects properties option was enabled during recording or test run, a frame also contains information about objects that are shown on this image. So, when creating an operation, you can select the desired object from the frame. To do this:

  • Before calling the Operation Parameters wizard:

    If you create a new command, select the desired image in the Test Visualizer panel. You will choose an object displayed on this image.

    If you are editing an operation, then there is no need to select an image in the Test Visualizer panel. TestComplete will always use the image that was recorded for the operation being edited.

  • In the Operation Parameters wizard, click Select object in Visualizer.

    If TestComplete can find an image for the operation, it will invoke the Visualizer Frame dialog. If it is unable to find the image (for instance, if there is no image associated with the selected operation, or a Visualizer frame does not contain object data), it will display an error message.

  • In the dialog, click the desired object. Note that when you are moving the mouse cursor over the window, TestComplete highlights the object under the cursor with a red rectangle and shows the object's name in the status bar.

In some cases, Test Visualizer cannot select the desired control. If this happens, start the application and select the object from screen.

After you click the object in the dialog, TestComplete will close the dialog and display the full name of the object in the Object box. If automatic name mapping is enabled, this will be a mapped name. See below.

Entering Object Name Manually

If you know the full name of the target object, you can enter it manually. Simply type the object name into the Object box and press Enter. If automatic name mapping is enabled, TestComplete will replace the object name in the Object box with the mapped name. See below.

Selecting an Object by Its Alias

If an object is mapped, you can specify it by its alias. To do this, select the object’s alias from the Aliases tree at the bottom of the dialog.

Note: If TestComplete is configured to map objects automatically and you point to the needed object on the screen, TestComplete will add the object’s alias to the Aliases tree and select the object in it. Otherwise, click Map New Object and map the needed object in the resulting Map Object dialog manually.

Selecting an Object by Its Locator (for cross-platform web tests)

If the selected object is a web object and support for cross-platform web testing is enabled in your project, you can select one of the available locators (search expressions) for the object (if any is available). To do this, you click  and select the needed locator from the drop-down list.

Tips for Selecting Objects

  • You may find the “point to the object” technique more convenient than using the target glyph, because it allows you to manipulate applications before actually selecting the object. For example, you can open the tested application’s window containing the desired control and so on. Unlike using the target glyph, this technique allows you to point to popup windows, tooltips and other objects that are hidden in the application when being inactive.

  • To select a non-onscreen object, such as a process, enter the object name manually.

  • If the Engines > Name Mapping > Map object names automatically option is enabled, TestComplete will automatically map windows, controls, or objects that you have selected on the screen or whose name you have entered into the Object box (if the object is not mapped yet). The mapped name will be used to address the object in tests. For more information on name mapping, see About Name Mapping.
  • Instead of selecting the object, you can copy its name from the Object Browser, keyword test or script code beforehand and paste it into the Object box.

  • Despite the way you specify the object name, you can change or correct it directly in the Object box.

See Also

Keyword Tests
Operation Reference
Name Mapping
Mobile Screen Window
Selecting an Object on the Mobile Screen (Android Testing)
Select an Object on the Mobile Screen (iOS Testing)

Highlight search results