ImageClickFile Method (AnyWin)

Class

AnyWin.

Action

Clicks on the specified image.

Syntax

window.ImageClickFile (sImageFile[, iXpos, iYpos, matchAccuracy])
Variable Description
sImageFile An absolute path to an image file of one of the following types:
  • .bmp
  • .png
Note: This path can be either absolute or relative to the working directory during playback.
STRING.
iXpos Optional: The horizontal coordinate (relative to the window) at which to click. The default coordinate is the center of the window. INTEGER.
iYpos Optional: The vertical coordinate (relative to the window) at which to click. The default coordinate is the center of the window. INTEGER.
matchAccuracy Optional: The accuracy with which the image in the AUT must match the image in the file. The accuracy can be a number between 1 and 10. The default value is 10. Setting this parameter is helpful if you are testing multiple systems or browsers with different screen resolutions. Micro Focus recommends choosing a high level of accuracy in order to prevent false positives. INTEGER.

Examples

Assume you have an image with the name myImage.png in the directory C:\temp.

  • To click in the center of the image, you can use the following code:
    window.ImageClickFile ("c:\temp\myImage.png")
  • To click on a specific position inside the image, instead of in the center of the image, you can use the following code:
    window.ImageClickFile ("c:\temp\myImage.png", 10, 20)
  • To click on a specific position inside the image with a smaller match accuracy, you can use the following code:
    window.ImageClickFile ("c:\temp\myImage.png", 10, 20, 8)