How to assign unique accessibility identifiers to the urls in UITextView or attributed text in UILabel?

How can we assign the unique accessibility identifiers to the urls in UITextView In the accessibility inspector, I am able to see the urls as separate elements but not able to set the accessibility identifiers for them. The accessibility identifiers are needed for automation testing.

In the screenshots added here, i have taken a UITextView which has urls in it.

Replies

You can use User Defined Runtime Attributes as detailed here:

https://medium.com/the-ministry-of-testing/adding-accessibility-identifiers-to-an-ios-app-c8e09d9c20f3

  • @Claude31, the above mentioned link describes how to provide accessibilityIdentifer to an element but my question is how to provide the accessibility identifiers to the urls which are in the UITextView. These urls are dynamic so there can be one or multiple inside the text.

Add a Comment

This isn't possible with the current API, if you find yourself needing to do this, please file a feedback report with a justification for your use case.

Did you get the solution for this issue?