I am getting an error
No matches found for Find: Descendants matching type NavigationBar from input {(
Application, 0x60400019b790, pid: 20515, label: '<appname>'
)}
but the code was generated by the recording function of XCUITest so I don't understand why it can't find the navbar. I have added an accessibilityIdentifier
that is a localized string called dashboardNavBar
to try and use that to find it instead but I am having trouble querying it. The current code I am using is:
func testLoginLogout() {
let app = XCUIApplication()
//login credentials and other code that takes me to dashboard of app
app.navigationBars["Dashboard"].children(matching: .button).element(boundBy: 2).tap()
app.sheets["Do you want to Logout ?"].buttons["OK"].tap()
}
and the app.navigationBars...
line is the line that throws the error above. I was hoping someone could tell me why it is unable to locate this navBar or whatever the problem is, and how I can fix it or work around it using the accessibilityIdentifier
. Thanks.