Scroll the page or active element in any direction using mouse wheel or keyboard.
Focus RequirementsScrolling requires the page or a frame to be focused. If an input field or other interactive element has focus, scroll commands may not work as expected. Before scrolling, ensure focus is on the page by:
Clicking on a non-interactive area (e.g., page background)
Pressing the Escape key to unfocus interactive elements
Clicking outside of input fields or text areas
If scroll is still not working, try using Page Down/Page Up keys directly:
await testdriver.pressKeys(['pagedown']); // Scroll downawait testdriver.pressKeys(['pageup']); // Scroll up
// After typing in an input, unfocus it firstawait testdriver.find('email input').click();await testdriver.type('user@example.com');// Click elsewhere or press Escape before scrollingawait testdriver.pressKeys(['escape']);// Or click a non-interactive area// await testdriver.find('page background').click();// Now scroll will work properlyawait testdriver.scroll('down');// If scroll still doesn't work, use Page Down directly// await testdriver.pressKeys(['pagedown']);
Control scroll distance with the options object
// For web pages, mouse scroll works wellawait testdriver.scroll('down', { amount: 3 });// For desktop apps or when mouse doesn't work, use keyboardawait testdriver.pressKeys(['pagedown']);
Keyboard scroll uses Page Down/UpKeyboard scrolling typically moves by one “page” at a time, which may be more than the specified click amount. It’s more compatible but less precise than mouse scrolling.