When I scroll left

Scrolls the page to the left by a given number of pixels. The step takes one optional parameter: the pixel amount. When no number is supplied, the page scrolls left by the default of 350 pixels. The movement is relative to the current horizontal position, so it is the natural counterpart to scrolling right: scroll right to reveal content, then scroll left to come back.

The step operates on the page-level scrollbar only. If you are already at the far left, the step is a no-op: the browser clamps the position at zero, so it never fails. To jump straight back to the horizontal origin in one step, use the scroll-to-start step instead of repeated left scrolls.

Accepted phrasings

When I scroll left
When I scroll left 800
When we scroll left
When we scroll left 500
When scrolling left
When scrolling left 1200

The step also works with And as a continuation keyword inside a When block.

Examples

And I scroll left
When I scroll left 800
And we scroll left 500
When scrolling left 1200

In a real scenario

Scenario: A visitor can browse a wide schedule board in both directions
  Given I am an anonymous user
   When I go to "/events/schedule"
    And wait
    And I scroll right 1200
    And I wait 2s
   Then I should see "Friday sessions"
   When I scroll left 1200
    And I wait 2s
   Then I should see "Monday sessions"

Related steps

Back to Scroll Steps