wButtonPos Property (ToolBar and MenuBar Controls)

Applies to TestComplete 15.64, last modified on May 16, 2024
This property is not supported in web tests (including cross-platform web tests) that use XPath expressions and CSS selectors to locate web elements. This property can be only used in tests that locate web objects by using internal identification properties provided by TestComplete.


Use the wButtonPos property to obtain the position of the control item specified by the Item parameter.



Read-Only Property Integer
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Item [in]    Required    Variant    

Applies To

The property is applied to the following objects:

View Mode

To view this property in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.


The property has the following parameter:


Specifies the desired item. You can enter the item’s index (from 0) or its caption. The caption can contain asterisk (*) or question mark (?) wildcards or regular expressions. The asterisk (*) corresponds to a string of any length (including an empty string), the question mark corresponds to any single character (including none). To specify more complicated parts of a caption, use regular expressions.

The caption can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting.

Property Value

An integer value that specifies the item position (from 0) on the control.


  • Win32 ToolBar, WPF ToolBar, Microsoft ToolStrip, MFC Toolbar, MFC Menu Bar

    If the specified item is not found, the wButtonPos property returns -1.

  • Telerik RadToolBar for ASP.NET AJAX, Syncfusion XPToolbar, Bootstrap Button Group, Bootstrap Button Toolbar, Bootstrap Navigation Bar, Oracle Forms Button Bar

    If the specified item is not found, the wButtonPos property fails and posts an error message to the test log.

  • Infragistics UltraWebToolbar

    If the specified item is not found, the wButtonPos property returns 0 and posts an error message to the test log.

  • Desktop testing: If TestObj refers to an object of a non-DPI-aware application running with a DPI setting other than 100%, the property returns a value relative to the application (as if the application is running with the 100% DPI setting).

  • Web testing: If the Use CSS pixels for scaled pages option is enabled (by default), the returned value takes into account the browser zoom and the current DPI setting.

  • If you use Python or DelphiScript, you should enclose the parameter of the wButtonPos property in square brackets: wButtonPos[Item].

  • The total number of control buttons is specified by wButtonCount property.

See Also

Addressing Toolbar Buttons in Desktop Windows Applications
wButtonCount Property (ToolBar and MenuBar Controls)

Highlight search results