Button Down

Click and hold the left mouse button at the current mouse coordinates

Example Usage

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

# Python
actions = ActionChains(driver)
actions.move_to_element(element)
actions.click_and_hold()
actions.perform()

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



// wd example
await driver.moveTo(element);
await driver.buttonDown();

# Ruby
# ruby_lib example
action.move_to(element).click_and_hold.perform


# ruby_lib_core example
@driver.action.move_to(element).click_and_hold.perform

# PHP
// TODO PHP sample

// C#
// TODO C# sample

Description

Note that the next mouse-related command that should follow is buttonup . Any other mouse command (such as click or another call to buttondown) will yield undefined behavior

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/buttondown

URL Parameters

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

JSON Parameters

name type description
button number Which button, {LEFT = 0, MIDDLE = 1 , RIGHT = 2}. Defaults to the left mouse button if not specified

Response

null

See Also