in commands/FBAccessibilityCommands.py [0:0]
def printAccessibilityHierarchy(view, indent=0):
a11yLabel = accessibilityLabel(view)
classDesc = objHelpers.className(view)
indentString = " | " * indent
# if we don't have any accessibility string - we should have some children
if int(a11yLabel.GetValue(), 16) == 0:
print(indentString + ("{} {}".format(classDesc, view)))
# We call private method that gives back all visible accessibility children
# for view
a11yElements = accessibilityElements(view)
accessibilityElementsCount = int(
fb.evaluateExpression("(int)[%s count]" % a11yElements)
)
for index in range(0, accessibilityElementsCount):
subview = fb.evaluateObjectExpression(
"[%s objectAtIndex:%i]" % (a11yElements, index)
)
printAccessibilityHierarchy(subview, indent + 1)
else:
print(
indentString
+ ("({} {}) {}".format(classDesc, view, a11yLabel.GetObjectDescription()))
)