When I scroll to the bottom

Scrolls to the very bottom of the current page. The step first calls window.scrollTo(0, document.body.scrollHeight) to move the main window, then iterates every DOM element and scrolls any that has overflow-y: scroll or overflow-y: auto with hidden content. A scroll event is dispatched on each such element so that lazy-load listeners and virtual-scroll implementations are triggered.

This dual approach - window plus all scrollable containers - makes the step reliable on pages that use independently scrollable regions such as sidebars, modals, or off-canvas drawers. Use it before asserting footer content, "load more" buttons, or any element that only appears after the user reaches the page bottom. The optional words the and of the page are interchangeable in all phrasings.

Accepted phrasings

When I scroll to bottom
When I scroll to the bottom
When I scroll to the bottom of the page
When we scroll to bottom
When we scroll to the bottom
When scrolling to bottom
When scrolling to the bottom of the page
And I scroll to bottom

Examples

When I scroll to the bottom
And we scroll to bottom
When scrolling to the bottom of the page
And I scroll to the bottom

In a real scenario

Scenario: The footer navigation is present on the home page
  Given I am an anonymous user
  When I go to the homepage
    And wait
    And I scroll to the bottom of the page
  Then I should see "Privacy Policy"
    And I should see "Terms of Use"

Related steps

Back to Scroll Steps