【发布时间】:2017-01-21 05:32:59
【问题描述】:
我正在为我的应用程序编写 XCUITests,目前正在努力寻找消除应用程序警报的最佳解决方案。我有两组警报,一组是在全新安装开始时弹出的notifications 警报,第二组是全新安装后导航到应用程序附近选项卡时的location 警报。我尝试过使用
let alert = app.alerts["\u{201c}VoucherCodes\u{201d} Would Like to Send You Notifcations"].collectionViews.buttons["OK"]
if alert.exists{
alert.tap()
}
但没有成功,我也尝试在我的setUp()中使用systemAlertMonitorToken
systemAlertMonitorToken = addUIInterruptionMonitorWithDescription(systemAlertHandlerDescription) { (alert) -> Bool in
if alert.buttons.matchingIdentifier("OK").count > 0 {
alert.buttons["OK"].tap()
return true
} else {
return false
}
}
有没有人有任何建议或指出我哪里出错了,所以我可以解决这个问题,谢谢。
【问题讨论】:
-
这个问题似乎是在询问如何关闭多个警报,或者根据以前的设置可能会或可能不会显示的警报,而不仅仅是如何关闭警报。