type
Type text into input fields via ref or CSS selector for browser automation. Clear field content if needed. For multiple fields, use fill_form for efficiency.
Instructions
Type text into an input field identified by ref or CSS selector. For multiple fields in the same form, prefer fill_form — it handles text inputs, , checkbox, and radio in one round-trip and is more reliable than N separate type calls. For special keys (Enter, Escape, Tab, arrows) or shortcuts (Ctrl+K), use press_key instead. On stale-ref errors, call view_page for fresh refs and retry. Avoid evaluate(element.value = ...) as default data-entry recovery — it bypasses framework listeners (React, Vue) and masks real failures. (Legitimate exception: tests explicitly targeting synthetic event plumbing.)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Element reference from view_page (e.g. 'e12') — preferred over selector | |
| text | Yes | Text to type into the element | |
| clear | No | Clear existing field content before typing (default: false) | |
| selector | No | CSS selector as fallback (e.g. 'input[name=email]') |