Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timestamped Event Matching Error: Failed to find matching element

I'm trying to generate a UItest in Xcode. When I try to swipe UIview I get an error:

Timestamped Event Matching Error: Failed to find matching element

error window

enter image description here

This also happens if I try to tap UIView.

like image 755
shay Avatar asked Apr 14 '16 07:04

shay


3 Answers

You should verify that the 'Accessibility' option is enabled for the UIView object you are swiping from, for example:

enter image description here

like image 136
AmitW Avatar answered Nov 11 '22 21:11

AmitW


Usually this issue is observed when the parent element of the element yo want to record is set to isAccessibilityElement = true. In general, you have to have the parent element set to false to access the child element.

For example: if you have a UILabel inside a view, the accessibility should be set to false for the view and set to true for the UILabel.

like image 19
Souma Paul Avatar answered Nov 11 '22 21:11

Souma Paul


For recording a new test, I don't think there's a solution yet. But, if you use an extension forcing tap with a test that already exists, works.

Example of use:

extension XCUIElement {

    func forceTapElement() {
        if self.hittable {
            self.tap()
        }
        else {
            let coordinate: XCUICoordinate = self.coordinateWithNormalizedOffset(CGVectorMake(0.0, 0.0))
            coordinate.tap()
        }  
    }
}

func testSomethingWithCells() {

   let app = XCUIApplication()
   let cells = app.tables.cells
   sleep(1)
   cells.elementBoundByIndex(0).forceTapElement()
}

You can check the original post here:

Xcode UI test - UI Testing Failure - Failed to scroll to visible (by AX action) when tap on Search field "Cancel' button

like image 2
Sophy Swicz Avatar answered Nov 11 '22 21:11

Sophy Swicz