Interface Mouse

All Known Implementing Classes:
CdpMouse, W3cMouse

public interface Mouse
Mouse actions interface for browser automation. Coordinates are viewport-relative.

Phase 8: Extracted from CdpMouse to enable multi-backend support.

  • Method Summary

    Modifier and Type
    Method
    Description
    Click at the current position.
    Double-click at the current position.
    Press the mouse button down at the current position.
    dragTo(double targetX, double targetY)
    Drag from current position to target position.
    double
    Get current x coordinate.
    double
    Get current y coordinate.
    move(double x, double y)
    Move mouse to specified coordinates.
    offset(double dx, double dy)
    Move mouse by offset from current position.
    Right-click at the current position.
    scrollDown(double amount)
    Scroll down at the current position.
    scrollLeft(double amount)
    Scroll left at the current position.
    scrollRight(double amount)
    Scroll right at the current position.
    scrollUp(double amount)
    Scroll up at the current position.
    up()
    Release the mouse button at the current position.
    wheel(double deltaX, double deltaY)
    Perform a mouse wheel scroll.
  • Method Details

    • move

      Mouse move(double x, double y)
      Move mouse to specified coordinates.
      Parameters:
      x - the x coordinate (viewport-relative)
      y - the y coordinate (viewport-relative)
      Returns:
      this for chaining
    • offset

      Mouse offset(double dx, double dy)
      Move mouse by offset from current position.
      Parameters:
      dx - the x offset
      dy - the y offset
      Returns:
      this for chaining
    • click

      Mouse click()
      Click at the current position.
      Returns:
      this for chaining
    • doubleClick

      Mouse doubleClick()
      Double-click at the current position.
      Returns:
      this for chaining
    • rightClick

      Mouse rightClick()
      Right-click at the current position.
      Returns:
      this for chaining
    • down

      Mouse down()
      Press the mouse button down at the current position.
      Returns:
      this for chaining
    • up

      Mouse up()
      Release the mouse button at the current position.
      Returns:
      this for chaining
    • wheel

      Mouse wheel(double deltaX, double deltaY)
      Perform a mouse wheel scroll.
      Parameters:
      deltaX - horizontal scroll amount (positive = right)
      deltaY - vertical scroll amount (positive = down)
      Returns:
      this for chaining
    • scrollDown

      Mouse scrollDown(double amount)
      Scroll down at the current position.
      Parameters:
      amount - the scroll amount in pixels
      Returns:
      this for chaining
    • scrollUp

      Mouse scrollUp(double amount)
      Scroll up at the current position.
      Parameters:
      amount - the scroll amount in pixels
      Returns:
      this for chaining
    • scrollRight

      Mouse scrollRight(double amount)
      Scroll right at the current position.
      Parameters:
      amount - the scroll amount in pixels
      Returns:
      this for chaining
    • scrollLeft

      Mouse scrollLeft(double amount)
      Scroll left at the current position.
      Parameters:
      amount - the scroll amount in pixels
      Returns:
      this for chaining
    • dragTo

      Mouse dragTo(double targetX, double targetY)
      Drag from current position to target position.
      Parameters:
      targetX - the target x coordinate
      targetY - the target y coordinate
      Returns:
      this for chaining
    • getX

      double getX()
      Get current x coordinate.
    • getY

      double getY()
      Get current y coordinate.