Class W3cMouse

java.lang.Object
io.karatelabs.driver.w3c.W3cMouse
All Implemented Interfaces:
Mouse

public class W3cMouse extends Object implements Mouse
W3C-based implementation of mouse actions. Uses the W3C Actions API (POST /session/{id}/actions).
  • Constructor Details

    • W3cMouse

      public W3cMouse(W3cSession session)
    • W3cMouse

      public W3cMouse(W3cSession session, double x, double y)
  • Method Details

    • move

      public Mouse move(double x, double y)
      Description copied from interface: Mouse
      Move mouse to specified coordinates.
      Specified by:
      move in interface Mouse
      Parameters:
      x - the x coordinate (viewport-relative)
      y - the y coordinate (viewport-relative)
      Returns:
      this for chaining
    • offset

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

      public Mouse click()
      Description copied from interface: Mouse
      Click at the current position.
      Specified by:
      click in interface Mouse
      Returns:
      this for chaining
    • doubleClick

      public Mouse doubleClick()
      Description copied from interface: Mouse
      Double-click at the current position.
      Specified by:
      doubleClick in interface Mouse
      Returns:
      this for chaining
    • rightClick

      public Mouse rightClick()
      Description copied from interface: Mouse
      Right-click at the current position.
      Specified by:
      rightClick in interface Mouse
      Returns:
      this for chaining
    • down

      public Mouse down()
      Description copied from interface: Mouse
      Press the mouse button down at the current position.
      Specified by:
      down in interface Mouse
      Returns:
      this for chaining
    • up

      public Mouse up()
      Description copied from interface: Mouse
      Release the mouse button at the current position.
      Specified by:
      up in interface Mouse
      Returns:
      this for chaining
    • wheel

      public Mouse wheel(double deltaX, double deltaY)
      Description copied from interface: Mouse
      Perform a mouse wheel scroll.
      Specified by:
      wheel in interface Mouse
      Parameters:
      deltaX - horizontal scroll amount (positive = right)
      deltaY - vertical scroll amount (positive = down)
      Returns:
      this for chaining
    • scrollDown

      public Mouse scrollDown(double amount)
      Description copied from interface: Mouse
      Scroll down at the current position.
      Specified by:
      scrollDown in interface Mouse
      Parameters:
      amount - the scroll amount in pixels
      Returns:
      this for chaining
    • scrollUp

      public Mouse scrollUp(double amount)
      Description copied from interface: Mouse
      Scroll up at the current position.
      Specified by:
      scrollUp in interface Mouse
      Parameters:
      amount - the scroll amount in pixels
      Returns:
      this for chaining
    • scrollRight

      public Mouse scrollRight(double amount)
      Description copied from interface: Mouse
      Scroll right at the current position.
      Specified by:
      scrollRight in interface Mouse
      Parameters:
      amount - the scroll amount in pixels
      Returns:
      this for chaining
    • scrollLeft

      public Mouse scrollLeft(double amount)
      Description copied from interface: Mouse
      Scroll left at the current position.
      Specified by:
      scrollLeft in interface Mouse
      Parameters:
      amount - the scroll amount in pixels
      Returns:
      this for chaining
    • dragTo

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

      public double getX()
      Description copied from interface: Mouse
      Get current x coordinate.
      Specified by:
      getX in interface Mouse
    • getY

      public double getY()
      Description copied from interface: Mouse
      Get current y coordinate.
      Specified by:
      getY in interface Mouse