Working With Toolbars in Desktop Windows Applications

Applies to TestComplete 15.40, last modified on July 05, 2022

Applications use toolbar controls to provide access to the application’s key commands and tools. A window can have any number of toolbars, they can be organized into several rows, displayed or hidden at the user’s desire, and so on.

With TestComplete, you can record and play back various user actions over windows’ toolbars. TestComplete provides a number of program objects that let you work with toolbars in various application types:

  • Win32ToolBar -- Provides a scripting interface to Win32 toolbars.
  • StripToolBar -- Provides a scripting interface to .NET ToolStrip toolbars.
  • WPFToolBar -- Provides scripting access to WPF (XAML) toolbars.

By default, these objects can only be used to work with the corresponding “standard” controls. You can find the list of supported toolbar classes in the project’s Object Mapping options. However, you can also associate a custom toolbar control with one of these objects by adding its class name to the Object Mapping list. This will let you record and simulate actions over your custom control using the methods and properties of the associated scripting object. See Object Mapping for more information.

Besides the mentioned toolbars, TestComplete can also recognize individual toolbar buttons in Java Swing applications, and works with them using the JButton object methods and properties.

The topics of this section provide detailed information on working with Win32, WPF and .NET toolbar controls in TestComplete and contain sample scripts that demonstrate how you can do this. To learn how to work with Android action bar controls, see the Working With Android Action Bar Controls section.

Note: Though the following topics deal with scripts, you can use the same approaches while testing an application from your keyword tests. For more information, see Keyword Tests Basic Operations.

In This Section

Working With Toolbars - Basic Concepts in Desktop Windows Applications

Describes general principles of working with toolbar controls in TestComplete.

Addressing Toolbar Buttons in Desktop Windows Applications

Explains how you can specify buttons in methods and properties of toolbar objects.

Selecting Toolbar Buttons in Desktop Windows Applications

Explains how you can select toolbar buttons from tests.

Checking the Toolbar Buttons' Type in Desktop Windows Applications

Describes how you can determine the toolbar buttons’ type (drop-down, toggle, etc.)

Checking the Toolbar Buttons' State in Desktop Windows Applications

Describes how to determine the current state of toolbar buttons.

Selecting Items From Drop-Down Menus in Desktop Windows Applications

Explains how you can select items in popup menus displayed by toolbar buttons.

Working With Owner-Drawn ToolBars in Desktop Windows Applications

Describes the specifics of working with owner-drawn toolbar controls.

Working With Third-Party Toolbars in Desktop Windows Applications

Explains how you can work with menus created using third-party toolbar components.

Related Topics of Interest

Working With Menus in Desktop Windows Applications

Explains how you can simulate actions over menu controls with TestComplete.

Simulating User Actions

Explains the most common approaches for simulating user actions over applications’ controls.

See Also

Win32 ToolBar Support
ToolStrip Support
WPF ToolBar Support
Object-Specific Tasks
Supported Controls

Highlight search results