LogoLogo
  • Overview
    • Quickstart
    • FAQ
    • Overview
    • Pricing
    • Comparison
    • Discord
  • Pro Setup
    • Book a Demo
    • 30x30 Promotion
  • Guides
    • Generate a Test Suite
    • Local Agent Setup
    • Prompting
    • Getting an API Key
    • GitHub Actions
      • GitHub Action Setup
      • Prerun Scripts
      • Environment Config
      • Parallel Testing
      • Storing Secrets
      • Optimizing Performance
      • Action Output
      • Examples
        • Test Generation
        • Parallel Testing
        • Importing Tests
        • Desktop Apps
        • Secure Log In
    • Debugging Test Runs
    • Monitoring Performance
  • Reference
    • Test Steps
      • assert
      • exec
      • focus-application
      • hover-image
      • match-image
      • hover-text
      • if
      • press-keys
      • remember
      • run
      • scroll
      • scroll-until-image
      • scroll-until-text
      • type
      • wait
      • wait-for-image
      • wait-for-text
    • Interactive Commands
      • /assert
      • /undo
      • /save
      • /run
      • /generate
    • CLI
      • testdriverai init
      • testdriverai [file]
      • testdriverai run [file]
  • Security & Privacy
    • Agent
    • Action
    • Dashboard
  • FAQ
    • Screen Recording Permissions (Mac Only)
    • Status Page
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Reference
  2. Test Steps

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/screenshots/(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.

Argument
Type
Description

path

string

The path to the image file that needs to be matched on the screen. Do not include testdriver/screenshots/*/

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

command: match-image
relativePath: button.png
action: click
Previoushover-imageNexthover-text

Last updated 1 month ago

Was this helpful?