def printAccessibilityIdentifiersHierarchy()

in commands/FBAccessibilityCommands.py [0:0]


def printAccessibilityIdentifiersHierarchy(view, indent=0):
    a11yIdentifier = accessibilityIdentifier(view)
    classDesc = objHelpers.className(view)
    indentString = "   | " * indent

    # if we don't have any accessibility identifier - we should have some children
    if int(a11yIdentifier.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)
            )
            printAccessibilityIdentifiersHierarchy(subview, indent + 1)
    else:
        print(
            indentString
            + (
                "({} {}) {}".format(
                    classDesc, view, a11yIdentifier.GetObjectDescription()
                )
            )
        )