Skip to main content

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
browser.scroll(x, y)
Parameters
NameTypeDetails
x
optional
numberhorizontal scroll position (default: 0)
y
optional
numbervertical scroll position (default: 0)
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
});

Welcome! How can I help?

WebdriverIO AI Copilot