I would like to tap the last [Play] button in my app, and I'm looking for something like
app.buttons["play"].lastMatch.tap()
Is there any way to do so?
I would like to tap the last [Play] button in my app, and I'm looking for something like
app.buttons["play"].lastMatch.tap()
Is there any way to do so?
I managed this problem by writing a little extension
extension XCUIElementQuery {
var lastMatch: XCUIElement { return self.element(boundBy: self.count - 1) }
}
after that, I can simply write code like this
app.buttons.matching(identifier: "play").lastMatch.tap()
© 2022 - 2024 — McMap. All rights reserved.