我有一个带有三个按钮的分段控件,分别标记为“ I”,“ II”和足够多的“ III”。
当我在模拟器中运行并记录时,它发出以下形式的代码:
let app = XCUIApplication()
app.buttons["I"].tap()
app.buttons["II"].tap()
app.buttons["III"].tap()
当我执行此测试时,它会在tap()上崩溃,除了以下形式:
Assertion Failure: <unknown>:0: Failed to scroll to visible (by AX action) Button, label: 'I', error: Error -25204 performing AXAction 2003 on element
我尝试通过其分段控件向下钻取按钮:
let presetCtl = app.segmentedControls["preset"]
presetCtl.children(matching: .button).element(boundBy: 0).tap()
但这会在调用tap()时产生相同的断言失败:
Assertion Failure: <unknown>:0: Failed to scroll to visible (by AX action) Button,label: 'I', error: Error -25204 performing AXAction 2003 on element...
答案 0 :(得分:1)
哦,我,这看起来像XCode中的错误,我在这里找到了解决方法:Xcode UI test - UI Testing Failure - Failed to scroll to visible (by AX action) when tap on Search field "Cancel' button
您会认为,在UISegmentedControl
内合成的按钮会将其isHittable
属性设置为true
,但这就是您想的...爱!