Search code examples
swiftxcodeswiftuixcode-ui-testingxcuitest

Set Accessibility Identifier on ActionSheet in SwiftUI


How can i set the accessibility identifier for an ActionSheet in SwiftUI.

I want to tap a button of it, because i need to identify it for my XCUITest.

I'm currently trying this for my :

app.sheets[""].buttons["Choose Photo"].tap()

Solution

  • Fixed it by using this:

    app.sheets.firstMatch.buttons["Choose Photo"].tap()