Skip to content

API reference

Every symbol re-exported from src/index.ts, grouped by the feature area most users look for first. Generated by scripts/gen-api-reference.mjs — do not edit by hand.

Run npm run docs:api to regenerate. CI fails when this file is out of date.

Start with Browser, By / Locator, and the feature guide that matches the job you are automating.

Browser And Pages

Launch browsers, move between pages and frames, handle dialogs, and wait for navigation.

SymbolKindSummaryDocs
Browserclassbrowser-api
LaunchOptionstypebrowser-api
LoadStatetypeWhen to consider a navigation complete. - 'load' — page load event has fired (default) - 'domcontentloaded'DOMContentLoaded has fired (faster, no waiting for images/fonts) - 'networkidle'load + no in-flight requests for 500 ms - 'none' — do not wait; return as soon as the navigation is initiatedbrowser-api
Pageclassbrowser-api
Frameclassbrowser-api
DialogtypeRepresents an open browser dialog (alert / confirm / prompt). Passed to handlers registered with browser.onDialog().browser-api
DialogTypetypeThe type of a browser dialog.browser-api
DownloadtypeA file downloaded during a waitForDownload() call.browser-api

Locators And Elements

Find page content with semantic locators and selector helpers.

SymbolKindSummaryDocs
Byclassselectors
Locatorclassselectors

Input

Drive keyboard, mouse, and low-level key values.

SymbolKindSummaryDocs
Keyconstkeyboard-mouse
Keyboardclasskeyboard-mouse
Mouseclasskeyboard-mouse

Contexts And Sessions

Isolate users, manage cookies, and save or restore browser state.

SymbolKindSummaryDocs
BrowserContextclassbrowser-context
BrowserContextConfigtypePer-context options stored at creation time.browser-context
BrowserContextHookstypeInternal hooks the owning {@link Browser } passes to a new context.browser-context
ClearCookiesFiltertypeFilter applied to {@link BrowserContext.clearCookies}.browser-context
ContextStorageStateOptionstypeOptions for {@link BrowserContext.storageState}.browser-context
InitScriptHandletypeA handle returned by {@link BrowserContext.addInitScript}.browser-context
RoutePatterntypePattern accepted by {@link BrowserContext.route}. Same shape as the browser-level interceptor.browser-context
Cookietypesession-management
CookieInputtypesession-management
SessionStatetypesession-management
SessionStateManagerclasssession-management
StorageStateOptionstypesession-management

Network

Mock, intercept, observe, and assert browser network traffic.

SymbolKindSummaryDocs
NetworkInterceptorclassnetwork
MockResponsetypenetwork
InterceptedRequesttypenetwork
InterceptedResponsetypenetwork

Logs And Tracing

Capture console output, JavaScript errors, and trace artifacts.

SymbolKindSummaryDocs
LogMonitorclassbrowser-logs
ConsoleMessagetypebrowser-logs
JavaScriptErrortypebrowser-logs
LogMessagetypebrowser-logs
TraceStartOptionstypetracing
TraceScreenshotModetypeScreenshot mode for tracing.tracing
TraceEventtypetracing

Emulation And Time

Configure devices, emulation overrides, and deterministic browser time.

SymbolKindSummaryDocs
devicesconstCommon mobile device presetsbrowser-api
DeviceMetricstypeDevice metrics for custom mobile emulationbrowser-api
DeviceNametypebrowser-api
MobileEmulationtypeMobile emulation configurationbrowser-api
EmulateOptionstypeOptions for {@link Browser.emulate}. Every field is independent; only the keys you pass are applied, others stay at their previous value. Passing null for a field clears the override for that field.browser-api
ClockclassControls the virtual clock inside the browser page.clock
ClockInstallOptionstypeOptions for {@link Clock.install}.clock
ClockTimetypeAccepted forms for a point in time.clock

Accessibility

Run axe-core accessibility checks and inspect violation details.

SymbolKindSummaryDocs
A11yclassErgonomic wrapper around axe-core. Obtain instances via the .a11y accessor on Browser, ElementHandle, or Locator — never construct directly.accessibility
A11yErrorclassThrown by A11y.check() when violations are found.accessibility
A11yImpacttypeSeverity buckets reported by axe-core.accessibility
A11yOptionstypeaccessibility
A11yResulttypeaccessibility
A11yViolationtypeaccessibility
A11yViolationNodetypeaccessibility

Errors And Driver Services

Handle stable CraftDriver errors or customize browser driver services.

SymbolKindSummaryDocs
CraftdriverErrorclassBase class for every error thrown from the public API.error-codes
CraftdriverErrorOptionstypeerror-codes
ErrorCodeconstStable, machine-readable error codes for the public craftdriver API.error-codes
ErrorCodeNametypeerror-codes
ErrorCodeValuetypeerror-codes
ChromeServiceclassgetting-started
ChromeServiceOptionstypegetting-started
FirefoxServiceclassgetting-started
FirefoxServiceOptionstypegetting-started

Total exports: 60.

Released under the MIT License.