From c07f43e242cfabdb26afb0343711456581b94b52 Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Sat, 14 Mar 2026 20:54:08 -0500 Subject: [PATCH] fix: re-query accessibility tree when backend_node_id is stale (#806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: gracefully fall back to role/name lookup when backend_node_id is stale When the DOM changes between snapshot and click (common with SPAs and dynamic UIs), the stored backend_node_id becomes invalid. Previously, DOM.getBoxModel and DOM.resolveNode failures propagated as hard errors, bypassing the role/name fallback path entirely. Now these failures are caught and the code falls through to a JS-based element lookup. Also adds resolve_object_id_by_role_name so that resolve_element_object_id has a fallback for ref-based lookups (previously it had none), and improves the role matching JS to correctly map implicit ARIA roles (e.g. → "button", → "link"). Closes #805 * test: add e2e regression test for stale ref click fallback (#805) Verifies that clicking a ref whose backend_node_id has become stale (because the DOM was replaced by JavaScript) falls back to role/name lookup instead of failing with "Could not compute box model". * fix: use accessibility tree for stale ref fallback instead of JS heuristic Replace the hand-rolled JS role/name matching (getImplicitRole, getAccessibleName) with a re-query of Accessibility.getFullAXTree — the same data source that built the ref map during snapshot. This guarantees role/name matching is identical to what was stored, preventing silent wrong-element clicks from name computation divergence (e.g. aria-labelledby,