gpt4 book ai didi

ios - UITest 中断处理程序调用 tap() 两次

转载 作者:行者123 更新时间:2023-11-29 13:52:26 25 4
gpt4 key购买 nike

我的 UITest 需要点击一个按钮,UIInteruptionMonitor 应该处理它。然而,发生的是按钮被点击,中断出现并得到处理,然后它再次尝试点击按钮。它似乎认为它实际上并没有点击按钮,当它有......

我有以下代码:

addUIInterruptionMonitor(withDescription: "Permissions") { alert -> Bool in
let okButton = alert.buttons["OK"]
if okButton.exists {
okButton.tap()
}

return true
}

app.buttons["Enable"].tap()

接下来会发生什么:

t =    91.24s     Find the "Enable" Button
t = 91.40s Check for interrupting elements affecting "Enable" Button
t = 91.42s Wait for com.apple.springboard to idle
t = 91.85s Found 1 interrupting element:
t = 91.86s Find the "“MyApp” Would Like to Access the Camera" Alert
t = 92.03s "“MyApp” Would Like to Access the Camera" Alert from Application 'com.apple.springboard'
t = 92.03s Invoking UI interruption monitors for "“MyApp” Would Like to Access the Camera" Alert from Application 'com.apple.springboard'
t = 92.03s Invoking Permissions
t = 92.04s Checking existence of `"OK" Button`
t = 92.21s Tap "OK" Button
t = 92.21s Wait for com.apple.springboard to idle
t = 92.50s Find the "OK" Button
t = 92.66s Check for interrupting elements affecting "OK" Button
t = 92.82s Synthesize event
t = 93.14s Wait for com.apple.springboard to idle
t = 93.54s Verifying handling...
t = 93.54s Check for interrupting elements affecting "Enable" Button
t = 93.55s Wait for com.apple.springboard to idle
t = 94.10s Confirmed successful handling of interrupting element
t = 94.10s Synthesize event
t = 95.39s Scroll element to visible
t = 96.55s Failed: Failed to scroll to visible (by AX action) Button, label: 'Enable', error: Error kAXErrorCannotComplete performing AXAction 2003 on element AX element pid: 62934, elementOrHash.elementID: 140664883255456.613
t = 97.57s Retrying `Tap "Enable" Button` (attempt #2)

最佳答案

这是正常的。当被系统警报中断时,无法执行预期的操作,因此在成功处理中断后重试。

更一般地说,您必须在处理程序中检查您是否成功处理了中断(例如,您找到了 ok 按钮并可以点击它),否则,您必须返回 false。

关于ios - UITest 中断处理程序调用 tap() 两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58975285/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com