# scroll

Scroll within the browser viewport. Note that `x` and `y` coordinates are relative to the current scroll positon, therefore `browser.scroll(0, 0)` is a non operation.

## Usage[​](#usage "Direct link to Usage")

```
await browser.scroll(x, y)
```

## Parameters[​](#parameters "Direct link to Parameters")

| Name                  | Type     | Details                                   |
| --------------------- | -------- | ----------------------------------------- |
| `x=0`<br />*optional* | `number` | horizontal scroll position (default: `0`) |
| `y=0`<br />*optional* | `number` | vertical scroll position (default: `0`)   |

## Example[​](#example "Direct link to Example")

scroll.js

```
it('should demonstrate the scroll command', async () => {
    await browser.url('https://webdriver.io')

    console.log(await browser.execute(() => window.scrollY)) // returns 0
    await browser.scroll(0, 200)
    console.log(await browser.execute(() => window.scrollY)) // returns 200
});
```
