Failed to determine hittability of an element

Xcode version : Version 9.4.1 (9F2000)


Currently I am testing an an app using Automation with XCTest Framework.


I am running into a series of issues with the UI where the element says it is visible (exists) and isHittable (Both are true), but the next thing that shows up is an Assertion Failure. (Note: This doesn't happen for the same element everytime. Sometimes it works fine with one element and doesnt with the same element).


Failed to determine hittability of "notification2:title" StaticText: Error copying attributes -25202


I found this issue in earlier versions of Xcode too but the Assertion failure gave an error "Failure to determine hit point for the element".


Thins that i have tried:


-> Adding sleep before checking if the element is hittable or when tapping on the element.

->Adding waitForExistenceWithTimeout before checking for the element or tapping on it.

These didn't help me.


Adding to the above, due to the nature of the app I can't test it on the simulator. I am testing it on a real device. And below is the log that i print before tapping or checking for the element. You can see element.exists and element.isHittable both return true but gives an Assertion failure.



Checking for the element is visible and hittable before scrolling the parentElement. Element is Visible--YES, Element is hittable--YES

Hi


I am using xcode 9.4.1. I am also facing the same issue. XCUITEST fails with message " Failed to determine hittability of an element already checked for existance and is visible on the screen. The issue only occurs sometimes with out any speicific pattern.

Ya happens the same. I have tried many things but still it gives me this Assertion failure at some point of time. Not sure if apple is aware of this issue.

Xcode Version 10.1 (10B61)


Nothing changed, by lldb command all right, but error sometimes occurs.

Still a problem 3 years later on Xcode 13.3.1 13E500a.

A workaround we are using is to wait for other elements to disappear or appear before waiting for the button to be hittable.

Such as

  • Waiting for a UIActivityIndicator to not exist
  • Waiting for a navigation bar to exist with certain text
  • Wait for a collection view to exist with a cell count

Seems to give the XCUIApplication more time to avoid the error

Hello!

The workaround you are using seems like the correct approach. Waiting for an item to exist is a common workflow in UI testing and seems like it would avoid issues collecting an element's attributes or its hitpoint.

If you encounter a bug in this area, please file a report on Feedback Assistant so we can take a look!

https://feedbackassistant.apple.com/

Thanks

Failed to determine hittability of an element
 
 
Q