Get Active Element
Gets the active element of the current session
//: # (DO NOT EDIT THIS FILE! This is an auto-generated file. Editing for this document happens in /commands-yml/commands/element/other/active.yml)
Example Usage
// Java
WebElement currentElement = driver.switchTo().activeElement();
# Python
element = driver.switch_to.active_element
// Javascript
// webdriver.io example
driver.getActiveElement();
// wd example
let element = await driver.active();
# Ruby
# ruby_lib example
switch_to.active_element
# ruby_lib_core example
@driver.switch_to.active_element
# PHP
// TODO PHP example
// C#
IWebElement currentElement = driver.SwitchTo().ActiveElement();
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 /session/:session_id/element/active
URL Parameters
None
JSON Parameters
None
Response
A JSON object for the located element (object)
See Also
官方链接为:Active Element - Appium