Get Active Element

Gets the active element of the current session

Example Usage

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

# Python
element = driver.switch_to.active_element

// Javascript
// webdriver.io example
driver.elementActive();



[//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/active.yml)
// wd example
let element = await driver.active();

# Ruby
# ruby_lib example
switch_to.active_element


[//]: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/active.yml)
# ruby_lib_core example
@driver.switch_to.active_element

# PHP
// TODO PHP example

// C#
// TODO C# example

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

HTTP API Specifications

Endpoint

POST /wd/hub/session/:session_id/element/active

URL Parameters

None

JSON Parameters

None

Response

A JSON object for the located element (object)

See Also