Here is something that I put together to help with a similar issue
where I needed to find and tap on a row in the bottom of a table view
with many cells...not sure if this helps with the discussion, but I
thought I would throw it out there:
+ (id)stepToScrollToViewWithAccessibilityLabel:(UIWindow *)inWindow
accessibilityLabel:(NSString *)inLabel scrollViewTag:
(NSInteger)inScrolViewTag
{
KIFTestStep *scrollStep = nil;
scrollStep = [KIFTestStep stepWithDescription:@"Scroll to view"
executionBlock:^(KIFTestStep *step, NSError **error)
{
UIView *taggedView = [inWindow viewWithTag:
99999];
if( [taggedView isKindOfClass:[UIScrollView
class]] )
{
NSError *labelError;
UIScrollView *scrollView = (UIScrollView
*)taggedView;
NSInteger yOffset =
scrollView.contentOffset.y;
CGRect scrollFrame = scrollView.frame;
CGSize contentSize = scrollView.contentSize;
while ( yOffset < contentSize.height )
{
UIAccessibilityElement *element = [self
accessibilityElementWithLabel:inLabel accessibilityValue:nil
tappable:NO traits:UIAccessibilityTraitNone error:&labelError];
if( element != nil )
{
break;
}
yOffset += scrollFrame.size.height;
CGRect scrollToRect = scrollFrame;
scrollToRect.origin.y = yOffset;
[scrollView
scrollRectToVisible:scrollToRect animated:YES];
}
}
return KIFTestStepResultSuccess;
}];
return scrollStep;
}
+ (NSArray *)stepsToScrollAndTapViewWithAccessibilityLabel:(UIWindow
*)inWindow accessibilityLabel:(NSString *)inLabel scrollViewTag:
(NSInteger)inScrolViewTag
{
NSMutableArray *steps = [NSMutableArray array];
[steps addObject:[KIFTestStep
stepToScrollToViewWithAccessibilityLabel:inWindow
accessibilityLabel:inLabel scrollViewTag:inScrolViewTag]];
[steps addObject:[KIFTestStep
stepToTapViewWithAccessibilityLabel:inLabel]];
return steps;