appium
Version:
Automation for Apps.
82 lines (76 loc) • 2.3 kB
YAML
name: Get Element Rect
short_description: Gets dimensions and coordinates of an element
example_usage:
java:
|
List<MobileElement> element = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID");
Rectangle rect = element.getRect();
javascript_wd:
|
let element = await driver.elementByAccessibilityId("SomeAccessibilityID");
let rect = await element.getRect();
javascript_wdio:
|
let rect = driver.elementIdRect("~SomeAccessibilityId");
ruby:
|
element = @driver.find_element :accessibility_id, "SomeAccessibilityID"
element.rect
php:
|
// TODO PHP sample
csharp:
|
// TODO C# sample
client_docs:
java: "https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html#getRect--"
javascript_wdio: "http://webdriver.io/api/protocol/elementIdRect.html"
ruby: "http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Element#rect-instance_method"
php: "https://github.com/appium/php-client/" # TODO PHP documentation link
csharp: "https://github.com/appium/appium-dotnet-driver/" # TODO Dotnet documentation link
# TODO: Confirm if all the drivers support this
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/elements/:element_id/rect
method: GET
url_parameters:
- name: session_id
description: ID of the session to route the command to
- name: element_id
description: ID of the element to get the rect of
response:
- name: x
type: number
description: X coordinate
- name: y
type: number
description: Y coordinate
- name: height
type: number
description: Height of the bounding rectangle
- name: weight
type: number
description: Width of the bounding rectangle
# Links to specifications. Should link to at least one specification
specifications:
w3c: https://www.w3.org/TR/webdriver/#dfn-get-element-rect