在 SwiftUI 中的 ActionSheet 上设置辅助功能标识符
Posted
技术标签:
【中文标题】在 SwiftUI 中的 ActionSheet 上设置辅助功能标识符【英文标题】:Set Accessibility Identifier on ActionSheet in SwiftUI 【发布时间】:2020-01-11 21:43:26 【问题描述】:如何在 SwiftUI 中为 ActionSheet 设置可访问性标识符。
我想点击它的一个按钮,因为我需要为我的XCUITest
识别它。
我目前正在为我的:
app.sheets[""].buttons["Choose Photo"].tap()
【问题讨论】:
【参考方案1】:使用这个修复它:
app.sheets.firstMatch.buttons["Choose Photo"].tap()
【讨论】:
以上是关于在 SwiftUI 中的 ActionSheet 上设置辅助功能标识符的主要内容,如果未能解决你的问题,请参考以下文章
SwiftUI:UIAlertController ActionSheet 全屏
SwiftUI:如何在单击 ActionSheet 按钮时呈现新视图?