appium
Version:
Automation for Apps.
87 lines (80 loc) • 2.74 kB
YAML
name: Find Element
short_description: Search for an element on the page
description:
>
Get the first element that matches a [locator strategy](/docs/en/commands/element/find-elements.md#selector-strategies)
example_usage:
java:
|
MobileElement elementOne = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID");
MobileElement elementTwo = (MobileElement) driver.findElementByClassName("SomeClassName");
python:
|
el = self.driver.find_element_by_accessibility_id('SomeAccessibilityID')
javascript_wd:
|
let elementOne = await driver.elementByAccessibilityId("SomeAccessibilityID");
let elementTwo = await driver.element("id", "SomeID");
javascript_wdio:
|
driver.element("~SomeAccessibilityId");
ruby:
|
@driver.find_element(:accessibility_id, 'SomeAccessibilityID')
php:
|
$el = $this->byAccessibilityId('SomeAccessibilityID');
csharp:
|
// TODO C# sample
client_docs:
java: "https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html#findElement-org.openqa.selenium.By-"
python: "http://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webdriver.WebDriver.find_element"
javascript_wdio: "http://webdriver.io/api/protocol/element.html#Usage"
javascript_wd: "https://github.com/admc/wd/blob/master/lib/commands.js#L745"
ruby: "http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/SearchContext:find_element"
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: true
uiautomation: true
android:
uiautomator2: true
uiautomator: true
mac:
mac: true
windows:
windows: true
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: /wd/hub/session/:session_id/element
method: 'POST'
url_parameters:
- name: session_id
description: ID of the session to route the command to
json_parameters:
- name: using
type: string
description: The locator strategy to use
- name: value
type: string
description: The search target
response:
- name: ELEMENT
type: object
description: A JSON object for the located element
# Links to specifications. Should link to at least one specification
specifications:
w3c: https://www.w3.org/TR/webdriver/#find-element
jsonwp: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelement