Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ interface UiAutomatorXmlNode {
bounds?: string;
hint?: string;
focused?: string;
clickable?: string;
focusable?: string;
enabled?: string;
selected?: string;
package?: string;
"content-desc"?: string;
"resource-id"?: string;
}
Expand Down Expand Up @@ -207,9 +212,15 @@ export class AndroidRobot implements Robot {
}
}

if (node.text || node["content-desc"] || node.hint) {
// Include elements with text/labels OR clickable/focusable elements (like icons, buttons)
const hasTextOrLabel = node.text || node["content-desc"] || node.hint;
Copy link

@kamalsingh11 kamalsingh11 Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding node["resource-id"] to hasTextOrLabel to support Android compose semantics. I've added more details in one of my issues
#99

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const isInteractive = node.clickable === "true" || node.focusable === "true" ||
(node.class && (node.class.includes("Button") || node.class.includes("ImageView") ||
node.class.includes("ImageButton") || node.class.includes("View")));

if (hasTextOrLabel || isInteractive) {
const element: ScreenElement = {
type: node.class || "text",
type: node.class || "element",
text: node.text,
label: node["content-desc"] || node.hint || "",
rect: this.getScreenElementRect(node),
Expand Down