For AI agents: a documentation index is available at /llms.txt
Skip to main content

waitForEvent

Waits for a named event to fire on the page's document or window.

**Usage Example:**

mutation WaitForEvent {
goto(url: "https://example.com", waitUntil: domContentLoaded) {
status
}

# Attach the listener *before* the event fires. "load" already fired
# during goto above, so wait for an event the page dispatches afterwards
# (eg: a custom event emitted once async setup completes).
waitForEvent(event: "app:ready") {
time
}
}

**Field Definition:**

waitForEvent(
event: String!
timeout: Float
): WaitForEvent

Arguments

waitForEvent.event ● String! non-null scalar

The name of the event to wait for, eg: "load" or a custom event name

waitForEvent.timeout ● Float scalar

The maximum amount of time, in milliseconds, to wait for the event to fire, overriding any defaults. Default timeout is 30 seconds, or 30000.

Type

WaitForEvent object

Response returned after having waited for an event to fire on the page