match-image
Finds an image on the screen and performs an action (e.g., click or hover) at its center.
This command is useful for interacting with elements that the AI has trouble locating. The testdriverai
package will take a screenshot of the desktop and search for the location of the image within the screenshot.
Screenshot should be stored in testdriver/images/(mac/linux/windows)/PATH.png
. TestDriver will dynamically resolve images based on the current platform.
The screenshot template matching logic looks for the most similar image within the screenshot and not exact matches. If the match is not above ~80%, it will search additional scales. Otherwise it fails
To create screenshots from remote tests, download the video of the test and open it "full" or "actual" size within your computer. Then use a screenshot tool like Cleanshot X to create a screenshot of the target element. Do the best you can to center the clickable element within the screenshot.
path
string
The path to the image file that needs to be matched on the screen. Do not include testdriver/images/*/
action
string
The action to perform when the image is found. Available actions are: click
or hover
.The AI will click the center of the image.
Example Usage
Last updated
Was this helpful?