Skip to main content

Overview

Get information from the screen with AI. TestDriver returns it as a string. Describe what you want in natural language. The AI reads the screen and returns the correct value: text, numbers, labels, status messages, or other content on the screen. assert() returns a boolean result. But extract() returns the real value. Thus you can store it, compare it, or use it in later steps and in framework assertions.

Syntax

Parameters

string
required
A natural language description of the information to read from the screen.
extract() also accepts an options object, extract({ description }). This is the same as the positional form. The string form is the most common.

Returns

Promise<string> — The information from the screen. TestDriver returns the value as text. Parse it or cast it yourself if you need a number or another type.

Examples

Basic Extraction

Using the Extracted Value

Best Practices

Be specific about what to readPrecise descriptions produce cleaner values:
Ask for the format you wantSteer the output by describing the desired shape in the prompt:
Extract for detailed assertionsUse extract() when a boolean assert() isn’t enough and you need the actual value to inspect:

Use Cases

Complete Example

How It Works

  1. TestDriver captures a screenshot of the current screen
  2. The image and your description are sent to the TestDriver API
  3. The AI reads the requested information from the screenshot
  4. The extracted value is returned as a string
Like assertions, extract() reads the screen fresh on every call — it is not cached — so it always reflects the current state of the app.
  • assert() - Verify screen state with a boolean AI judgment
  • find() - Locate elements to interact with
  • parse() - Detect all UI elements on screen