2

I watched Apple's video on UIAutomation and saw some online tutorials about it. Most say to either set the accessibility label in code like:

self.helpButton.accessibilityLabel = @"helpButton";
self.helpButton.isAccessibilityElement = YES;

Or to use IB. When I try the above code, my script finds the button fine and I'm able to tap on it through my script. However, if in my storyboard, I click the Accessibility Enabled checkbox, and then I make the label: helpButton, my code does not find this button. When I log the elementTree, I get this:

UIAWindow ->
  UIAButton: name: Help rect: {...}

The title of my button is Help, but the accessibility label is set to helpButton. I don't see why logElementTree() has the name of the button as Help (title in IB), instead of helpButton (accessibilityLabel). Any thoughts? Thanks!

Display Name
  • 4,502
  • 2
  • 47
  • 63
Crystal
  • 28,460
  • 62
  • 219
  • 393

0 Answers0