Skip to main content
Read a value off the screen, such as an order number or a price. Describe what you want, and the AI returns it as a string.
assert() tells you whether something is true. extract() gives you the value itself, so you can compare it, log it, or type it somewhere else.

Signature

Both forms do the same thing.

Parameters

string
required
What to read from the screen, such as 'the total price in the order summary'. Say what format you want, too: 'the cart total as a number, without the dollar sign'.

Returns

Promise<string>. The value the AI read, with no extra text. Convert it yourself when you need a number or another type.

Errors

extract() throws if the AI service fails, for example when it’s temporarily unavailable. It doesn’t throw when the value isn’t on screen. Check the result before you rely on it.

Examples

Compare a value with expect()

Read a number

Check the format of a generated value

Pass a value to the next step

Read text that appears on hover

How it works

  1. TestDriver takes a screenshot of the sandbox.
  2. It sends the screenshot and your description to the AI.
  3. The AI returns only the value you asked for.
Results aren’t cached. Every call reads the current screen.

Complete example

tests/login.test.mjs