Overview
The TestDriver element finding system uses AI. It finds elements on the screen with natural language descriptions. Thefind() method returns an Element object. You can interact with the object.
Finding Elements
find()
Find an element on the screen with a natural language description.description(string) - A natural language description of the element to find
Promise<Element> - The Element instance that TestDriver found
Example:
Element Class
TheElement class represents a located (or to-be-located) UI element. It provides methods for interaction and properties for element information. For interaction methods like click() and hover(), see Interacting With Your App.
Methods
found()
Check if the element was successfully located.boolean - True if element coordinates were found
Example:
find()
Re-locate the element, optionally with a new description.newDescription(string, optional) - New description to search for
Promise<Element> - This element instance
Example:
Properties
Element properties provide additional information about located elements. Properties are available after a successfulfind() call.
coordinates
Get the element’s coordinates object containing all position information.Object | null - Coordinate object with { x, y, centerX, centerY }
Example:
x, y, centerX, centerY
Direct access to coordinate values. Always available after successfulfind().
width, height
Element dimensions in pixels. Available when AI detects element bounds.boundingBox
Complete bounding box information including position and dimensions.Object | null - Bounding box with all dimension data
screenshot
Base64-encoded PNG screenshot of the screen when element was found. Only available in DEBUG mode or when an error occurs.string | null - Base64-encoded PNG image
Example:
text
Text content extracted from the element by AI (if available).string | null - Element’s text content
Example:
label
Accessible label or name of the element (if available). Useful for verifying accessibility.string | null - Accessible label
Example:
confidence
AI confidence score for the element match (0-1, where 1 is perfect confidence).number | null - Confidence score between 0 and 1
Example:
Property Availability
Properties marked with ⚠️ may be
null depending on what the AI could detect from the screenshot.JSON Serialization
Element objects can be safely serialized usingJSON.stringify() for logging, debugging, and data storage. Circular references are automatically removed:
Use cases:
Best Practices
Be specific with descriptions
Be specific with descriptions
Include visual details, position context, and nearby text:
Check if element was found
Check if element was found
Always verify elements were located before interacting:

