Signature
Parameters
'up' | 'down'
default:"down"
Which way to scroll.
'left' and 'right' aren’t supported: TestDriver logs an error and doesn’t scroll.object
Errors
Throws an error ifdirection isn’t 'up', 'down', 'left' or 'right'.
If the screen doesn’t change after the scroll, TestDriver logs a warning instead of throwing. This usually means the page didn’t have focus.
Scroll until text appears
testdriver.scrollUntilText() scrolls in steps until it finds some text on screen:
object
required
maxDistance. testdriver.scrollUntilImage({ description }) works the same way for an image you describe.
Examples
Focus the page, then scroll
Load more results in an infinite list
Use the keyboard instead
Some apps don’t respond to the mouse wheel. Press Page Down withpressKeys():
Complete example
tests/scroll.test.mjs
Related
- pressKeys(): scroll with Page Down, Home and End
- find(): locate an element after scrolling to it
- Perform actions: every kind of action in one guide

