Testing Owner-Drawn Controls

Applies to TestComplete 14.81, last modified on May 04, 2021

In order for TestComplete to manipulate individual items in a tested control, it needs a way to identify and specify them. For this purpose, TestComplete uses either item caption or index. Captions are preferred over indexes, because they make tests more readable and stable, whereas indexes are less easy to understand and, moreover, they may change during the run (for example, after the items have been sorted).

While standard controls are drawn by the operating system, Windows also lets application developers handle drawing of GUI controls from the application code. Such controls, drawn by an application rather than the operating system, are called owner-drawn. Besides custom look, items in owner-drawn controls may have arbitrary (non-text) contents, such as images. Because of this, TestComplete records item selection in owner-drawn controls using item indexes:

  • Selection of combo box, list view, tree view, header, menu items and tabs is recorded using the item index.

  • Clicks on list box items are recorded using the item index and the coordinates of the click point within the item.

  • Selection of toolbar items is recorded using the item ID.

To specify control’s items by text, try using the appropriate approaches described in the Object Identification section. For other tips on dealing with non-standard controls, see Ways to Interact With Application Objects.

See Also

Working With Application Objects and Controls
About Working With Application Objects and Controls
Object Identification

Highlight search results