mokr.input.mouse ================ .. py:module:: mokr.input.mouse Classes ------- .. autoapisummary:: mokr.input.mouse.Mouse Module Contents --------------- .. py:class:: Mouse(client: mokr.connection.DevtoolsConnection, keyboard: mokr.input.keyboard.Keyboard) Class to emulate mouse movement. The `Mouse`'s remote position is measured in pixels, with origin at the top-left corner of the viewport. :param client: Remote `DevtoolsConnection` instance. :type client: DevtoolsConnection :param keyboard: Active `mokr.input.Keyboard` from the parent `mokr.input.Keyboard`. Passes active modifiers such as CTRL. :type keyboard: Keyboard .. py:method:: move(x: float, y: float, steps: int = 1) -> None :async: Move the mouse to target coordinates (`x`, `y`), sending intermittent events along the trail for each step in `steps`. :param x: Target X coordinate. :type x: float :param y: Target Y coordinate. :type y: float :param steps: Number of times to stop along the path. Defaults to 1 (final destination only). :type steps: int, optional .. py:method:: down(button: Literal['left', 'right', 'middle'] = 'left', click_count: int = 1) -> None :async: Send a "mousePressed" event with given mouse `button`, repeat for `click_count` number of times. :param button: Mouse button to send with. Defaults to "left". :type button: Literal["left", "right", "middle"], optional :param click_count: Number of click events to send. Defaults to 1. :type click_count: int, optional .. py:method:: up(button: Literal['left', 'right', 'middle'] = 'left', click_count: int = 1) -> None :async: Send a "mouseReleased" event with given mouse `button`, repeat for `click_count` number of times. :param button: Mouse button to send with. Defaults to "left". :type button: Literal["left", "right", "middle"], optional :param click_count: Number of click events to send. Defaults to 1. :type click_count: int, optional .. py:method:: click(x: float, y: float, button: Literal['left', 'right', 'middle'] = 'left', click_count: int = 1, delay: int | float | None = 1000) -> None :async: Move the pointer to the target coordinates and click. Shortcut to running `Mouse.move` then `Mouse.down` then `Mouse.up`. :param x: X coordinate to move to. :type x: float :param y: Y coordinate to move to. :type y: float :param button: Mouse button to click with. Defaults to "left". :type button: Literal["left", "right", "middle"], optional :param click_count: Number of clicks to run. Defaults to 1. :type click_count: int, optional :param delay: Time in milliseconds to wait before each click. Defaults to 1000. :type delay: int | float | None, optional