Class Scroll
java.lang.Object
net.serenitybdd.screenplay.playwright.interactions.Scroll
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 ClassesModifier and TypeClassDescriptionstatic classElement scrolling with alignment options. -
Method Summary
Modifier and TypeMethodDescriptionstatic net.serenitybdd.screenplay.Performableby(int deltaX, int deltaY) Scroll by the specified delta amounts.static Scroll.ScrollToElementScroll to an element identified by a selector.static Scroll.ScrollToElementScroll to a Target element.static net.serenitybdd.screenplay.PerformabletoBottom()Scroll to the bottom of the page.static net.serenitybdd.screenplay.PerformabletoPosition(int x, int y) Scroll to an absolute position on the page.static net.serenitybdd.screenplay.PerformabletoTop()Scroll to the top of the page.
-
Method Details
-
to
Scroll to an element identified by a selector.- Parameters:
selector- The CSS or XPath selector- Returns:
- A ScrollToElement interaction for fluent configuration
-
to
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 positiony- The vertical position- Returns:
- A Performable that scrolls to the specified position
-