---
name: Move Mouse To
short_description: Move the mouse by an offset of the specificed element
   
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.

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_wd:
    |
      await driver.moveTo(element, 10, 10);

  javascript_wdio:
    |
      driver.moveTo(element, 10, 10);
  ruby:
    |
      @driver.mouse.move_to(element)
      @driver.mouse.move_to(element, 5, 5)
  php:
    |
      // TODO PHP sample
  csharp:
    |
      // TODO C# sample

client_docs:
  java: "https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/interactions/Actions.html#moveToElement-org.openqa.selenium.WebElement-"
  python: "http://selenium-python.readthedocs.io/api.html#selenium.webdriver.common.action_chains.ActionChains.move_to_element"
  javascript_wdio: "http://webdriver.io/api/protocol/moveTo.html#description"
  javascript_wd: "https://github.com/admc/wd/blob/master/lib/commands.js#L1600"
  ruby: "http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Mouse:move_to"
  php: "https://github.com/appium/php-client/" # TODO PHP documentation link
  csharp: "https://github.com/appium/appium-dotnet-driver/" # TODO Dotnet documentation link

# Driver support by platform
driver_support:
  ios:
    xcuitest: false
    uiautomation: false
  android:
    uiautomator2: false
    uiautomator: false
  mac:
    mac: true # TODO Confirm this that mouse movements
  windows:
    windows: true # TODO Confirm this
client_support:
  java: true
  python: true
  ruby: true
  php: true
  csharp: true
  javascript_wd: true
  javascript_wdio: true
  

# Information about the HTTP endpoints
endpoint:
  url: /session/:session_id/moveto
  method: POST
  url_parameters:
    - name: session_id
      description: ID of the session to route the command to
  json_parameters:
    - name: element
      type: string
      description: The ID of the element to move to. If not specified, relative to mouse position
    - name: xoffset
      type: number
      description: 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
    - name: yoffset
      type: number
      description: 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

# Links to specifications. Should link to at least one specification
specifications:
  w3c: https://drafts.csswg.org/cssom-view/#dom-window-moveto
  jsonwp: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#post-sessionsessionidmoveto
