instanceof:
ElementNotFoundError: you acted on an element thatfind()didnโt locate.AIError: anai()task failed.
Error with a recognizable message. See Other errors.
ElementNotFoundError
Thrown when you call an action on an element thatfind() didnโt locate:
click(),doubleClick(),rightClick()hover()mouseDown(),mouseUp()
find() itself doesnโt throw when nothing matches. It returns an element whose found() is false. Check found() when the element might not be there:
Properties
string
Always
"ElementNotFoundError".string
The description you passed to
find().string
Says which element wasnโt found, followed by a debug block. See below.
object | null
The response from the
find() call, with screenshots and other large images removed. Includes fields such as cacheHit, similarity, and reasoning when the API returned them.string
When the error was created, as an ISO 8601 string.
Message
The message starts with the elementโs description, then adds what TestDriver knows about the failedfind():
find() call, the debug block can also include:
- The cache threshold and the required similarity.
- When the cache was hit: the cache strategy, the entryโs age, and the pixel difference.
- The similarity score, marked
(below threshold)when itโs too low.
AIError
Thrown when a task you give toai() fails:
act() is the same method under another name and throws the same error.
Properties
string
Always
"AIError".string
The task you passed to
ai().number
How many check attempts were made.
number
The
tries limit for the call. Defaults to 7.number
How long the task ran, in milliseconds.
Error
The error that stopped the task.
string
When the error was created, as an ISO 8601 string.
Message
Other errors
These failures throw an error whose class isnโt exported. Check the message instead.Inside
ai(), a failed assert() resolves to false instead of throwing, so the AI can see the result and try another approach.Related
- find(): returns an element whose
found()tells you whether it was located - assert(): check whatโs on screen
- Debug a failing test: find out why a test failed
- Events: listen for errors as they happen

