Selecting Objects for Keyword Test Operations

Applies to TestComplete 15.47, last modified on January 20, 2023

TestComplete includes operations that call methods and properties of windows, controls, and other objects, or simulate user actions on them. All these operations must specify 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

Selecting an object on screen

To specify the object with the target glyph
  1. 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.

  2. 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
  1. Click . This will minimize the TestComplete window.

  2. 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).

  3. 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 in the Mobile Screen window

Requirements

For TestComplete to be able to access a tested mobile application and the device where it is running, they must be prepared for testing. The way to do it depends on the device platform and the technology used to access the device. To learn more, see one of the following:

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

  2. 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
  1. Click . The TestComplete window will minimize.

  2. 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).

  3. 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 About Test Visualizer). 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:

  1. 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.

  2. 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.

  3. 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 and mobile device cloud tests)

You can choose one of the available locators (search expressions) for the object if any of them is available. 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 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