xcode: Timestamped Event Matching Error: Failed to find matching element

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



xcode: Timestamped Event Matching Error: Failed to find matching element



I'm trying to record some XCUITesting functions. I get this error.


Timestamped Event Matching Error: Failed to find matching element



Is this an Xcode bug and/or issues with the complexity of my UI?





I have exactly the same problem
– Daniele B
Apr 16 '16 at 14:28





Same problem here.
– Felipe Plets
May 4 '16 at 23:07





Got the same problem.
– MB_iOSDeveloper
May 11 '16 at 8:52





Same problem here. I'm clicking on a tableview cell which it says it can't find... weird.
– Nuno Gonçalves
Jun 16 '16 at 22:41





Setting the isAccessibilityElement value to YES for my tableViewCells fixed this problem.
– ArdenDev
May 19 '17 at 12:43




3 Answers
3



I was having the same problem for a long time on a very complex app as well: The key is all in isAccessibilityElement being set to YES. UI testing and accessibility go hand-in-hand. The way I think about it is that the device needs to be able to interact with the element, since ostensibly, the user wouldn't be able to.


isAccessibilityElement



I did this twice:



In cellForRowAtIndexPath - cell.isAccessibilityElement = YES


cellForRowAtIndexPath


cell.isAccessibilityElement = YES



In awakeFromNib in a UITableViewCell subclass - self.isAccessibilityElement = YES


awakeFromNib


UITableViewCell


self.isAccessibilityElement = YES



Hope that helps, and good luck!



Try manipulating with items isAccessibilityElement property. As far as I know containers like tableView should have this property set to NO in order to items contained inside them be accessible



Quote from https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAccessibility_Protocol/#//apple_ref/occ/instp/NSObject/isAccessibilityElement :



Assistive applications can get information only about objects that are
represented by accessibility elements. Therefore, if you implement a
custom control or view that should be accessible to users with
disabilities, set this property to YES. The only exception to this
practice is a view that merely serves as a container for other items
that should be accessible.



You need to add key path value to your UI elements as below. For an example, if you are using a tableview then select it in the Storyboard and then click on Identity Inspector. Now enter the following value isAccessibilityElement in the key and tick the checkbox as shown in the image below.


tableview


Identity Inspector


isAccessibilityElement



enter image description here



Also if you can't tap on the UITableViewCell or the subclasses, then enable the Accessibility option as shown below.



enter image description here



hereafter it should work just fine.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered