Description
Use the Click
method to simulate a click of the left mouse button over the control specified by its image in the Image Repository.
Declaration
ImageSetItem.Click(X, Y, Shift, SearchArea)
ImageSetItem | ||||
X | [in] | Optional | Integer | Default value: -1 |
Y | [in] | Optional | Integer | Default value: -1 |
Shift | [in] | Optional | TShiftKey | Default value: skNoShift |
SearchArea | [in] | Optional | Object | |
Result | None |
Applies To
Parameters
The method has the following parameters:
X
Specifies the horizontal coordinate of the point of the click.
This coordinate is relative to to the top-left corner of the control’s recognition area marked with a red frame in the Preview box of the ImageSet editor.
If the parameter is omitted, the click will be simulated in the center of the recognition area.
Y
Specifies the vertical coordinate of the point of the click.
This coordinate is relative to to the top-left corner of the control’s recognition area marked with a red frame in the Preview box of the ImageSet editor.
If the parameter is omitted, the click will be simulated in the center of the recognition area.
Shift
Sets whether the Shift, Alt or Ctrl keys are pressed during the click (see TShiftKey). By default, this parameter is skNoShift
(no shift keys are pressed). Sometimes, the Shift parameter may not be enough, and you may need to simulate key presses in script code. See Simulating Keystrokes.
Note: | To simulate a click in a mobile device, set it to skNoShift . |
SearchArea
Specifies the area, within which the method will search for the image. Can take the following values:
-
Your current computer desktop. Access it by calling the
Sys
object or theSys.Desktop
property. -
A window or onscreen object in your desktop or web application.
-
A screen of your mobile device (accessed by calling the
Mobile.AndroidDevice.Desktop
orMobile.iOSDevice.Desktop
property appropriately or by calling theMobile.Device
method), or a window or object in your mobile application.In this case, the method will simulate a touch action on the specified mobile device.
Note: The Shift parameter must be set to skNoShift
, otherwise, TestComplete will search for the image on your PC desktop instead of the mobile device screen.
If the parameter is omitted, the method will search for the image on your PC desktop.
Result Value
None.
See Also
Image-Based Testing
ClickM Method (ImageSetItem Object)
ClickR Method (ImageSetItem Object)
DblClick Method (ImageSetItem Object)
Drag Method (ImageSetItem Object)