scope
Switch element resolution to an iframe or frame for the scenario
Switch browsing context to a labeled iframe/frame for the rest of the scenario, or back to the main document. Separate from the element in stack.
Syntax
When I scope to "<frame-label>"
When I scope to "page"Qualifiers
| Qualifier | Role | Example |
|---|---|---|
to | Frame label or "page" | scope to "Payment frame" |
Requirements
| Item | Contract |
|---|---|
| Element / control shape | Visible iframe / frame with matching title, name, or aria-label (or find hint on the frame). "page" clears frame scope — no element |
| How the label binds | iframe/frame title → name → aria-label (first visible). Hints: by aria-label / by name / by id / by data-testid on the frame |
| Qualifiers that change resolve | to only |
| Platform | Web iframes; on mobile, limits resolution to a labeled container (same grammar) |
| Wrong shape → use instead | Browser tabs → switch. Nested page regions → in |
When it fails
frame "…" not found— label missed or frame not visible.
See also UI contracts.
Examples
When I scope to "Payment frame"
When I fill "card-number" with "4111111111111111"
When I scope to "page"Notes
- Element resolution (
fill,click,should have, …) uses the active frame until reset. - Free-standing
should see/not see/see containing/ wait-for-text also search inside the active iframe. scope to "page"restores the main document (same as a new scenario start).- Cleared automatically at each
Scenario:/Feature:boundary. - On mobile,
scope tolimits resolution to a labeled container (same grammar). - Not for tabs — use switch.