Skip to content

Commit

Permalink
Update xpath.py
Browse files Browse the repository at this point in the history
将xpath.info 和 uiobject.info的值类型保持一致,可能会更友好一些
  • Loading branch information
Zeros2619 authored and codeskyblue committed Apr 25, 2024
1 parent 0108c92 commit 0da31f9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions uiautomator2/xpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,13 @@ def info(self) -> Dict[str, Any]:
for k, v in dict(self.attrib).items():
if k in ("bounds", "class", "package", "content-desc"):
continue
ret[convert_to_camel_case(k)] = v
if k in ("checkable", "checked", "clickable", "enabled", "focusable", "focused", "scrollable",
"long-clickable", "password", "selected", "visible-to-user"):
ret[convert_to_camel_case(k)] = v == "true"
elif k == "index":
ret[k] = int(v)
else:
ret[convert_to_camel_case(k)] = v

ret["childCount"] = len(self.elem.getchildren())
ret["className"] = self.elem.tag
Expand All @@ -784,4 +790,4 @@ def info(self) -> Dict[str, Any]:
ret["packageName"] = self.attrib.get("package")
ret["contentDescription"] = self.attrib.get("content-desc")
ret["resourceName"] = self.attrib.get("resource-id")
return ret
return ret

0 comments on commit 0da31f9

Please sign in to comment.