Skip to main content

Forms

browser_type

Type text into an editable element (input, textarea, contenteditable).

ParameterTypeRequiredDescription
targetstringyesElement ref from the snapshot, or a unique selector
textstringyesText to type into the element
submitbooleannoPress Enter after typing
slowlybooleannoType one character at a time. Useful for triggering key handlers; by default the entire text is filled in at once
→ browser_type { target: "e5", text: "Buy groceries" }
→ browser_type { target: "e5", text: "Buy groceries", submit: true }
→ browser_type { target: "e8", text: "search query", slowly: true }

browser_fill_form

Fill multiple form fields in one call. Supports textboxes, checkboxes, radio buttons, comboboxes, and sliders. This is more efficient than calling browser_type and browser_click for each field individually.

ParameterTypeRequiredDescription
fieldsobject[]yesFields to fill in

Each field is an object:

Field keyTypeRequiredDescription
namestringyesHuman-readable field name
targetstringyesElement ref or selector
typestringyestextbox, checkbox, radio, combobox, or slider
valuestringyesValue to fill in. For a checkbox or radio use "true" / "false"; for a combobox use the option's text
→ browser_snapshot
- textbox "First name" [ref=e3]
- textbox "Last name" [ref=e5]
- textbox "Email" [ref=e7]
- checkbox "Accept terms" [ref=e9]
- combobox "Country" [ref=e11]
- radio "Annual plan" [ref=e15]

→ browser_fill_form {
fields: [
{ name: "First name", target: "e3", type: "textbox", value: "Alice" },
{ name: "Last name", target: "e5", type: "textbox", value: "Smith" },
{ name: "Email", target: "e7", type: "textbox", value: "alice@example.com" },
{ name: "Accept terms", target: "e9", type: "checkbox", value: "true" },
{ name: "Country", target: "e11", type: "combobox", value: "United States" },
{ name: "Annual plan", target: "e15", type: "radio", value: "true" }
]
}
note

To toggle a single checkbox or radio button, either click it with browser_click, or use browser_fill_form with type: "checkbox" (or "radio") and value: "true" / "false".

Secrets

Values passed to browser_type and browser_fill_form are matched against the secrets file supplied with --secrets <path> (dotenv format). A matching placeholder is substituted with the real value before it reaches the page, and the generated code shows SECRET_<name> instead of the value.

Workflow: completing a multi-step form

You: Fill out the registration form on this page.

→ browser_snapshot
// Page 1: Personal info
- textbox "Email" [ref=e3]
- textbox "Password" [ref=e5]
- button "Next" [ref=e7]

→ browser_type { target: "e3", text: "alice@example.com" }
→ browser_type { target: "e5", text: "s3cureP@ss!" }
→ browser_click { target: "e7" }

// Page 2: Profile
- textbox "Display name" [ref=e3]
- combobox "Timezone" [ref=e5]
- checkbox "Subscribe to newsletter" [ref=e7]
- button "Create account" [ref=e9]

→ browser_fill_form {
fields: [
{ name: "Display name", target: "e3", type: "textbox", value: "Alice S." },
{ name: "Timezone", target: "e5", type: "combobox", value: "US/Pacific" },
{ name: "Subscribe", target: "e7", type: "checkbox", value: "true" }
]
}
→ browser_click { target: "e9" }