ios - 如何检查在xcode中的xctest案例中显示的警报 View
<p><div>
<aside class="s-notice s-notice__info post-notice js-post-notice mb16"role="status">
<div class="d-flex fd-column fw-nowrap">
<div class="d-flex fw-nowrap">
<div class="flex--item wmn0 fl1 lh-lg">
<div class="flex--item fl1 lh-lg">
<b>这个问题在这里已经有了答案</b>:
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以在<code>XCTest</code>中使用<code>addUIInterruptionMonitor</code>来处理<code>UIAlertController</code>。</p>
<pre><code>let handler = addUIInterruptionMonitor(withDescription: "alert handler") { (alert: XCUIElement) -> Bool in
let ok = alert.buttons["OK"]
XCTAssertTrue(ok.exists, "OK button doesn't exist")
ok.tap()
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 如何检查在xcode中的xctest案例中显示的警报 View ,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/37861644/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/37861644/
</a>
</p>
页:
[1]