Skip to content

Commit

Permalink
Merge pull request #237 from bartoszj/master
Browse files Browse the repository at this point in the history
Fixed `fa11y` command on iOS 10 and higher
  • Loading branch information
kastiglione committed Mar 14, 2018
2 parents fa0d4e7 + 854e8c7 commit 8312a63
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion commands/FBAccessibilityCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def accessibilityGrepHierarchy(self, view, needle):
#if we don't have any accessibility string - we should have some children
if int(a11yLabel.GetValue(), 16) == 0:
#We call private method that gives back all visible accessibility children for view
accessibilityElements = fb.evaluateObjectExpression('[[[UIApplication sharedApplication] keyWindow] _accessibilityElementsInContainer:0 topLevel:%s includeKB:0]' % view)
# iOS 10 and higher
if fb.evaluateBooleanExpression('[UIView respondsToSelector:@selector(_accessibilityElementsAndContainersDescendingFromViews:options:sorted:)]'):
accessibilityElements = fb.evaluateObjectExpression('[UIView _accessibilityElementsAndContainersDescendingFromViews:@[(id)%s] options:0 sorted:NO]' % view)
else:
accessibilityElements = fb.evaluateObjectExpression('[[[UIApplication sharedApplication] keyWindow] _accessibilityElementsInContainer:0 topLevel:%s includeKB:0]' % view)
accessibilityElementsCount = fb.evaluateIntegerExpression('[%s count]' % accessibilityElements)
for index in range(0, accessibilityElementsCount):
subview = fb.evaluateObjectExpression('[%s objectAtIndex:%i]' % (accessibilityElements, index))
Expand Down

0 comments on commit 8312a63

Please sign in to comment.