Skip to main content
This test uses findAll() to find every coffee cup in an icon grid, clicks each one, and asserts on the result.

Watch it run

The test

findall-coffee-icons.test.mjs

How it works

  • findAll() returns an array with one element per match.
  • The description states how many to expect (β€œthere are exactly 4 on the page”).
  • Each element has its position in x, y, centerX, and centerY.
  • Each element has its own click(), so a for...of loop clicks them in turn.
  • The test and assertion accept 3 or 4 matches, so one missed icon doesn’t fail the run.

Run it

The test is in the TestDriver SDK repository. Clone it, install dependencies, and run the file:
The test reads your API key from TD_API_KEY. Create a key at console.testdriver.ai/team/api-keys. Then set it in your environment or a .env file.