Class ScrollIntoView


public class ScrollIntoView extends JavaScriptCommand
Command that scrolls a specified element into the visible area of the browser window.

This command executes the browser's native scrollIntoView() method on the target element, bringing it into view with the specified alignment.

  • Constructor Details

    • ScrollIntoView

      public ScrollIntoView(Element element, String align)
      Creates a ScrollIntoView command for the specified element.
      Parameters:
      element - the element to scroll into view
      align - the scroll alignment (e.g., "true" for top, "false" for bottom, or a JSON options object like "{behavior: 'smooth'}")
    • ScrollIntoView

      public ScrollIntoView(String elementId, String align)
      Creates a ScrollIntoView command for the element with the specified ID.
      Parameters:
      elementId - the ID of the element to scroll into view
      align - the scroll alignment (e.g., "true" for top, "false" for bottom, or a JSON options object like "{behavior: 'smooth'}")