Clicks on the specified image asset. Waits until the image is found, the specified timeout is over, or the Object resolve timeout, which you can define in the synchronization options, is over.
TestObject.ImageClick(imageAsset,[position, occurrence, clickType, modifiers, timeout])
TestObject.ImageClick(imageAsset,[position, occurrence, clickType, modifiers, timeout])
Variable | Description |
---|---|
imageAsset | A .imageasset file. This file must be an embedded resource in the test assembly. String. |
position | Optional: The coordinates at which to click. The coordinates are relative to the upper-left corner of the image. To click in the center of the image use ClickPosition.Center. The default value is the center of the image. Point. |
occurrence | Optional: The occurrence of the image that should be clicked, if there are multiple occurrences. The first occurrence is 1. The default value is 1. Integer. |
clickType | Optional: The desired mouse action. The default value is left click. ClickType . |
modifiers | Optional: The modifier keys, Alt, Shift, or Ctrl, to press while clicking. Default: No modifier keys are used. ModifierKeys |
timeout | Optional: The maximum time in milliseconds to wait for the image to appear. If the timeout is not specified, the ImageClick method waits for the image to appear until the Object resolve timeout is over. Integer. |
Assume you have created an image asset with the name myImage. The image in the image asset represents a UI object that you want to interact with.
control.ImageClick("myImage");
control.ImageClick("myImage", new Point(10, 20));
control.ImageClick("myImage", ClickPosition.Center, 2, ClickType.Right);
control.ImageClick("myImage", ClickPosition.Center, 1, ClickType.Left, ModifierKeys.None, 2000);
Assume you have created an image asset with the name myImage. The image in the image asset represents a UI object that you want to interact with.
control.ImageClick("myImage")
control.ImageClick("myImage", New Point(10, 20))
control.ImageClick("myImage", ClickPosition.Center, 2, ClickType.Right)
control.ImageClick("myImage", ClickPosition.Center, 1, ClickType.Left, ModifierKeys.None, 2000)