SDK Reference
Navigation and Observation
Navigate pages, read state, capture snapshots/screenshots, and wait reliably.
Raw Playwright
page: Page-- the active PlaywrightPagecontext: BrowserContext-- the active PlaywrightBrowserContext
These throw if accessed before launch() or Opensteer.from().
Navigation
goto(url: string, options?: GotoOptions): Promise<void>
Navigate to a URL and wait for visual stability. Prefer this over
opensteer.page.goto() for consistent post-navigation settling.
await opensteer.goto('https://example.com')
await opensteer.goto('https://example.com', { waitUntil: 'networkidle', settleMs: 1500 })
Observation
snapshot(options?: SnapshotOptions): Promise<string>
Return a cleaned HTML snapshot of the current page. Elements are annotated
with c="..." counters that can be used in subsequent actions via the
element option. Counters are reassigned on each snapshot and synced to the
live DOM.
const html = await opensteer.snapshot()
const html = await opensteer.snapshot({ mode: 'extraction' })
state(): Promise<StateResult>
Return the current page URL, title, and an action-mode snapshot.
const { url, title, html } = await opensteer.state()
screenshot(options?: ScreenshotOptions): Promise<Buffer>
Take a screenshot of the current page.
const buffer = await opensteer.screenshot()
const jpeg = await opensteer.screenshot({ type: 'jpeg', quality: 80, fullPage: true })
Cursor Preview
Cursor preview is compositor-based (CDP Overlay), does not inject DOM into the target page, and is best-effort (graceful no-op when unsupported).
- SDK default:
cursor.enabled = false - CLI default: enabled for opened sessions
setCursorEnabled(enabled: boolean): void
Enable or disable cursor preview at runtime for this Opensteer instance.
opensteer.setCursorEnabled(true)
getCursorState(): { enabled: boolean; active: boolean; reason?: string }
Return current cursor preview state.
const state = opensteer.getCursorState()
Wait
waitForText(text: string, options?: { timeout?: number }): Promise<void>
Wait for text to appear on the page. Default timeout is 30 seconds.
await opensteer.waitForText('Welcome back')
await opensteer.waitForText('Order confirmed', { timeout: 10000 })
Covered Features
sdk:contextsdk:getCursorStatesdk:getHtmlsdk:getTitlesdk:gotosdk:pagesdk:screenshotsdk:setCursorEnabledsdk:snapshotsdk:statesdk:waitForText
