WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
323386
WebDriver reports "stale element reference" for a node reference from a different browsing context
https://bugs.webkit.org/show_bug.cgi?id=323386
Summary
WebDriver reports "stale element reference" for a node reference from a diffe...
Brent Fulgham
Reported
2026-09-03 16:58:00 PDT
Each frame's injected WebAutomationSessionProxy.js keeps its own map of node handles. _nodeForIdentifier() throws NodeNotFound whenever a handle is absent from that map, which conflates two different situations: (1) the node was in this frame and has since been detached (a stale handle) (2) the node was never in this frame, because it belongs to a different frame or window CommandResult.cpp maps NodeNotFound to StaleElementReference, so both report stale element reference. Per the spec the second case is no such element (or no such shadow root for a shadow root reference). _clearStaleNodes() already knows the difference: it evicts exactly those handles whose node is no longer rooted in this document. Recording what it evicts lets _nodeForIdentifier() throw a distinct StaleNode error for the detached case and keep NodeNotFound for the foreign one. This fix improves 16 subtests across webdriver/tests/classic/execute_script/arguments.py and execute_async_script/arguments.py
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2026-09-03 16:58:21 PDT
<
rdar://problem/186615759
>
Brent Fulgham
Comment 2
2026-09-03 17:07:22 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/73206
EWS
Comment 3
2026-09-04 09:33:37 PDT
Committed
320518@main
(f56eb24b3195): <
https://commits.webkit.org/320518@main
> Reviewed commits have been landed. Closing PR #73206 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug