UI Testing: Failed to get refreshed snapshot

After pressing a button that loads a new page I get an error saying "UI Testing Failure - Failed to get refreshed snapshot"


The previous page where I press the button works fine. All the objects can be tapped and modified.

Once I move onto the next page nothing can be pressed. I remember during the WWDC video on UI Testing the guy said that when the displays change the elements are re-evalutated to get the most current data. Is that not working right now? Has anyone else had this problem/know of a fix?

Great solution and worked brilliantly for me. It can be debated that a hard sleep function would be less brittle due to developers possibly chaning the amount cells in a future check-in. Perhaps using a predicate containing a unary operator; equal or greater than.

Here's my version of it in swift 3 syntax:

    func waitForTableCount(toQuery: XCUIElementQuery, approximately: UInt) {
        let cell = toQuery
        expectation(for: NSPredicate(format: "count => \(approximately)"), evaluatedWith: cell, handler: nil)
        waitForExpectations(timeout: 30, handler: nil)
    }


And then use it in a `func`

waitForTableCount(toQuery: app.tables.cells, approximately: 4)
UI Testing: Failed to get refreshed snapshot
 
 
Q