Skip to main content

Action Commands

Individual interaction commands for when you need fine-grained control. For multi-step flows, prefer composite actions with bap act.

click

Click an element.
bap click e5
selector
string
required
Element selector. See Selectors below.

fill

Fill an input field. Clears existing content first.
bap fill label:"Email" "user@example.com"
bap fill e5 "user@example.com"
bap fill placeholder:"Search..." "headphones"
selector
string
required
Element selector targeting the input field.
value
string
required
The text value to fill.
Use fill for form fields. It clears existing content and sets the value in one step. Use type only when you need character-by-character input (e.g., autocomplete, search-as-you-type).

type

Type text character by character into the focused element. Triggers keydown, keypress, and keyup events for each character.
bap type "browser agent protocol"
text
string
required
The text to type character by character.
type does not clear existing content. It appends to whatever is already in the field. For form fields, prefer fill.

press

Press a keyboard key or shortcut.
bap press Enter
bap press Tab
bap press Escape
key
string
required
Key name (e.g., Enter, Tab, Escape, ArrowDown, Control+a).

select

Select an option from a dropdown.
bap select label:"Country" "Canada"
bap select e8 "Option B"
selector
string
required
Selector targeting the <select> element.
value
string
required
The option value or visible text to select.

check / uncheck

Toggle checkboxes.
bap check label:"I agree to the terms"
bap uncheck e12
selector
string
required
Selector targeting the checkbox element.

hover

Hover over an element. Useful for triggering hover menus or tooltips.
bap hover role:menuitem:"Products"
bap hover text:"More options"
selector
string
required
Selector targeting the element to hover over.

scroll

Scroll the page or scroll an element into view.
bap scroll
bap scroll down
direction
string
default:"down"
Scroll direction: up, down, left, right.
--pixels
number
default:"300"
Number of pixels to scroll.
selector
string
When provided, scrolls the element into view instead of scrolling the page.

Selectors

All action commands accept the same selector formats:
SelectorExampleWhen to use
e<N>e15From snapshot refs (playwright-cli compatible)
@<ref>@ep44e3jStable ref from bap observe
role:<role>:"<name>"role:button:"Submit"By ARIA role and name (recommended)
text:"<content>"text:"Sign in"By visible text
label:"<text>"label:"Email"Form fields by label
placeholder:"<text>"placeholder:"Search..."By placeholder text
testid:"<id>"testid:"submit-btn"By data-testid
css:<selector>css:.btn-primaryCSS selector (last resort)
xpath:<path>xpath://buttonXPath selector (last resort)
coords:<x>,<y>coords:100,200By page coordinates
Never copy CSS selectors from browser DevTools. They break across deployments. Prefer semantic selectors (role:, label:, text:) that survive DOM changes.