Search code examples
iosxcodeautomationappiumtttattributedlabel

Xcode UIAutomation can't interact with TTTAttributedLabel


I'm trying to write automation scripts for my app and my problem is that Xcode UI Automation just can't see the elements of TTTAttributedLabel class. Getting full elements tree shows no sign of those TTTAttributedLabel elements. I'm using Xcode 6.1.1


Solution

  • By default TTTAttributedLabel isn't an accessibility element. It works as custom container and provides accessibility for links/phones and other detected data. To change this behaviour subclass TTTAttributedLabel and override methods of UIAccessibilityElement protocol.

    E.g. return YES in -(BOOL)isAccessibilityElement method and TTTAttributedLabel will work as UILabel