accept
Arm acceptance of the next matching browser dialog
Arm the next browser dialog whose message contains the quoted fragment, then run the step that opens it. Must run before the triggering action.
Syntax
When I accept "<message-fragment>"Requirements
| Item | Contract |
|---|---|
| Element / control shape | None — arms the next browser dialog (alert/confirm/prompt). Not a DOM click target |
| How the label binds | Quoted string is a message fragment (payload) |
| Qualifiers that change resolve | None |
| Platform | Web |
| Wrong shape → use instead | Cookie banners → accept cookies or click. In-page modals → click / should, not accept |
When it fails
- Dialog message does not contain the fragment → dialog may be dismissed without accept.
- Must run before the step that opens the dialog.
See also UI contracts.
Examples
When I accept "Are you sure?"
When I click on "Delete"Notes
- The quoted string is a payload fragment match against the dialog message.
- Pair with dismiss for cancel / dismiss flows.