testdrivererrorslisted
Install: claude install-skill testdriverai/testdriverai
<!-- Generated from errors.mdx. DO NOT EDIT. -->
## Overview
TestDriver provides custom error classes with rich debugging information. These are exported from the SDK and can be used for `instanceof` checks in your tests.
```javascript
import TestDriver, { ElementNotFoundError, AIError } from 'testdriverai';
```
## ElementNotFoundError
Thrown when `find()` cannot locate an element on screen, or when calling `click()`/`hover()` on an unfound element.
```javascript
try {
await testdriver.find('nonexistent button').click();
} catch (error) {
if (error instanceof ElementNotFoundError) {
console.log(error.description); // "nonexistent button"
console.log(error.screenshotPath); // path to debug screenshot
console.log(error.pixelDiffPath); // path to pixel diff image
}
}
```
### Properties
<ParamField path="name" type="string">
Always `"ElementNotFoundError"`.
</ParamField>
<ParamField path="message" type="string">
Enhanced message with a debug block containing element description, cache status, similarity scores, and AI response details.
</ParamField>
<ParamField path="description" type="string">
The original element description passed to `find()`.
</ParamField>
<ParamField path="screenshotPath" type="string | null">
Absolute path to a debug screenshot saved at the time of failure. Written to `<os.tmpdir>/testdriver-debug/screenshot-<timestamp>.png`.
</ParamField>
<ParamField path="pixelDiffPath" type="string | null">
Absolute pa