Move Mouse To

Move the mouse by an offset of the specificed element

Example Usage

// Java
Actions action = new Actions(driver);
action.moveTo(element, 10, 10);
action.perform();

# Python
actions = ActionChains(driver)
actions.move_to(element, 10, 10)
actions.perform()

// Javascript
// webdriver.io example
driver.moveTo(element, 10, 10);



[//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/interactions/mouse/moveto.yml)
// wd example
await driver.moveTo(element, 10, 10);

# Ruby
# ruby_lib example
mouse.move_to(element)
mouse.move_to(element, 5, 5)


[//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/interactions/mouse/moveto.yml)
# ruby_lib_core example
@driver.mouse.move_to(element)
@driver.mouse.move_to(element, 5, 5)

# PHP
// TODO PHP sample

// C#
Actions action = new Actions(driver);
action.MoveToElement(element, 10, 10);
action.Perform();

Description

If no element is specified, the move is relative to the current mouse cursor. If an element is provided but no offset, the mouse will be moved to the center of the element. If the element is not visible, it will be scrolled into view.

Support

Appium Server

Platform Driver Platform Versions Appium Version Driver Version
iOS XCUITest None None None
UIAutomation None None None
Android UiAutomator2 None None None
Espresso None None None
UiAutomator None None None
Mac Mac ?+ 1.6.4+ All
Windows Windows 10+ 1.6.0+ All

Appium Clients

Language Support Documentation
Java All seleniumhq.github.io
Python All selenium-python.readthedocs.io
Javascript (WebdriverIO) All
Javascript (WD) All github.com
Ruby All www.rubydoc.info
PHP All github.com
C# All github.com

HTTP API Specifications

Endpoint

POST /session/:session_id/moveto

URL Parameters

name description
session_id ID of the session to route the command to

JSON Parameters

name type description
element string The ID of the element to move to. If not specified, relative to mouse position
xoffset number X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element
yoffset number Y offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element

Response

null

See Also