我创建了一系列在设备上运行良好的UI测试,但在使用模拟器时,我无法点击警报视图按钮。
let alert = app.alerts["Continue"]
alert.buttons["Yes"].tap()
相反,它与崩溃
Find: Descendants matching type Button
t = 10.17s Find: Elements matching predicate '"Yes" IN identifiers'
t = 10.18s Check for interrupting elements affecting "Yes" Button
t = 10.19s Requesting snapshot of accessibility hierarchy for app with pid 14120
t = 10.21s Find: Descendants matching predicate identifier == "NotificationShortLookView" OR elementType == 7
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil (NSInvalidArgumentException)
我相信(并希望(这是一个Xcode 13错误,可能很快就会在更新中得到修复。有人知道解决这个问题的方法吗?
事实证明,这只是在iOS 12模拟器上运行时的问题。在iOS 15.4模拟器上运行是可以的。