Overview¶
To help analyze issues related to image-search ( findImage , waitForImage ) and to understand why Squish fails to look up an image as expected, the following Python script _helper_ImageSearch.py can be used to
- log the parameters the image search functions were invoked with
- log the rectangle’s x/y/width/height properties on a successful lookup
- highlight the rectangle returned by the image search functions (may not work on some platforms)
- take a desktop screenshot and attach it to the report together with a log message
Please download the helper script and save it in the Global Script directory.
To make the contents of a global script available to the test case script, add a source() call to your main function after launching the application, as shown below.
def main():
startApplication("myaut")
# Add this line to install helper functions that wrap the original waitForImage() and findImage() functions.
source(findFile("scripts", "_helper_ImageSearch.py"))
....
# Calling waitForImage() and findImage() will perform the steps described above
mouseClick(waitForImage("image_1", {"occurrence": 1, "timeout": 10000})) # exmaple code
Please note that once the helper script is sourced in main(), it overwrites the original findImage() and waitForImage() functions. If you want to use the original functions, call waitForImage_original() and findImage_original() instead.