Package io.karatelabs.driver
Interface Mouse
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 TypeMethodDescriptionclick()Click at the current position.Double-click at the current position.down()Press the mouse button down at the current position.dragTo(double targetX, double targetY) Drag from current position to target position.doublegetX()Get current x coordinate.doublegetY()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
Move mouse to specified coordinates.- Parameters:
x- the x coordinate (viewport-relative)y- the y coordinate (viewport-relative)- Returns:
- this for chaining
-
offset
Move mouse by offset from current position.- Parameters:
dx- the x offsetdy- 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
Perform a mouse wheel scroll.- Parameters:
deltaX- horizontal scroll amount (positive = right)deltaY- vertical scroll amount (positive = down)- Returns:
- this for chaining
-
scrollDown
Scroll down at the current position.- Parameters:
amount- the scroll amount in pixels- Returns:
- this for chaining
-
scrollUp
Scroll up at the current position.- Parameters:
amount- the scroll amount in pixels- Returns:
- this for chaining
-
scrollRight
Scroll right at the current position.- Parameters:
amount- the scroll amount in pixels- Returns:
- this for chaining
-
scrollLeft
Scroll left at the current position.- Parameters:
amount- the scroll amount in pixels- Returns:
- this for chaining
-
dragTo
Drag from current position to target position.- Parameters:
targetX- the target x coordinatetargetY- the target y coordinate- Returns:
- this for chaining
-
getX
double getX()Get current x coordinate. -
getY
double getY()Get current y coordinate.
-