Wait For
Wait For
Section titled “Wait For”Type: page-wait-for · Package: Browser v1.0.0
Pause the flow until an element reaches the state you indicate. It’s the essential tool to make your web automations reliable: instead of guessing with a fixed Delay how long a page takes, you wait exactly for the element you need to be ready.
How it works
Section titled “How it works”Look at the item indicated by the selector and wait until it reaches the requested state (or until timeout is exhausted, in which case it fails). As soon as it is fulfilled, the flow continues immediately — neither before nor later.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
selector | selector | The element to wait for. |
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
page | session | The page session. Omit it inside a body; outside, pass = page. |
state | list | State to expect: visible (def.) · hidden (hidden) · attached (present in the HTML) · detached (no longer present). |
timeout | number | Maximum in ms to wait. By default 30000. |
States
Section titled “States”| Estado | Wait for the element… |
|---|---|
visible | Appear and be visible (most used) |
hidden | It hides (e.g. a loading spinner that disappears) |
attached | Exists in the HTML, even if it is not visible |
detached | Stop existing in the HTML |
Example
Section titled “Example”Wait for the dashboard to load after logging in, and for the spinner to disappear:
Page Click selector = (#entrar)Page Wait For selector = (.spinner-carga) state = hidden // esperar a que termine de cargarPage Wait For selector = (.dashboard) state = visible // y a que aparezca el contenidoRelated activities
Section titled “Related activities”- Element Exists — check for presence without failing (returns true/false).
- Navigate — its parameter
waitUntilcontrols the page load wait. - Delay — sticky wait (less reliable; use as a last resort).