Edit this Doc Move Mouse To

Move the mouse by an offset of the specificed element

Example Usage

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

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

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



// wd example
await driver.moveTo(element, 10, 10);

@driver.mouse.move_to(element)
@driver.mouse.move_to(element, 5, 5)

// TODO C# sample

// TODO PHP sample

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