I am having trouble automating tapping on an UIButton
that is embedded inside a UITableViewCell
if that cell is the table's only one. This is in the context of UI automation with KIF.
Here my relavant call:
[tester tapViewWithAccessibilityLabel: @"LABEL"
traits: UIAccessibilityTraitButton];
// trait only specified for 2nd case below
Here is what I am observing:
If I put the accessibility label on the UITableViewCell
KIF's KIFUITestActor - waitForAccessibilityElement:view:withLabel:traits:tappable:
returns the UITableView
, not the cell. Somehow the table seems to inherit its only child's accessibility label and lets KIF encounter it first during its recursive search.
If I put the accessibility label on the UIButton
instead, KIF finds it but determines that is is not tappable (i.e. UIView-KIFAdditions -tappablePointInRect:
returns NO
), presumably because its mainly transparent between the thin font lines for the button's label (the tap goes to a UITableViewCellContentView
instead).
A workaround might be tapping on the row by it's NSIndexPath
but maybe there is still a better way to overcome the described hurdles I am facing. So how could I instruct KIF to tap a button like this with a call to tapView...
?
This is just to confirm that this workaround is applicable:
[tester tapRowAtIndexPath: [NSIndexPath indexPathForRow: 0 inSection: 0]
inTableViewWithAccessibilityIdentifier: @"IDENTIFIER"];