# scroll

The `scroll` step.

Scrolls an element into view when given a target, or scrolls the page with the object form, for infinite-scroll lists. The object form needs `to` or `until`.

Type: `target or object`

## Keys

| Key | Type | Description |
|---|---|---|
| `scroll.delay_ms` | `integer` | The pause between scrolls in milliseconds, from `0` to `10000`. Defaults to `0`. |
| `scroll.max` | `integer` | The most scrolls to make, from `1` to `1000`. Required with `until` (lint `E002`). |
| `scroll.to` | `"bottom" \| "top"` | Where to scroll the page: `bottom` or `top`. |
| `scroll.until` | `condition` | Keeps scrolling until this condition holds or `max` scrolls have been made. |

Every step also takes the [common step keys](https://docs.kaab.ist/reference/dsl/steps#common-keys): `expect`, `id`, `if`, `name`, `on_error`, `optional`, `retry`, `side_effect`, `timeout_ms`, `x_kaab`.

## Example

```json
{
  "scroll": {
    "to": "bottom",
    "until": {
      "count": {
        "target": ".item",
        "min": 60
      }
    },
    "max": 20,
    "delay_ms": 300
  }
}
```

From the contract fixture `loop-until-scroll`, a program the test suite validates.
