Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 755 Bytes

File metadata and controls

18 lines (14 loc) · 755 Bytes

Custom Drivers

Implement the Driver interface to use a non-Playwright browser backend:

import type { Driver, PageState, Action, ActionResult } from '@tangle-network/browser-agent-driver'
import type { Page } from 'playwright'

class MyDriver implements Driver {
  async observe(): Promise<PageState> { /* return a11y tree + metadata */ }
  async execute(action: Action): Promise<ActionResult> { /* run action, return result */ }
  getPage?(): Page | undefined { /* optional: expose underlying Page */ }
  async screenshot?(): Promise<Buffer> { /* optional: capture screenshot */ }
  async close?(): Promise<void> { /* optional: cleanup */ }
}

Pass your driver to BrowserAgent or TestRunner the same way as PlaywrightDriver.