Expect form control value
electron_expect_valueAssert an element's text value matches a predicate (equals, contains, regex) in an Electron app, polling until condition is met or timeout.
Instructions
Assert the value of the element identified by ref or selector matches a predicate, polling until it holds or timeoutMs elapses. Provide exactly one of: equals, contains, regex, not_equals, not_contains. Optional flags (any of i, m, s, u) apply to regex; g and y are rejected as stateful. Returns: { ok, session_id, matched, actual }. Errors: EXPECTATION_FAILED (predicate not met within timeoutMs — details carry expected + actual; retryable), REF_NOT_FOUND (stale ref; carries similar_refs), TRANSPORT_UNSUPPORTED, NOT_RUNNING, BAD_ARGUMENT (no/multiple predicates, invalid regex or flags, or ref+selector both/neither).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Element ref from a snapshot (resolves to [data-sw-ref="N"]). Provide ref OR selector. | |
| flags | No | Optional regex flags (any of i, m, s, u) applied to the regex predicate; g and y are rejected as stateful. Only valid alongside a regex predicate. | |
| regex | No | The text must match this JavaScript regular expression. | |
| equals | No | The text must equal this exactly. | |
| contains | No | The text must contain this substring. | |
| selector | No | CSS selector. Provide ref OR selector, not both. | |
| sessionId | No | Target session id. Omit when a single session is running. | |
| timeoutMs | No | Max poll time in ms before EXPECTATION_FAILED (default 5000, clamped to 60000). 0 = check once. | |
| not_equals | No | The text must NOT equal this. | |
| not_contains | No | The text must NOT contain this substring. |