Description
The ClickButton
action moves the mouse pointer to a button of the control 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 object:
View Mode
To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.
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. -
If TestObj refers to an object of a non-DPI-aware application running with a DPI setting other than 100%, set the X and Y parameter values relative to the application (as if the application is running with the 100% DPI setting).