Element Attributes

XCUITest driver supports the following element attributes:

Name Description Example
name Could contain either element's identifier or its label, depending on which one is available first. Could also be null. It is recommended to prefer the usage of accessibilityIdentifier over accessibilityLabel for automation purposes, since the identifier property is supposed to stay constant under different locales and does not affect accessibility services such as VoiceOver. 'hello'
label Element's label value. Could be null. Since XCUITest driver 4.7.3 (WebDriverAgent 4.8.0), the behavior of this value was better aligned with XCTest, so it could include line breaks (\n). Before this version, line breaks were replaced by spaces. 'hello', 'hello\nworld'
type Element's type name 'XCUIElementTypeButton'
visible Whether the element is visible. This value is not available in the "vanilla" XCTest and is read directly from the accessibility layer 'false'
focused Whether the element is focused. Only available for tvOS prior to driver version 4.25.4 'true'
accessible Whether the element is accessible. This value is not available in the "vanilla" XCTest and is read directly from the accessibility layer 'true'
enabled Whether the element is enabled. 'false'
selected Whether the element is selected 'false'
index Element's index in the hierarchy relatively to its parent. Only available since Appium 1.20.0. Indexing starts from 0. '2'
rect Element's rectangle. The actual data of this attribute is based on element's frame. {'x': 0, 'y': 0, 'width': 100, 'height': 100}
value Element's value. This is a complex attribute, whose calculation algorithm depends on the actual element type. Check WebDriverAgent sources to know more about how it is compiled (method - (NSString *)wdValue). Could be null 'hello'