appium
Version:
Automation for Apps.
84 lines (76 loc) • 2.59 kB
YAML
name: Get Element Size
short_description: Determine an element's size in pixels
description: The size will be returned as an object with width and height properties.
example_usage:
java:
|
List<MobileElement> element = (MobileElement) driver.findElementByAccessibilityId("SomeAccessibilityID");
Dimension elementSize = element.getSize();
python:
|
size = self.driver.find_element_by_accessibility_id('SomeAccessibilityID').size
javascript_wd:
|
let element = await driver.elementByAccessibilityId("SomeAccessibilityID");
let size = await element.getSize();
javascript_wdio:
|
let size = driver.getElementSize("~SomeAccessibilityId");
ruby:
|
@driver.find_element(:accessibility_id, 'SomeAccessibilityID').size
php:
|
$el = $this->byAccessibilityId('SomeAccessibilityID');
$size = $el->size();
csharp:
|
// TODO C# sample
client_docs:
java: "https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/WebElement.html#getSize--"
python: "http://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webelement.WebElement.size"
javascript_wdio: "http://webdriver.io/api/property/getElementSize.html"
javascript_wd: "https://github.com/admc/wd/blob/master/lib/commands.js#L2203"
ruby: "http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Element:size"
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/size
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 size of
response:
- name: width
type: number
description: Width of the element
- name: height
type: number
description: Height of the element
# Links to specifications. Should link to at least one specification
specifications:
jsonwp: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidsize