java.lang.Object
net.serenitybdd.screenplay.playwright.interactions.Scroll

public class Scroll extends Object
Comprehensive scrolling operations for both page-level and element scrolling.

Sample usage:

     // Page-level scrolling
     actor.attemptsTo(Scroll.toTop());
     actor.attemptsTo(Scroll.toBottom());
     actor.attemptsTo(Scroll.by(0, 500));
     actor.attemptsTo(Scroll.toPosition(0, 1000));

     // Element scrolling with alignment
     actor.attemptsTo(Scroll.to("#footer"));
     actor.attemptsTo(Scroll.to(FOOTER).andAlignToCenter());
     actor.attemptsTo(Scroll.to(ELEMENT).andAlignToTop());
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Element scrolling with alignment options.
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.serenitybdd.screenplay.Performable
    by(int deltaX, int deltaY)
    Scroll by the specified delta amounts.
    to(String selector)
    Scroll to an element identified by a selector.
    to(Target target)
    Scroll to a Target element.
    static net.serenitybdd.screenplay.Performable
    Scroll to the bottom of the page.
    static net.serenitybdd.screenplay.Performable
    toPosition(int x, int y)
    Scroll to an absolute position on the page.
    static net.serenitybdd.screenplay.Performable
    Scroll to the top of the page.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • to

      public static Scroll.ScrollToElement to(String selector)
      Scroll to an element identified by a selector.
      Parameters:
      selector - The CSS or XPath selector
      Returns:
      A ScrollToElement interaction for fluent configuration
    • to

      public static Scroll.ScrollToElement to(Target target)
      Scroll to a Target element.
      Parameters:
      target - The target element
      Returns:
      A ScrollToElement interaction for fluent configuration
    • toTop

      public static net.serenitybdd.screenplay.Performable toTop()
      Scroll to the top of the page.
      Returns:
      A Performable that scrolls to the top
    • toBottom

      public static net.serenitybdd.screenplay.Performable toBottom()
      Scroll to the bottom of the page.
      Returns:
      A Performable that scrolls to the bottom
    • by

      public static net.serenitybdd.screenplay.Performable by(int deltaX, int deltaY)
      Scroll by the specified delta amounts.
      Parameters:
      deltaX - Horizontal scroll amount (positive = right)
      deltaY - Vertical scroll amount (positive = down)
      Returns:
      A Performable that scrolls by the specified amounts
    • toPosition

      public static net.serenitybdd.screenplay.Performable toPosition(int x, int y)
      Scroll to an absolute position on the page.
      Parameters:
      x - The horizontal position
      y - The vertical position
      Returns:
      A Performable that scrolls to the specified position