Class RobotsMouse
- All Implemented Interfaces:
org.openqa.selenium.interactions.Mouse
Driver model
This class wraps the Mouse of the RPA Driver, which is
itself a façade over the real automation backend — either a Selenium 4 based
Web driver (browser), a native Desktop driver (desktop
application UI), or a Universal driver supporting both. The (x, y)
actions therefore are not inherently browser actions: depending on the active backend the same
call may move a real OS cursor on the desktop or a pointer inside a browser viewport. Each method
simply delegates to the wrapped Mouse, so the actual interpretation of the coordinates is
decided by that underlying backend.
Coordinate system
The (x, y) overloads (for example click(int, int), mouseMove(int, int))
address an absolute point, wrapped in a PointedCoordinates, where
(0, 0) is the top-left of the screen (Desktop) or of the document (Web). These are raw
point coordinates, not element-relative offsets: to click relative to an element's
top-left corner, use the offset-based methods on UiElement (e.g.
UiElement.click(int, int)), which convert a top-left offset into the element-center
offset expected by the Selenium 4 Actions API.
- Samples
mouse().click(300, 200);— left-click the absolute point x=300, y=200 (screen pixels on Desktop, document pixels on Web).mouse().doubleClick(300, 200);— double-click the same absolute point.mouse().contextClick(300, 200);— right-click to open a context menu at that point.// Drag from (100, 100) to (400, 250) by holding the left button: mouse().mouseDown(100, 100) .mouseMove(400, 250) .mouseUp(400, 250);mouse().mouseMove(100, 100, 50, 20);— move to (100, 100) then shift by (50, 20), ending at the absolute point (150, 120).
-
Constructor Summary
ConstructorsConstructorDescriptionRobotsMouse(org.openqa.selenium.interactions.Mouse mouse) Wraps driver's mouse to use simplified RPA methods on it -
Method Summary
Modifier and TypeMethodDescriptionclick(int x, int y) Left-clicks the absolute point specified by coordinates.click(int clicks, int x, int y) Left-clicksclickstimes on the absolute point specified by coordinates.voidclick(org.openqa.selenium.interactions.Coordinates where) Left-clicks once at the given coordinates, delegating to the wrapped driver'sMouse.voidclick(org.openqa.selenium.interactions.Coordinates coordinates, int clicks) Left-clicksclickstimes at the given coordinates (all clicks at the same point), delegating to the wrapped driver'sMouse.contextClick(int x, int y) Right-clicks (context-clicks) the absolute point specified by coordinates.voidcontextClick(org.openqa.selenium.interactions.Coordinates where) Right-clicks (context-clicks) once at the given coordinates, delegating to the wrapped driver'sMouse.doubleClick(int x, int y) Double-clicks the absolute point specified by coordinates.voiddoubleClick(org.openqa.selenium.interactions.Coordinates where) Double-clicks (two left clicks) at the given coordinates, delegating to the wrapped driver'sMouse.booleanCompares this wrapper with another by reflectively comparing their fields (the wrapped mouse).inthashCode()mouseDown(int x, int y) Presses the left button down (without releasing it) at the absolute point specified by coordinates.voidmouseDown(org.openqa.selenium.interactions.Coordinates where) Presses the left button down (without releasing it) at the given coordinates, delegating to the wrapped driver'sMouse.mouseMove(int x, int y) Moves the mouse cursor to the absolute point specified by coordinates (no button press).mouseMove(int x, int y, int xOffset, int yOffset) Moves the mouse cursor to an absolute base point and then shifts it by an additional offset.voidmouseMove(org.openqa.selenium.interactions.Coordinates where) Moves the mouse cursor to the given coordinates (no button press), delegating to the wrapped driver'sMouse.voidmouseMove(org.openqa.selenium.interactions.Coordinates where, long xOffset, long yOffset) Moves the mouse cursor to a base point and then shifts it by an additional offset; the final position iswhere + (xOffset, yOffset).mouseUp(int x, int y) Releases the left button at the absolute point specified by coordinates.voidmouseUp(org.openqa.selenium.interactions.Coordinates where) Releases the left button at the given coordinates, delegating to the wrapped driver'sMouse.tripleClick(int x, int y) Triple-clicks the absolute point specified by coordinates.voidtripleClick(org.openqa.selenium.interactions.Coordinates where) Triple-clicks (three left clicks) at the given coordinates, delegating to the wrapped driver'sMouse.wheelClick(int x, int y) Middle-button (wheel) clicks the absolute point specified by coordinates.voidwheelClick(org.openqa.selenium.interactions.Coordinates where) Middle-button (wheel) clicks once at the given coordinates, delegating to the wrapped driver'sMouse.voidwheelDown(int times) Scrolls the mouse wheel down at the current cursor position, delegating to the wrapped driver'sMouse.voidwheelUp(int times) Scrolls the mouse wheel up at the current cursor position, delegating to the wrapped driver'sMouse.
-
Constructor Details
-
RobotsMouse
public RobotsMouse(org.openqa.selenium.interactions.Mouse mouse) Wraps driver's mouse to use simplified RPA methods on it- Parameters:
mouse- driver's Mouse object
-
-
Method Details
-
click
public void click(org.openqa.selenium.interactions.Coordinates where) Left-clicks once at the given coordinates, delegating to the wrapped driver'sMouse.Driver Type: Desktop, Web
- Specified by:
clickin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
where- target point (see the class-level "Coordinate system" section)- See Also:
-
click
public void click(org.openqa.selenium.interactions.Coordinates coordinates, int clicks) Left-clicksclickstimes at the given coordinates (all clicks at the same point), delegating to the wrapped driver'sMouse.Driver Type: Desktop
- Specified by:
clickin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
coordinates- target point (see the class-level "Coordinate system" section)clicks- number of consecutive clicks to perform- See Also:
-
doubleClick
public void doubleClick(org.openqa.selenium.interactions.Coordinates where) Double-clicks (two left clicks) at the given coordinates, delegating to the wrapped driver'sMouse.Driver Type: Desktop, Web
- Specified by:
doubleClickin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
where- target point (see the class-level "Coordinate system" section)- See Also:
-
tripleClick
public void tripleClick(org.openqa.selenium.interactions.Coordinates where) Triple-clicks (three left clicks) at the given coordinates, delegating to the wrapped driver'sMouse.Driver Type: Desktop
- Specified by:
tripleClickin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
where- target point (see the class-level "Coordinate system" section)- See Also:
-
mouseDown
public void mouseDown(org.openqa.selenium.interactions.Coordinates where) Presses the left button down (without releasing it) at the given coordinates, delegating to the wrapped driver'sMouse. Pair withmouseUp(Coordinates)for drag-and-drop.Driver Type: Desktop, Web
- Specified by:
mouseDownin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
where- target point (see the class-level "Coordinate system" section)- See Also:
-
mouseUp
public void mouseUp(org.openqa.selenium.interactions.Coordinates where) Releases the left button at the given coordinates, delegating to the wrapped driver'sMouse. Typically used aftermouseDown(Coordinates).Driver Type: Desktop, Web
- Specified by:
mouseUpin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
where- target point (see the class-level "Coordinate system" section)- See Also:
-
mouseMove
public void mouseMove(org.openqa.selenium.interactions.Coordinates where) Moves the mouse cursor to the given coordinates (no button press), delegating to the wrapped driver'sMouse.Driver Type: Desktop, Web
- Specified by:
mouseMovein interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
where- target point (see the class-level "Coordinate system" section)- See Also:
-
mouseMove
public void mouseMove(org.openqa.selenium.interactions.Coordinates where, long xOffset, long yOffset) Moves the mouse cursor to a base point and then shifts it by an additional offset; the final position iswhere + (xOffset, yOffset). Delegates to the wrapped driver'sMouse.Driver Type: Desktop, Web
- Specified by:
mouseMovein interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
where- base target point (see the class-level "Coordinate system" section)xOffset- additional horizontal offset from the base point, in pixels (grows to the right)yOffset- additional vertical offset from the base point, in pixels (grows downward)- See Also:
-
contextClick
public void contextClick(org.openqa.selenium.interactions.Coordinates where) Right-clicks (context-clicks) once at the given coordinates, delegating to the wrapped driver'sMouse.Driver Type: Desktop, Web
- Specified by:
contextClickin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
where- target point (see the class-level "Coordinate system" section)- See Also:
-
wheelClick
public void wheelClick(org.openqa.selenium.interactions.Coordinates where) Middle-button (wheel) clicks once at the given coordinates, delegating to the wrapped driver'sMouse.Driver Type: Desktop
- Specified by:
wheelClickin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
where- target point (see the class-level "Coordinate system" section)- See Also:
-
wheelUp
public void wheelUp(int times) Scrolls the mouse wheel up at the current cursor position, delegating to the wrapped driver'sMouse.Driver Type: Desktop
- Specified by:
wheelUpin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
times- number of wheel ticks to scroll up- See Also:
-
wheelDown
public void wheelDown(int times) Scrolls the mouse wheel down at the current cursor position, delegating to the wrapped driver'sMouse.Driver Type: Desktop
- Specified by:
wheelDownin interfaceorg.openqa.selenium.interactions.Mouse- Parameters:
times- number of wheel ticks to scroll down- See Also:
-
click
Left-clicks the absolute point specified by coordinates.Coordinates are absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section.
Driver Type: Desktop, Web
- Parameters:
x- absolute x coordinate, in pixelsy- absolute y coordinate, in pixels- Returns:
- instance of RobotsMouse
-
click
Left-clicksclickstimes on the absolute point specified by coordinates.Coordinates are absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section.
Driver Type: Desktop
- Parameters:
clicks- number of consecutive clicks to performx- absolute x coordinate, in pixelsy- absolute y coordinate, in pixels- Returns:
- instance of RobotsMouse
-
doubleClick
Double-clicks the absolute point specified by coordinates.Coordinates are absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section.
Driver Type: Desktop, Web
- Parameters:
x- absolute x coordinate, in pixelsy- absolute y coordinate, in pixels- Returns:
- instance of RobotsMouse
-
tripleClick
Triple-clicks the absolute point specified by coordinates.Coordinates are absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section.
Driver Type: Desktop
- Parameters:
x- absolute x coordinate, in pixelsy- absolute y coordinate, in pixels- Returns:
- instance of RobotsMouse
-
wheelClick
Middle-button (wheel) clicks the absolute point specified by coordinates.Coordinates are absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section.
Driver Type: Desktop
- Parameters:
x- absolute x coordinate, in pixelsy- absolute y coordinate, in pixels- Returns:
- instance of RobotsMouse
-
mouseDown
Presses the left button down (without releasing it) at the absolute point specified by coordinates. Pair withmouseUp(int, int)to implement drag-and-drop.Coordinates are absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section.
Driver Type: Desktop, Web
- Parameters:
x- absolute x coordinate, in pixelsy- absolute y coordinate, in pixels- Returns:
- instance of RobotsMouse
-
mouseUp
Releases the left button at the absolute point specified by coordinates. Typically used aftermouseDown(int, int).Coordinates are absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section.
Driver Type: Desktop, Web
- Parameters:
x- absolute x coordinate, in pixelsy- absolute y coordinate, in pixels- Returns:
- instance of RobotsMouse
-
mouseMove
Moves the mouse cursor to the absolute point specified by coordinates (no button press).Coordinates are absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section.
Driver Type: Desktop, Web
- Parameters:
x- absolute x coordinate, in pixelsy- absolute y coordinate, in pixels- Returns:
- instance of RobotsMouse
-
mouseMove
Moves the mouse cursor to an absolute base point and then shifts it by an additional offset. The final position is(x + xOffset, y + yOffset).The base point is absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section. The offset is then applied in the same axes (
xOffsetto the right,yOffsetdownward).Driver Type: Desktop, Web
- Parameters:
x- absolute base x coordinate, in pixelsy- absolute base y coordinate, in pixelsxOffset- additional horizontal offset from the base point, in pixels (grows to the right)yOffset- additional vertical offset from the base point, in pixels (grows downward)- Returns:
- instance of RobotsMouse
-
contextClick
Right-clicks (context-clicks) the absolute point specified by coordinates.Coordinates are absolute (screen pixels on Desktop, document pixels on Web); see the class-level "Coordinate system" section.
Driver Type: Desktop, Web
- Parameters:
x- absolute x coordinate, in pixelsy- absolute y coordinate, in pixels- Returns:
- instance of RobotsMouse
-
equals
Compares this wrapper with another by reflectively comparing their fields (the wrapped mouse). -
hashCode
public int hashCode()
-