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 the controls’s edit button and then simulates a single click of the left mouse button. The Button
parameter specifies the button index or caption.
Declaration
TestObj.ClickButton(Button, ClientX, ClientY)
TestObj | A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section | |||
Button | [in] | Required | Variant | |
ClientX | [in] | Optional | Integer | Default value: -1 |
ClientY | [in] | Optional | Integer | Default value: -1 |
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 parameters:
Button
Specifies the control’s edit button to be clicked. You can enter the button’s index (an integer value from 0), or string that contains the button’s 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.
ClientX
Specifies the horizontal coordinate of the point, to which the mouse cursor will be moved before click-simulation. Default value is -1 and it means that the mouse cursor will be moved to the center of the edit button.
ClientY
Specifies the vertical coordinate of the point, to which the mouse cursor will be moved before click-simulation. Default value is -1 and it means that the mouse cursor will be moved to the center of the edit button.
Result Value
None.
Remarks
-
The ClientX and ClientY parameters specify coordinates in the button’s client area. The origin of client coordinates is in the top left corner of the edit button. When these parameters are not specified, mouse cursor will be moved to the center of the edit button.
-
If the specified button is not found,
ClickButton
fails 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%, set the ClientX and ClientY parameter values 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), set the ClientX and ClientY parameter values relative to the web page, regardless of the browser zoom and the system's DPI setting.
See Also
wButtons Property
CloseUp Action (Combo Box Controls)
DropDown Action (Combo Box Controls)