ClickButton Action (CheckBox and ToggleButton Controls)

Applies to TestComplete 15.63, last modified on April 10, 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.

Description

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

Declaration

TestObj.ClickButton(State)

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.

Parameters

The method has the following parameter:

State

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

None.

Remarks

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.

Example

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