The most recently observed state of the application.
SDK
- Xcode 9.0+
Framework
- XCTest
Declaration
var state: XCUIApplication.State { get }
Discussion
Applications are passively monitored to update this property as they change state. Consequently, updates to this property are inherently asynchronous.
Some guarantees are made, however:
When
launch()
andactivate()
return, if they were successful, the state of the application will beXCUIApplication
. An exception to this launching or activating a macOS agent application with LSUIElement set in its Info.plist file. This kind of application never gains foreground status and will be.State .running Foreground XCUIApplication
instead..State .running Background When
terminate()
returns, if it was successful, the state of the application will beXCUIApplication
..State .not Running