Skip to main content
BAP defines 55 methods across 13 categories. All methods use JSON-RPC 2.0 request/response format over WebSocket.

Lifecycle (3)

MethodDescription
initializeHandshake — returns server capabilities. Accepts optional sessionId for session persistence
notifications/initializedClient confirms ready (notification, no response)
shutdownClean shutdown of the connection

Browser (2)

MethodDescription
browser/launchLaunch browser instance
browser/closeClose browser instance
| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | browser | "chromium" \| "firefox" \| "webkit" | "chromium" | Browser engine | | channel | string | — | Playwright channel (e.g., "chrome", "msedge") | | headless | boolean | true | Run in headless mode | | args | string[] | — | Additional browser arguments | | proxy | object | — | Proxy configuration | | downloadsPath | string | — | Directory for downloads | | userDataDir | string | — | Persistent user data directory | | cdpUrl | string | — | Connect to existing browser via CDP |

Page (8)

MethodDescription
page/createCreate new page. Params: url, viewport, userAgent, contextId
page/navigateNavigate to URL. Supports observe fusion param
page/reloadReload current page
page/goBackNavigate back in history
page/goForwardNavigate forward in history
page/closeClose page
page/listList all open pages
page/activateBring page to front

Actions (13)

MethodDescription
action/clickClick element
action/dblclickDouble-click element
action/typeType text character by character
action/fillFill input field (clears existing value first)
action/clearClear input field
action/pressPress keyboard key (e.g., "Enter", "Tab")
action/hoverHover over element
action/scrollScroll page or element
action/selectSelect dropdown option
action/checkCheck checkbox
action/uncheckUncheck checkbox
action/uploadUpload file to file input
action/dragDrag element to target
All action methods accept a selector parameter using any of the 10 selector types.
| Parameter | Type | Description | |-----------|------|-------------| | pageId | string | Target page (defaults to active page) | | selector | BAPSelector | Element to interact with | | timeout | number | Operation timeout in ms |

Observations (7)

MethodDescription
observe/screenshotTake screenshot (JPEG default, PNG optional)
observe/accessibilityGet accessibility tree
observe/domGet page HTML (sensitive content redacted)
observe/elementGet element properties
observe/pdfGenerate PDF of the page
observe/contentGet page text, HTML, or markdown
observe/ariaSnapshotGet ARIA snapshot in YAML format

Storage (5)

MethodDescription
storage/getStateGet cookies + localStorage
storage/setStateSet cookies + localStorage
storage/getCookiesGet cookies for current domain
storage/setCookiesSet cookies
storage/clearCookiesClear all cookies

Emulation (4)

MethodDescription
emulate/setViewportSet viewport width and height
emulate/setUserAgentSet custom user agent string
emulate/setGeolocationSet geolocation coordinates
emulate/setOfflineToggle offline mode

Dialog, Tracing, Events (4)

MethodDescription
dialog/handleAccept or dismiss a browser dialog
trace/startStart a Playwright trace recording
trace/stopStop trace and return data
events/subscribeSubscribe to specific event types

Context (3)

Browser contexts provide isolated sessions with separate cookies and storage.
MethodDescription
context/createCreate new browser context with optional viewport, locale, permissions
context/listList all active contexts
context/destroyDestroy a context and all its pages

Frame (3)

MethodDescription
frame/listList all frames in the current page
frame/switchSwitch to an iframe (by selector or frame ID)
frame/mainSwitch back to the main frame

Stream + Approval (2)

MethodDescription
stream/cancelCancel a streaming response
approval/respondRespond to a human-in-the-loop approval request

Discovery (1)

MethodDescription
discovery/discoverDiscover WebMCP tools exposed by the current page
See the WebMCP guide for details on tool discovery.

Agent (3)

The agent methods are composite operations optimized for AI agent workflows. They batch multiple lower-level operations into single requests.
MethodDescription
agent/actExecute a sequence of action steps with retry logic, conditions, and pre/post observation
agent/observeGet an AI-optimized page snapshot with interactive elements, stable refs, and optional annotation
agent/extractExtract structured data from the page using a JSON Schema
| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | steps | ExecutionStep[] | — | Sequence of steps to execute (1-50) | | pageId | string | active page | Target page | | stopOnFirstError | boolean | true | Halt on first failure | | timeout | number | — | Global timeout for entire sequence | | preObserve | AgentObserveParams | — | Run observe before steps (fusion) | | postObserve | AgentObserveParams | — | Run observe after steps (fusion) |
| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | includeAccessibility | boolean | — | Include full accessibility tree | | includeScreenshot | boolean | — | Include base64 screenshot | | includeInteractiveElements | boolean | — | Include interactive elements with refs | | maxElements | number | 50 | Max elements to return | | filterRoles | string[] | — | Filter to specific ARIA roles | | responseTier | "full" \| "interactive" \| "minimal" | "full" | Response compression tier | | incremental | boolean | — | Return only changes since last observation | | includeWebMCPTools | boolean | — | Discover WebMCP tools on the page | | annotateScreenshot | boolean \| AnnotationOptions | — | Add Set-of-Marks style annotation |
| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | instruction | string | — | Natural language description of what to extract | | schema | ExtractionSchema | — | JSON Schema defining the output structure | | mode | "single" \| "list" \| "table" | "single" | Extraction mode | | selector | BAPSelector | — | Limit extraction scope to a container | | includeSourceRefs | boolean | — | Include source element references |

Fusion Operations

Six optimizations that eliminate redundant roundtrips:
FusionHow It WorksSavings
observe-act-observepreObserve/postObserve in agent/actEliminates 2 extra WebSocket calls
navigate-observeobserve param in page/navigateEliminates 1 extra call
incremental observeincremental: true returns only changesReduces payload size
selector cachingCached CSS paths for ref lookupsFaster resolution
response tiersfull / interactive / minimalUp to 80% smaller payloads
speculative prefetchFire-and-forget observe after click/navigatePre-warms cache