Fill Field
fillSet the value of an input, textarea, or contenteditable element and fire input/change events so React and other frameworks register the change.
Instructions
Set the value of an input, textarea or contenteditable. Uses the native setter and fires input and change, so React and similar frameworks register it. Fails with an error naming the tag when the target cannot be filled: a heading or other non-input, a disabled or readonly field, a checkbox, radio or button (use click), a (use select_option), or a field that rejects the value (a number input given text). "text=Label" matches on visible text as a substring, with exact matches ranked first and visible elements ahead of hidden ones, so a short label also matches longer ones. Check the returned "matches" count, and pass exact when it is above 1. Also accepts "ref=e12" from snapshot (re-resolved and reported as reResolved when the page re-rendered, a clear stale-ref failure when the element is truly gone), "role=button[name="Save"]", "label=Email" and "placeholder=Search". On success it waits for the page to go quiet and reports settledMs (and settled false if the DOM was still changing at the cap), so the next read sees the result of the action.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nth | No | Which match to fill, 0-based | |
| exact | No | For "text=", "label=" and "placeholder=" selectors, require the whole trimmed text to equal the label instead of containing it. No effect on CSS, ref= or role= selectors. | |
| value | Yes | Value to set | |
| submit | No | Press Enter, then submit the form if the page did not. Fails with ok false when nothing was submitted, or when the form fails its own validation (the invalid fields are listed). The tab usually navigates, so follow with wait_for_load: the returned tab snapshot may predate the navigation, and urlBefore reports the url from just before the key press. | |
| tab_id | No | Arc tab id from list_tabs. Omit to use this agent's current tab. A tool that changes a tab will not fall back to the tab the user is looking at, so pass this or call open_url first. | |
| verbose | No | Include the bulky element rect and longer attribute values | |
| selector | Yes | CSS selector, or one of: "text=Some label" (visible text, case-insensitive substring, exact matches ranked first); "ref=e12" (a ref from snapshot, re-resolved if the page re-rendered); "role=button[name="Save"]" (ARIA or implicit role, name an exact match, or name~="sav" for a substring); "label=Email" (the control a label names); "placeholder=Search" | |
| settle_ms | No | After acting, wait until the page's DOM has been quiet for this many ms, then report settledMs. 0 skips the wait. The whole wait is capped at 1500ms; a page that never goes quiet reports settled false. |