问题
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
回答1:
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
来源:https://stackoverflow.com/questions/27843986/xcode-uiautomation-cant-interact-with-tttattributedlabel