From 5d21b8c2cf99322fe70c1746ef108a900071596c Mon Sep 17 00:00:00 2001 From: PJ Date: Mon, 25 May 2026 18:11:41 +0530 Subject: [PATCH] feat(chrome): emit editable flag in hierarchy dump --- internal/driver/chrome/driver.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/driver/chrome/driver.go b/internal/driver/chrome/driver.go index d4b8dd6..f35c4a8 100644 --- a/internal/driver/chrome/driver.go +++ b/internal/driver/chrome/driver.go @@ -218,7 +218,8 @@ func (d *Driver) Hierarchy(_ context.Context) (string, error) { if (el.id) attrs['resource-id'] = el.id; const label = el.getAttribute('aria-label') || el.getAttribute('alt') || el.getAttribute('title') || ''; if (label) attrs['content-desc'] = label; - if (el.tagName) attrs['tag'] = el.tagName.toLowerCase(); + const tag = (el.tagName || '').toLowerCase(); + if (tag) attrs['tag'] = tag; if (el.className && typeof el.className === 'string' && el.className.trim()) { attrs['class'] = el.className.trim(); } @@ -226,6 +227,9 @@ func (d *Driver) Hierarchy(_ context.Context) (string, error) { const isClickable = !!(el.onclick || el.tagName === 'A' || el.tagName === 'BUTTON' || el.tagName === 'INPUT' || el.tagName === 'SELECT' || el.getAttribute('role') === 'button' || el.getAttribute('onclick')); + const isEditable = el.isContentEditable || tag === 'textarea' || + (tag === 'input' && !['button','submit','checkbox','radio','range','color','file','image','reset'] + .includes((el.type || '').toLowerCase())); const children = []; for (const child of el.children) { children.push(buildTree(child, false)); @@ -238,6 +242,7 @@ func (d *Driver) Hierarchy(_ context.Context) (string, error) { focused: document.activeElement === el || null, checked: el.checked || null, selected: el.selected || null, + editable: isEditable || null, }; } return buildTree(document.body, true);