0

I have a segmented control with three buttons, labeled "I", "II" and curiously enough "III".

When I run in the simulator and record, it emits code of the form:

let app = XCUIApplication()
app.buttons["I"].tap()
app.buttons["II"].tap()
app.buttons["III"].tap()

When I execute this test, it crashes on the tap() with an exception of the form:

Assertion Failure: <unknown>:0: Failed to scroll to visible (by AX action) Button, label: 'I', error: Error -25204 performing AXAction 2003 on element

I tried drilling down to the button through its segmented control as such:

let presetCtl = app.segmentedControls["preset"]
presetCtl.children(matching: .button).element(boundBy: 0).tap()

But this produces the same assertion failure on the call to tap():

Assertion Failure: <unknown>:0: Failed to scroll to visible (by AX action) Button,label: 'I', error: Error -25204 performing AXAction 2003 on element...
Walt
  • 162
  • 1
  • 7

1 Answers1

1

Oh f*** me, this looks like a bug in XCode that I found a workaround for here: Xcode UI test - UI Testing Failure - Failed to scroll to visible (by AX action) when tap on Search field "Cancel' button

You would think that the buttons synthesized inside of a UISegmentedControl would have their isHittable property set to true, but, that is what you would get for thinking... Love ya !

Walt
  • 162
  • 1
  • 7