From 6c7ea35a7ddda08bb6bf9c99c52f9938299aedb7 Mon Sep 17 00:00:00 2001 From: PJ Date: Sat, 18 Apr 2026 02:29:11 +0700 Subject: [PATCH] feat(hierarchy): expose checked/focused/selected on element objects --- internal/hierarchy/hierarchy.go | 9 +++++++++ internal/verifier/marshal.go | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/internal/hierarchy/hierarchy.go b/internal/hierarchy/hierarchy.go index 427865c..4881520 100644 --- a/internal/hierarchy/hierarchy.go +++ b/internal/hierarchy/hierarchy.go @@ -42,6 +42,9 @@ type Element struct { Package string Clickable bool Enabled bool + Checked bool + Focused bool + Selected bool Bounds Bounds } @@ -160,6 +163,12 @@ func elementFromStart(start xml.StartElement) (*Element, error) { element.Clickable = attribute.Value == "true" case "enabled": element.Enabled = attribute.Value == "true" + case "checked": + element.Checked = attribute.Value == "true" + case "focused": + element.Focused = attribute.Value == "true" + case "selected": + element.Selected = attribute.Value == "true" case "bounds": boundsText = attribute.Value } diff --git a/internal/verifier/marshal.go b/internal/verifier/marshal.go index 29903ca..ccd0009 100644 --- a/internal/verifier/marshal.go +++ b/internal/verifier/marshal.go @@ -71,6 +71,11 @@ func elementObject(runtime *goja.Runtime, element *hierarchy.Element, selector s _ = object.Set("text", element.Text) _ = object.Set("desc", element.Description) _ = object.Set("class", element.Class) + _ = object.Set("clickable", element.Clickable) + _ = object.Set("enabled", element.Enabled) + _ = object.Set("checked", element.Checked) + _ = object.Set("focused", element.Focused) + _ = object.Set("selected", element.Selected) _ = object.Set("x", centerX) _ = object.Set("y", centerY) _ = object.Set(tagSelector, selector)