A specific solution to this problem is to search for elements that are descendants of the main window.
func testNextButtonDisabled() { let app = XCUIApplication() XCTAssertFalse(app.childrenMatchingType(.Window).elementBoundByIndex(0).buttons["Next"].enabled) }
For a general solution to such problems: In Xcode, run the βRecord UI Testβ again to find out how Xcode thinks you should refer to the element you are interested in.
source share