chi*_*dro 10 passwords swift xcuitest
我目前正在使用
addUIInterruptionMonitor(withDescription: "System alerts") { alert in
let notNowButton = alert.buttons["Not Now"]
if notNowButton.exists {
notNowButton.tap()
return true
}
return false
}
Run Code Online (Sandbox Code Playgroud)
消除在执行 ui 测试期间显示的系统警报,但以下“表”不被识别为警报,我无法消除它。
我已经使用 xcode 中的“记录”按钮来获取“现在不”按钮的 ui 坐标:
app.scrollViews.otherElements.buttons["Not now"].tap()
Run Code Online (Sandbox Code Playgroud)
我在 Xcode 14.3 中遇到了与上述工作表相关的问题。有没有解决方案可以在执行过程中消除这些系统“表”?
顺便说一下,我们使用以下方法解决了这个问题:
private func eventuallyDismissPasswordAlert(_ app: XCUIApplication) {
if app.scrollViews.otherElements.buttons["Non ora"].waitForExistence(timeout: 2) {
tap(app.scrollViews.otherElements.buttons["Non ora"])
return
}
if app.scrollViews.otherElements.buttons["Not Now"].waitForExistence(timeout: 2) {
tap(app.scrollViews.otherElements.buttons["Not Now"])
return
}
}
Run Code Online (Sandbox Code Playgroud)
假设您使用的是模拟器或不需要该功能的设备,您可以转到“设置”应用程序并在“密码”和“密码选项”下禁用从钥匙串填充密码。这样可以防止床单破裂。
| 归档时间: |
|
| 查看次数: |
1456 次 |
| 最近记录: |