wait CommandThe wait command pauses execution for a set amount of time or until an event fires. This command is asynchronous -- everything after it is delayed until the wait completes.
In the wait <time> form, you can use these formats:
10 -- 10 milliseconds100 ms -- 100 milliseconds100 milliseconds -- 100 milliseconds1 s -- 1000 milliseconds1 seconds -- 1000 millisecondsIn the wait for <event> form, execution pauses until the element receives the specified event. You can wait for multiple events with or, and destructure event properties into local variables using eventName(property1, property2, ...).
You can combine both forms, which is useful to avoid waiting forever:
-- Fail if the thing doesn't load after 1s.
wait for load or 1s
if the result is not an Event
throw 'Took too long to load.'
end
-- Parens are required for dynamic timeouts.
wait for click or (config.clickTimeout) ms
<div _="on click add .example then wait for transitionend">
Add the class, then wait for the transition to complete
</div>
<div _="on click add .example then wait 2s then remove .example">
Add and then remove a class
</div>
<div
_="wait for mousemove(clientX, clientY) or mouseup(clientX, clientY) from document"
>
Mouse Dragging...
</div>
wait <time-expression>
wait for <event-name> [from <expression>] (or <event-name> [from <expression>])*
wait for <event-name> or <time-expression>