ClickButton Action (CheckBox and ToggleButton Controls)

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


The ClickButton action moves the mouse pointer to a check box, and then sets its state according to the State parameter.



TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
State [in]    Required    Variant    
Result None

Applies To

The method is applied to the following objects:

View Mode

This method is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.


The method has the following parameter:


Specifies the state of the control.

Possible values:

Value Description
cbChecked, True or 1 The control is checked.
cbUnchecked, False or 0 The control is unchecked.
cbGrayed or 2 The control is grayed.

The following controls do not support this value:

If the control does not support the indeterminate state, ClickButton(2) fails and posts an error message to the test log.

Result Value



If the State parameter corresponds to the control's state (for example, State is cbChecked and the control is already checked), ClickButton performs no action and reports in the test log that the operation was executed successfully. To toggle the control without moving the mouse pointer, use wState.


To view an example that demonstrates how to use the ClickButton method, see Selecting and Clearing Check Boxes in Desktop Windows Applications.

See Also

Selecting and Clearing Check Boxes in Desktop Windows Applications
ClickButton Action (Specific to MicrosoftCheckBox Controls)
wState Property (CheckBox and ToggleButton Controls)

Highlight search results