SDK reference
Reference for the Heal SDK, an SDK to write stable end-to-end tests with LLMs and playwright.
SDK reference
Heal.init(options?)
Creates a new Heal instance with an auto-healing browser context.
| Option | Type | Description |
|---|---|---|
headless | boolean | Run browser in headless mode |
extensionPaths | string[] | Browser extension paths to load |
locale | string | Browser locale |
extraHttpHeaders | Record<string, string> | Extra HTTP headers for all requests |
storageStatePath | string | Path to storage state JSON for auth/cookies |
Instance methods
getPage(): Returns{ page, agent }with Heal's self-healing proxy.newPage(): Opens a new page in the browser context.getBrowserContext(): Returns the underlying PlaywrightBrowserContext.waitForNewPage(action, timeoutMS?): Waits for a new page to open as a result of an action.close(): Closes the browser and cleans up resources.
HealPageAgent methods
agent.healClick(description): Click an element described in natural language.agent.healType(description, value): Type into an element described in natural language.agent.healSelectOption(description, option): Select an option from a dropdown described in natural language.agent.healHover(description): Hover over an element described in natural language.agent.healLocator(description): Returns a PlaywrightLocatorfor an element described in natural language.agent.healAssert(assertion): Assert a condition on the page described in natural language.agent.healScreenshot(): Takes a screenshot of the current page and returns it as a base64 string.
Supported Playwright features
Configuration (playwright.config.ts)
testDir: root test directoryprojects: array of project configurations withname,testMatch,testDir, anddependencies- Project dependency graph with cycle detection and topological ordering
Test patterns
test()andit()declarationstest.describe()with nestingtest.afterEach()(scope-aware)- Custom fixtures via
base.extend()— function-style, array-style with{ auto: true }, and{ option: true } - Fixture teardown via
use()boundary detection - Fixture dependency resolution and topological sorting
test.use()overrides (scope-aware withindescribeblocks)- Built-in fixtures auto-provided when needed:
page,context,browser,request
Test file extensions
*.spec.ts, *.spec.js, *.test.ts, *.test.js, *.spec.tsx, *.spec.jsx, *.test.tsx, *.test.jsx
Code patterns
- Control flow blocks (
if/else,for,while,try/catch,switch) treated as atomic executable units - File-level and
describe-block-level variable declarations - Import statements preserved for execution context
Blocks (reusable helper functions)
import * as blocks from './blocks'pattern- Automatic inlining of
await blocks.functionName(...)calls - Parameter binding, return value capture, and setup/teardown support
Related pages
- Overview and examples: SDK overview
- Edge cases and gaps: Known limitations