diff --git a/uiautomator2/__init__.py b/uiautomator2/__init__.py index 5d021cc..11e5ebf 100644 --- a/uiautomator2/__init__.py +++ b/uiautomator2/__init__.py @@ -262,7 +262,7 @@ def screenshot(self, filename: Optional[str] = None, format="pillow", display_id return return image_convert(pil_img, format) - def dump_hierarchy(self, compressed=False, pretty=False, max_depth: int = None) -> str: + def dump_hierarchy(self, compressed=False, pretty=False, max_depth: Optional[int] = None) -> str: """ Dump window hierarchy @@ -275,6 +275,8 @@ def dump_hierarchy(self, compressed=False, pretty=False, max_depth: int = None) xml content """ try: + if max_depth is None: + max_depth = self.settings['max_depth'] content = self._do_dump_hierarchy(compressed, max_depth) except HierarchyEmptyError: # pragma: no cover logger.warning("dump empty, return empty xml") diff --git a/uiautomator2/assets/sync.sh b/uiautomator2/assets/sync.sh index 99ec1d0..1739cc1 100755 --- a/uiautomator2/assets/sync.sh +++ b/uiautomator2/assets/sync.sh @@ -5,7 +5,7 @@ set -e APK_VERSION=$(cat ../version.py| grep apk_version | awk '{print $NF}') APK_VERSION=${APK_VERSION//[\"\']} -JAR_VERSION="0.1.0" +JAR_VERSION="0.1.2" cd "$(dirname $0)" diff --git a/uiautomator2/settings.py b/uiautomator2/settings.py index e63f4c5..cf04e4a 100644 --- a/uiautomator2/settings.py +++ b/uiautomator2/settings.py @@ -18,6 +18,7 @@ def __init__(self, d): "operation_delay": (0, 0), "operation_delay_methods": ["click", "swipe"], "fallback_to_blank_screenshot": False, + "max_depth": 50, } self._deprecated_props = {