How can I scroll to the bottom of a page using Cypress?
Adding a wait(0) after the scrollTo(100, 100) resolved the issue. In other words: scrollTo(100, 100).wait(0).
Hi naomirose. Please use below snippet at your end.
cy.scrollTo('bottom', { duration: 1000 })
I hope it helps.
1 Like
To scroll to the bottom of a page using Cypress, you can use the scrollTo
command with specific coordinates like this:
cy.scrollTo('bottom');
Another approach is to use the cy.window()
command to access the window object and then scroll to the document’s height, like this:
cy.window().then(win => {
win.scrollTo(0, win.document.body.scrollHeight);
});