| function dumpAccessibilityTree(accessibilityObject, stopElement, indent, allAttributesIfNeeded, getValueFromTitle) { |
| var str = ""; |
| var i = 0; |
| |
| for (i = 0; i < indent; i++) |
| str += " "; |
| str += accessibilityObject.role; |
| str += " " + (getValueFromTitle === true ? accessibilityObject.title : accessibilityObject.stringValue); |
| str += allAttributesIfNeeded && accessibilityObject.role == '' ? accessibilityObject.allAttributes() : ''; |
| str += "\n"; |
| |
| document.getElementById("tree").innerText += str; |
| |
| if (stopElement && stopElement.isEqual(accessibilityObject)) |
| return; |
| |
| var count = accessibilityObject.childrenCount; |
| for (i = 0; i < count; ++i) { |
| if (!dumpAccessibilityTree(accessibilityObject.childAtIndex(i), stopElement, indent + 1, allAttributesIfNeeded, getValueFromTitle)) |
| return false; |
| } |
| |
| return true; |
| } |
| |
| function touchAccessibilityTree(accessibilityObject) { |
| var count = accessibilityObject.childrenCount; |
| for (var i = 0; i < count; ++i) { |
| if (!touchAccessibilityTree(accessibilityObject.childAtIndex(i))) |
| return false; |
| } |
| |
| return true; |
| } |