Cant access TableViewCell elements using UI Automation

I have a custom Table View Cell that displays the details of a Conference Call. The body of the cell's constructor is below:

- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString*) reuseIdentifier {
 if(self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) {
      self.contentView.isAccessibilityElement = YES;
      self.contentView.accessibilityLabel = @"Blah";

      conferenceNameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
      conferenceNameLabel.adjustsFontSizeToFitWidth = YES;
      conferenceNameLabel.font = [UIFont systemFontOfSize:14];
      conferenceNameLabel.isAccessibilityElement = YES;
      conferenceNameLabel.accessibilityLabel = @"Name";
      [self.contentView addSubview:conferenceNameLabel];

      conferenceDateLabel = [[UILabel alloc] initWithFrame:CGRectZero];
      conferenceDateLabel.adjustsFontSizeToFitWidth = YES;
      conferenceDateLabel.font = [UIFont systemFontOfSize:14];
      conferenceDateLabel.isAccessibilityElement = YES;
      conferenceDateLabel.accessibilityLabel = @"Date";
      [self.contentView addSubview:conferenceDateLabel];

      recurringIconView = [[UIImageView alloc] initWithFrame:CGRectZero];
      [recurringIconView setContentMode:UIViewContentModeScaleAspectFit];
      recurringIconView.isAccessibilityElement = YES;
      recurringIconView.accessibilityLabel = @"Icon";
      [self.contentView addSubview:recurringIconView];

      [self setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
 }

 return self;

}

When using UI Automation, I can access the Content View using the accessibility label "Blah". But I cant access any of my Labels or my ImageView. Any reason why I can't get at those UI elements using UI automation?

Answers


Within your script, you should be able to log out the accessibility hierarchy for each cell using logElementTree():

cell.logElementTree();

These subview should appear in that logged tree, along with their accessibility labels.

If you somehow can't address these elements by their label, you should be able to grab them by their relative position in the list of sibling views:

var firstLabel = cell.elements()[0];

I walk through UI Automation and show examples of how to test out table views like this in my course on iTunes U.


Need Your Help

Error prompt position issue with validationengine plugin (Position Absolute)

jquery css jquery-validation-engine

I am using Position Absolute's Validation Engine for validating values on form.

Looking for a way for a website to monitor a file on client side

java security file-upload playframework client-server

I am developing a website which basically crunches numbers from data files and display statistics.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.