Found-Image and Found-OCR Information Functions
The functions in this section return additional information about the last image or text (OCR) search that was found on the system under test (SUT). These functions can be especially helpful if, for instance, you are using image collections and need to determine which image in the collection was found, or if you need to determine the scale at which an image was found when working with multiple scales.
FoundImageInfo
Function
Behavior: Returns a property list for a single image or OCR search, or a list of property lists for multiple references. Depending on the data that is available, the list can contain the properties listed in Image Properties or OCR Properties, as well as the following properties:
For Image Searches
- Description: The image description in the Suite Editor Info panel.
- ImageLocation: The coordinates of the image found using the
ImageLocation
function. - ImageRectangle: The rectangle coordinates of the image found using the
ImageRectangle
function.
In some cases you might see the foundImageInfo
function return Smoothed for Text as the search type, when Tolerant of Background was originally set. This occurs when the search is conducted using a Scale other than 1.
Parameters: None; refers to the last image found.
Returns: An image or OCR property list. For example:
Image search returns:
(CaptureDate:"2016-09-09 13:02:53 -0600", CaptureHost:"Windows", CaptureLocation:(305,270), CaptureScreenSize:(1024,768), Description:"", HotSpot:(41,14), ImageLocation:(346,284), ImageName:"WelcomeMessage", ImagePath:"C:/Users/Carrie/Documents/Suites/mySuite.suite/Images/WelcomeMessage.png", ImageRectangle:(305,270,387,298), ImageSize:(82,28), ImageTolerance:"53", Pulsing:"False", Scale:"1", SearchType:"Smooth")
OCR search returns:
(CaseSensitive:"No", Contrast:"Off", IgnoreSpaces:"No", ImageLocation:(351,283), ImageRectangle:(319,277,384,290), Language:"English", searchrectangle:(230,242,504,371), text:"TestPlant", TextPlatform:"Generic OCR", validcharacters:"TestPlant")
Example:
Click text:"Single Sign-On"
put FoundImageInfo() // Prints the return of FoundImageInfo for the previously successful image or OCR search
Example:
WaitFor 10, "WelcomeMessage"
log the FoundImageInfo's description // Logs the content of the image's description
Example:
click "SignInButton"
set clickedImage to FoundImageInfo()'s imageName // Stores the name of the last image found into the variable called clickedImage
Example:
WaitFor 10, "WelcomeMessage"
set myImageInfo to the FoundImageInfo // Stores the return from FoundImageInfo into a variable called myImageInfo
assert that the CaptureLocation of myImageInfo equals the ImageLocation of myImageInfo // Asserts with an exception that the CaptureLocation and ImageLocation of the found image "WelcomeMessage" are equal