Skip to content

Restore JS-click fallback for hidden elements#2452

Merged
soulgalore merged 3 commits intomainfrom
click-jsfallback
May 2, 2026
Merged

Restore JS-click fallback for hidden elements#2452
soulgalore merged 3 commits intomainfrom
click-jsfallback

Conversation

@soulgalore
Copy link
Copy Markdown
Member

The 27.0.0 switch to the Selenium Actions API for click broke the documented hide-everything-then-click pattern that visual-metric scripts use to keep the click itself from triggering an early first visual change (e.g. the Wikipedia login script in our docs). For a display:none element the Actions API doesn't throw — it moves the pointer to the bounding-box center, which is (0,0) for a zero-size box, and clicks there, hitting nothing. For overlays and pointer-events:none cases it does throw. Either way, scripts that worked on 26.x silently or loudly stopped firing the click on 27.0.0.

Pre-check isDisplayed() and use a JavaScript click when the element isn't displayed; otherwise try the Actions API and fall back to a JS click on any failure. Both fallbacks log at info so the path taken is visible without --verbose, and a final "both failed" case logs at error before rethrowing. The hidden-element case is covered by a new clickTest case that asserts from inside the navigation script so a silent miss can't be mistaken for success.

Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com
Change-Id: If9087f5c2a43cef98a8091260ecd6e2a63402c5b

soulgalore added 3 commits May 2, 2026 09:34
The 27.0.0 switch to the Selenium Actions API for click broke the
documented hide-everything-then-click pattern that visual-metric
scripts use to keep the click itself from triggering an early first
visual change (e.g. the Wikipedia login script in our docs). For a
display:none element the Actions API doesn't throw — it moves the
pointer to the bounding-box center, which is (0,0) for a zero-size
box, and clicks there, hitting nothing. For overlays and
pointer-events:none cases it does throw. Either way, scripts that
worked on 26.x silently or loudly stopped firing the click on 27.0.0.

Pre-check isDisplayed() and use a JavaScript click when the element
isn't displayed; otherwise try the Actions API and fall back to a JS
click on any failure. Both fallbacks log at info so the path taken is
visible without --verbose, and a final "both failed" case logs at
error before rethrowing. The hidden-element case is covered by a new
clickTest case that asserts from inside the navigation script so a
silent miss can't be mistaken for success.

Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com
Change-Id: If9087f5c2a43cef98a8091260ecd6e2a63402c5b
Change-Id: I6191820392e6ba291652163e21da68f71c265b7c
@soulgalore soulgalore merged commit a205092 into main May 2, 2026
16 checks passed
@soulgalore soulgalore deleted the click-jsfallback branch May 2, 2026 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant