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.
This commit is contained in:
pj committed 2026-04-27 18:38:24 +07:00
1 parent f850e573f8
commit b213f2470b
1 file changed
+4 -1
+4 -1
View File
@@ -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' ||