Xcode UIAutomation can't interact with TTTAttributedLabel

江枫思渺然 提交于 2019-12-08 00:25:58

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!