<!--
{
  "availability" : [
    "Xcode: 16.3 -"
  ],
  "documentType" : "symbol",
  "framework" : "XCUIAutomation",
  "identifier" : "/documentation/XCUIAutomation",
  "metadataVersion" : "0.1.0",
  "role" : "Framework",
  "symbol" : {
    "kind" : "Framework",
    "modules" : [
      "XCUIAutomation"
    ],
    "preciseIdentifier" : "XCUIAutomation"
  },
  "title" : "XCUIAutomation"
}
-->

# XCUIAutomation

Replicate sequences of interactions and make sure that your app’s user interface behaves as intended.

## Overview

UI testing lets you verify that when you change parts of your app’s data model, your app’s view controllers, views, and controls respond appropriately. You can also create test cases to manipulate your app’s views and controls, as if a person is interacting with your interface.
Use the XCUIAutomation framework to control your app’s user interface and inspect its state.
Use <doc://com.apple.documentation/documentation/XCTest> to write tests that control your app using XCUIAutomation, and check if your app’s state matches your expectations.

> Note:
> UI testing isn’t available to apps you build using the visionOS SDK. You can still use it to test compatible iPad and iPhone apps that you build using the iOS SDK but run in visionOS.

## Topics

### Essentials

[Recording UI automation for testing](/documentation/XCUIAutomation/recording-ui-automation-for-testing)

Capture and replay interaction sequences to verify your app’s behavior.

### UI element queries

[`class XCUIElementQuery`](/documentation/XCUIAutomation/XCUIElementQuery)

An object that defines the search criteria a test uses to identify UI elements.

[`protocol XCUIElementTypeQueryProvider`](/documentation/XCUIAutomation/XCUIElementTypeQueryProvider)

A type that provides ready-made queries for locating descendant UI elements.

### UI elements

[`class XCUIElement`](/documentation/XCUIAutomation/XCUIElement)

A UI element in an application.

[`protocol XCUIElementAttributes`](/documentation/XCUIAutomation/XCUIElementAttributes)

Attributes exposed by UI elements.

[`protocol XCUIElementSnapshot`](/documentation/XCUIAutomation/XCUIElementSnapshot)

A set of attributes to express a snapshot of an element’s attributes and descendant user interface hierarchy.

[`protocol XCUIElementSnapshotProviding`](/documentation/XCUIAutomation/XCUIElementSnapshotProviding)

A method to capture a snapshot of an element’s attributes and descendant user interface hierarchy.

[`class XCUICoordinate`](/documentation/XCUIAutomation/XCUICoordinate)

A location on screen relative to a UI element.

### Application lifecycle

[`class XCUIApplication`](/documentation/XCUIAutomation/XCUIApplication)

A proxy that can launch, monitor, and terminate a test application.

### Screenshots

[`class XCUIScreen`](/documentation/XCUIAutomation/XCUIScreen)

A physical screen attached to a device.

[`class XCUIScreenshot`](/documentation/XCUIAutomation/XCUIScreenshot)

A captured image of a screen, app, or UI element state.

[`protocol XCUIScreenshotProviding`](/documentation/XCUIAutomation/XCUIScreenshotProviding)

A type that can provide a screenshot of its current UI state.

### Device simulation

[`class XCUIDevice`](/documentation/XCUIAutomation/XCUIDevice)

A proxy that can simulate physical buttons, device orientation, and Siri interaction for an iOS, watchOS, or tvOS device.

[`class XCUISystem`](/documentation/XCUIAutomation/XCUISystem)

A proxy that provides an interface to OS-specific properties and actions.

[`class XCUISiriService`](/documentation/XCUIAutomation/XCUISiriService)

A proxy that simulates a device’s Siri interface.

### Remote control simulation

[`class XCUIRemote`](/documentation/XCUIAutomation/XCUIRemote)

A class that simulates interaction with a physical remote control.

### UI testing availability

[`var XCUI_UI_TESTING_AVAILABLE: Int32`](/documentation/XCUIAutomation/XCUI_UI_TESTING_AVAILABLE)

Indicates whether the current environment supports UI testing.

### Classes

[`class XCUIVoiceOverService`](/documentation/XCUIAutomation/XCUIVoiceOverService)

### Variables

[`let XCUIVoiceOverServiceErrorDomain: String`](/documentation/XCUIAutomation/XCUIVoiceOverServiceErrorDomain)

Error domain for XCUIVoiceOverService errors.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)