I've set up accessibility identifiers in the storyboard. These were working. However, I enabled accessibility on more views and now none of the elements can be found using the accessibility identifiers.
But, I can still find elements using the code generated by the record function.
Here's how I'm finding the elements:
XCUIApplication().buttons["loginButton"] //loginButton is the accessibility identifier
Here's how that same button is found using the recorder:
XCUIApplication().children(matching: .window).element(boundBy: 0).children(matching:
.other).element.children(matching: .other).element.children(matching:
.other).element.children(matching: .other).element.tap()
The error that I'm getting is:
No matches found for *typeOfElement*
I haven't been able to find an applicable solution online so far.
My question a nutshell: Why can't I get a reference to elements using the accessibility identifiers.
Thanks in advance.
The answer to this is that when you make a view accessible you also make all of its subviews inaccessible. Therefore, because I made the superview(s) of the views that I was accessing accessible I could no longer access those subviews. This means that to make the subviews accessible again I had to the disable the superview's accessibility property.