← ClaudeAtlas

testdrivererrorslisted

Custom error classes and error handling
testdriverai/testdriverai · ★ 243 · Testing & QA · score 72
Install: claude install-skill testdriverai/testdriverai
<!-- Generated from errors.mdx. DO NOT EDIT. --> ## Overview TestDriver gives custom error classes with full debug information. The SDK exports them. You can use them for `instanceof` checks in your tests. ```javascript import TestDriver, { ElementNotFoundError, AIError } from 'testdriverai'; ``` ## ElementNotFoundError TestDriver throws this when `find()` cannot find an element on the screen. It also throws this when you call `click()` or `hover()` on an element that TestDriver did not find. ```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"> A message with a debug block. The block has the element description, the cache status, the similarity scores, and the 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