我想点击应用程序中的最后一个[播放]按钮,我正在寻找类似
app.buttons["play"].lastMatch.tap()
有什么办法吗?
我通过写一些扩展名解决了这个问题
extension XCUIElementQuery {
var lastMatch: XCUIElement { return self.element(boundBy: self.count - 1) }
}
之后,我可以像这样简单地编写代码
app.buttons.matching(identifier: "play").lastMatch.tap()
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句