From b213f2470be5a370151350659801e470a24802d9 Mon Sep 17 00:00:00 2001 From: PJ Date: Mon, 27 Apr 2026 18:38:24 +0700 Subject: [PATCH] refactor(chrome): split tag (HTML name) from class (CSS classList) Hierarchy attributes now expose HTML tag under 'tag' and CSS classes under 'class', stopping the conflation of the two. --- internal/driver/chrome/driver.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/driver/chrome/driver.go b/internal/driver/chrome/driver.go index d119bcd..5a76ccd 100644 --- a/internal/driver/chrome/driver.go +++ b/internal/driver/chrome/driver.go @@ -206,7 +206,10 @@ 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['class'] = el.tagName.toLowerCase(); + if (el.tagName) attrs['tag'] = el.tagName.toLowerCase(); + if (el.className && typeof el.className === 'string' && el.className.trim()) { + attrs['class'] = el.className.trim(); + } if (isRoot) attrs['sanderling-screen'] = route; const isClickable = !!(el.onclick || el.tagName === 'A' || el.tagName === 'BUTTON' || el.tagName === 'INPUT' || el.tagName === 'SELECT' ||