【问题标题】:Dismissing multiple alerts XCUITesing关闭多个警报 XCUITesing
【发布时间】: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
        }
    }

有没有人有任何建议或指出我哪里出错了,所以我可以解决这个问题,谢谢。

【问题讨论】:

标签: swift xcode-ui-testing


【解决方案1】:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-05
    • 1970-01-01
    • 1970-01-01
    • 2010-10-02
    • 2023-04-01
    • 1970-01-01
    • 2018-11-09
    • 1970-01-01
    相关资源
    最近更新 更多