# Wait For Load State

Source: https://docs.scrappey.com/docs/wait-for-load-state

> Pause the browser's execution until a specific load state is reached, ensuring actions and data extraction occur only after the page is ready.

## Command

`"wait_for_load_state"`

## Parameters

| Parameter          | Type   | Required | Description                                                                    |
| ------------------ | ------ | -------- | ------------------------------------------------------------------------------ |
| `waitForLoadState` | string | Yes      | The load state to wait for. Options: `domcontentloaded`, `networkidle`, `load` |

## Example

```bash
curl -X POST "https://publisher.scrappey.com/api/v1?key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "request.get",
    "url": "https://example.com",
    "browserActions": [
      {
        "type": "wait_for_load_state",
        "waitForLoadState": "networkidle"
      }
    ]
  }'
```

## Notes

| State              | Description                                                    |
| ------------------ | -------------------------------------------------------------- |
| `domcontentloaded` | Fired when the DOM is fully loaded (before styles/images/etc). |
| `networkidle`      | Waits until there are no network requests for 500 ms.          |
| `load`             | Waits for the full load event including images and resources.  |
