type
Enter text into web input fields using element ref or CSS selector. Clear existing text before typing when specified.
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 | |
| selector | No | CSS selector as fallback (e.g. 'input[name=email]') | |
| text | Yes | Text to type into the element | |
| clear | No | Clear existing field content before typing (default: false) |