This documentation is deprecated. Please refer to the README in the Appium repository or Appium 2.0 documentation.

  Edit this Doc Get Active Element

Gets the active element of the current session

Example Usage

WebElement currentElement = driver.switchTo().activeElement();

element = driver.switch_to.active_element

// webdriver.io example
driver.getActiveElement();

// wd example
let element = await driver.active();

# ruby_lib example
switch_to.active_element

# ruby_lib_core example
@driver.switch_to.active_element

IWebElement currentElement = driver.SwitchTo().ActiveElement();

Support

Appium Server

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

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
C# All github.com

HTTP API Specifications

Endpoint

'GET'(W3C), 'POST'(JSONWP) /session/:session_id/element/active

URL Parameters

None

JSON Parameters

None

Response

A JSON object for the located element (object)

See Also