ImageExistsFile Method (TestObject)

Class

TestObject.

Action

Returns whether the specified image exists.

Syntax

return = TestObject.ImageExistsFile(imageFile, [occurrence, searchRectangle])
Variable Description
return True if the image exists, false if not. Boolean.
imageFile
  • A path to a file of one of the following types:
    • .bmp
    • .png
String.
occurrence Optional: The occurrence of the image that should be checked for existence, if there are multiple occurrences. The first occurrence is 1. The default value is 1. Integer.
searchRectangle Optional: The object-relative rectangle in which to search for the image. Rect .

Example

Assume you have a PNG image with the name myImage in the folder c:/temp. To check if the image exists in the application under test, you can use the following code:
 
bImageExists = control.ImageExistsFile("c://temp/myImage.png")