Skip to content

scrollTo()

Scrolls the page to the given element. The alignment parameters can be overridden, see below. A reference of the possible values for the alignment parameters is available at https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView.

await scrollTo('Get Started')
await scrollTo(link('Get Started'))
await scrollTo('Get Started', { blockAlignment: 'center', inlineAlignment: 'center' })
NameTypeDescription
selectorselector | stringA selector of an element to scroll to.
optionsObjectDefault: {}.
options.waitForNavigationbooleanWait for navigation after the goto. Default navigationTimeout is 30 seconds to override pass { navigationTimeout: 10000 } in options parameter. Default: true.
options.waitForEventsArrayEvents available to wait for [‘DOMContentLoaded’, ‘loadEventFired’, ‘networkAlmostIdle’, ‘networkIdle’, ‘firstPaint’, ‘firstContentfulPaint’, ‘firstMeaningfulPaint’, ‘targetNavigated’] Default: [].
options.navigationTimeoutnumberNavigation timeout value in milliseconds for navigation after click. Default: 30000.
options.waitForStartnumberTime to wait for navigation to start. Accepts value in milliseconds. Default: 100.
options.blockAlignmentstringDefines vertical alignment. One of start, center, end or nearest. Default: 'nearest'.
options.inlineAlignmentstringDefines horizontal alignment. One of start, center, end or nearest. Default: 'nearest'.
TypeDescription
Promise<void>