storyboard
.the Utilities
Identity Inspector
addButton
)storyboard
.the Utilities
Identity Inspector
User Defined Runtime Attributes
Key Path
type - accessibilityIdentifier
Type
- `StringValue
- new accessibility identifier for your element (in example view
)import XCTest
class StackOverFlowUITests: XCTestCase {
private let app = XCUIApplication()
//Views
private var view: XCUIElement!
//Buttons
private var addButton: XCUIElement!
override func setUp() {
super.setUp()
app.launch()
//Views
view = app.otherElements["view"]
//Buttons
addButton = app.buttons["addButton"]
}
func testMyApp() {
addButton.tap()
view.tap()
}
}
In `` add Accessibility Identifier for element.