Wait for a widget
wait_forWaits until a widget matching a selector is on screen, then returns matches. Use it instead of polling the tree when UI elements appear asynchronously.
Instructions
Waits until a widget matching the selector is on screen, and returns the matches. Use this instead of polling tree when something appears asynchronously.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | The widget's ID, exactly as shown after # in the tree. | |
| nth | No | Which match to use when several qualify, 0-based; negative counts from the end. | |
| role | No | The semantic role. | |
| label | No | The label, matched exactly. | |
| value | No | The current value, matched exactly — for example the selected item of a list. | |
| timeout_ms | No | How long to wait, in milliseconds. Defaults to 5000. | |
| label_contains | No | A substring of the label, for labels that carry live data. |