Protocol

XCUIElementAttributes

Attributes exposed by UI elements.

Declaration

protocol XCUIElementAttributes

Overview

The XCUIElementAttributes protocol adds attribute-related functionality to the XCUIElement class. Access these properties on an instance of XCUIElement to query the current state of the UI element's attributes.

Topics

Identity

var identifier: String

The element’s accessibility identifier.

Required.

var elementType: XCUIElement.ElementType

The type of the element.

Required.

enum XCUIElement.ElementType

The types of UI element that can be located.

Value

var value: Any?

The raw value attribute of the element.

Required.

var placeholderValue: String?

The value that is displayed when the element has no value.

Required.

var title: String

The title attribute of the element.

Required.

var label: String

The label attribute of the element.

Required.

Interaction State

var hasFocus: Bool

Whether or not the element has UI focus.

Required.

var isEnabled: Bool

Whether or not the element is enabled for user interaction.

Required.

var isSelected: Bool

Whether or not the element is selected.

Required.

Size

var frame: CGRect

The frame of the element in the screen coordinate space.

Required.

var horizontalSizeClass: XCUIElement.SizeClass

The horizontal size class of the element.

Required.

var verticalSizeClass: XCUIElement.SizeClass

The vertical size class of the element.

Required.

enum XCUIElement.SizeClass

Describes the available user interface size classes.

Relationships

Conforming Types

See Also

UI Elements

class XCUIElement

A UI element in an application.

class XCUICoordinate

A location on screen relative to some UI element.