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
LaunchOptionstypeMutually-exclusive browser, Electron, and remote-WebDriver launch configurations.browser-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
ShadowRootLocatorclassLazy, explicit search context for one open ShadowRoot.selectors

Assertions

Auto-wait for page, locator, and element conditions.

SymbolKindSummaryDocs
AssertionOptionstypePer-assertion timeout override.assertions
DocumentExpectApitypeAuto-waiting assertions for the current browser page or an explicit Page.assertions
ElementExpectApitypeAuto-waiting assertions for a single resolved element.assertions
LocatorExpectApitypeAuto-waiting assertions for a locator collection and its first element.assertions

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
TraceStopOptionstypetracing
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

Electron Automation

Launch packaged Electron applications, drive their renderer, and opt in to main-process testing.

SymbolKindSummaryDocs
ElectronLaunchOptionstypeOptions for driving an Electron application (see LaunchOptions.electron).electron
ElectronServiceclassDriver service for automating an Electron application renderer. It uses the chromedriver protocol like ChromeService, but resolves the driver only from Electron-specific configuration, never from system Chrome.electron
ElectronServiceOptionstypeDriver-process configuration for {@link ElectronService}.electron
ElectronRemoteclassRun code in the Electron main process via browser.electron.executeMain. Named executeMain (not WDIO's execute) so the process boundary is loud: browser.evaluate() is the renderer, executeMain() the main process.electron
MainProcessCallbacktypeA function evaluated in the Electron main process; receives the electron module.electron
ElectronDialogMocktypeA native-dialog replacement returned by browser.electron.mockDialog().electron
ElectronDialogMethodtypeelectron
ElectronDialogCalltypeOne native-dialog invocation. options excludes the optional parent window.electron
ElectronDialogResulttypeelectron
ElectronOpenDialogResulttypeScripted result for Electron's asynchronous dialog.showOpenDialog().electron
ElectronSaveDialogResulttypeScripted result for Electron's asynchronous dialog.showSaveDialog().electron
ElectronMessageBoxResulttypeScripted result for Electron's asynchronous dialog.showMessageBox().electron
ElectronMainLogMonitorclassBuffers and dispatches main-process log entries. Reachable via browser.electron.mainLogs; its public surface mirrors the renderer {@link LogMonitor } so console monitoring reads the same in both processes.electron
ElectronMainLogtypeelectron
ElectronMainLogHandlertypeelectron
ElectronMainLogLeveltypeNormalized level for a main-process log entry.electron

Visual Testing

Assert screenshots against baselines with pixel/percentage tolerances and optional anti-alias handling.

SymbolKindSummaryDocs
compareScreenshotsfunctionCompare two compressed PNG buffers without disk access, browser capture, retries, or throwing on a normal mismatch. Applies the same byte/pixel input limits as the retrying assertion.visual-testing
VisualMismatchErrorclassThrown by browser.expectScreenshot() when no screenshot matched the baseline before the timeout. Carries the final actual and diff PNG buffers plus the comparison summary; code is VISUAL_MISMATCH.visual-testing
ScreenshotCompareOptionstypePolicies applied to a single buffer-to-buffer comparison.visual-testing
ExpectScreenshotOptionstypeOptions for the retrying browser.expectScreenshot() assertion.visual-testing
VisualScreenshotOptionstypeMutually exclusive capture scope forwarded to browser.screenshot(). fullPage and selector cannot be combined (enforced by the union here and re-checked at runtime for JavaScript callers).visual-testing
VisualComparisonResulttypeResult of one buffer-to-buffer comparison.visual-testing
ScreenshotMatchResulttypeResult of a successful browser.expectScreenshot() assertion.visual-testing

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
A11yShadowSelectortypeaxe-core selector path through one or more open shadow boundaries.accessibility
A11yTargettypeA light-DOM selector or axe-core's nested selector path for Shadow DOM.accessibility
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
SafariServiceclassgetting-started
SafariServiceOptionstypegetting-started

Other Exports

Exports that are public but not yet assigned to a feature group.

SymbolKindSummaryDocs
ChromeDriverResolutionInfotype
ElectronMainConnectInfotypeelectron
ElectronMocktypeA replacement for a single electron.<api>.<fn> main-process method, returned by browser.electron.mock(). Records every call, returns a scripted value, and restores the original method on restore() or browser.quit().
ElectronMockCalltypeOne recorded invocation of a mocked Electron main-process method.
ElectronRemoteOptionstypeExtra context ElectronRemote needs beyond the inspector endpoint.electron
inspectChromeDriverResolutionfunctionResolve the exact ChromeDriver CraftDriver would launch and report both sides of the browser/driver pairing. Intended for benchmark manifests and startup diagnostics; ordinary launches use {@link resolveChromeDriver} and avoid the extra driver --version probe.
PageMatchertypeSelects a top-level page by url and/or title for {@link Browser.waitForPage}. A string matches as a substring; a RegExp is tested. When both fields are given, both must match.browser-api
RemoteAuthtype
RemoteWebDriverOptionstypeOptions for connecting to any W3C-compatible remote WebDriver endpoint — a self-hosted Selenium Grid, BrowserStack, or another cloud provider. Provider-specific detail (BrowserStack's bstack:options, etc.) is forwarded through capabilities without schema conversion.
SessionStateCookietype

Total exports: 103.

Released under the MIT License.