glass_set_value
Set an editable UI element's value by its snapshot ID—text, number, boolean, or option. Verifies the write and gives actionable error details if it fails.
Instructions
Set an editable element's value — pick the element's #id from glass_a11y_snapshot. Where the platform can write the value directly this is instant and takes no keystrokes; where it has to be typed, glass taps the element, clears it and types, then reads the element back to confirm — up to three accessibility reads, since a field may commit a frame or two later. Errors if the element isn't editable, if it changed since the snapshot (re-snapshot), if the element does not hold the requested value afterwards, or if the app exposes no accessibility tree. That does-not-hold error names both what you asked for and what the element holds, and which one it is decides your next move: your text in another form means the element transformed it and writing again will not help; part of your text means a keystroke was dropped, so write again; what it held before means the write took no effect, and the error then closes with what this backend knows about that. A separate error says the text WAS typed but the write could not be confirmed — the read-back failed, or could not tell which element now holds it. Do NOT write again on that one: the keystrokes already went out, and re-snapshotting is how you see where they landed. Optional return: "snapshot" settles the UI then folds a fresh a11y tree into the result (and refreshes the snapshot cache); "settle" waits for the UI to stop changing (text-only); omit or "none" for no observe (default). If at least two next actions or waits are known, use glass_do instead of separate calls.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The element `#id` from `glass_a11y_snapshot`. | |
| text | Yes | The value to set. For a text field, the text. For a spin/slider, a number. For a switch/checkbox/toggle, a boolean (`"true"`/`"false"`/`"on"`/`"off"`/ `"1"`/`"0"`) — idempotent. For a dropdown/combo box, an option label (case-insensitive); glass opens it and picks that option. | |
| return | No | Optional observe folded into the result: "snapshot" (wait for the UI to settle, then fold a fresh a11y tree, also refreshing the snapshot cache), "settle" (waits for visual stability and returns text-only metadata), or "none" (default). |