IMPORTANT NOTICE. If the supervisor is set to available, XCUITest may not have access to its subzones.
You can access an element by setting its accessibility through a storyboard or programmatically, as discussed above. You can click the record button when the cursor is in a function that begins with the prefix "test" to record how XCUITest sees the element. Sometimes you need to clear the pair (command shift k) and a couple of minutes for the record button to be available. You can also remove your tree from the storyboard and use XCUITest functions, such as element (boundBy: Int), children (matching: .textField), you can also link them: XCUIApplication (). Tables.cells.containing (.button, identifier: "id"). After this is easy, use .exists, which returns a boolean.

source share