<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>323692</bug_id>
          
          <creation_ts>2026-09-08 14:21:58 -0700</creation_ts>
          <short_desc>REGRESSION(320518@main): WebDriver returns &quot;no such element&quot; instead of &quot;stale element reference&quot; for a node reference from a previous document</short_desc>
          <delta_ts>2026-10-30 23:42:42 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebDriver</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=323694</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=323695</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=323386</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Lauro Moura">lmoura</reporter>
          <assigned_to name="Brent Fulgham">bfulgham</assigned_to>
          <cc>bburg</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2248305</commentid>
    <comment_count>0</comment_count>
    <who name="Lauro Moura">lmoura</who>
    <bug_when>2026-09-08 14:21:58 -0700</bug_when>
    <thetext>320518@main correctly split &quot;no such element&quot; from &quot;stale element reference&quot;, fixing almost 100 subtests, but the stale reference map is wiped on page navigation/refresh, as this information is stored by the AutomationSessionProxy JS instance living on the page&apos;s global object.

Expected: stale element reference
Actual:   no such element — &quot;Node with identifier &apos;node-…&apos; was not found&quot;

Per the spec, the stale references are associated to a given navigable, surviving navigations on that navigable:

&gt; A WebDriver session has a navigable seen nodes map which is a weak map between a navigable and a set. 

Tests affected:

imported/w3c/webdriver/tests/classic/back/back.py::test_seen_nodes[http]
imported/w3c/webdriver/tests/classic/forward/forward.py::test_basic
imported/w3c/webdriver/tests/classic/forward/forward.py::test_seen_nodes[http]
imported/w3c/webdriver/tests/classic/navigate_to/navigate.py::test_seen_nodes[http]
imported/w3c/webdriver/tests/classic/refresh/refresh.py::test_history_pushstate
imported/w3c/webdriver/tests/classic/refresh/refresh.py::test_no_browsing_context
imported/w3c/webdriver/tests/classic/refresh/refresh.py::test_seen_nodes[http]
imported/w3c/webdriver/tests/classic/refresh/refresh.py::test_seen_nodes[https]
imported/w3c/webdriver/tests/classic/refresh/refresh.py::test_seen_nodes[https coop]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_accept[alert]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_accept[beforeunload]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_accept[confirm]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_accept[prompt]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_accept_and_notify[beforeunload-None]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_default[beforeunload-None]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_dismiss[alert]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_dismiss[beforeunload]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_dismiss[confirm]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_dismiss[prompt]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_dismiss_and_notify[beforeunload-None]
imported/w3c/webdriver/tests/classic/refresh/user_prompts.py::test_ignore[beforeunload]
imported/selenium/py/test/selenium/webdriver/common/stale_reference_tests.py::test_old_page
imported/selenium/py/test/selenium/webdriver/common/stale_reference_tests.py::test_should_not_crash_when_calling_get_size_on_an_obsolete_element
imported/selenium/py/test/selenium/webdriver/common/stale_reference_tests.py::test_should_not_crash_when_querying_the_attribute_of_astale_element


I have a WIP patch from a previous attempt at bug230612 (https://github.com/WebKit/WebKit/pull/61870) that keeps the stale reference map in the C++ side, keyed by frame. It could be adjusted to be a follow-up to 320518@main (e.g. using the new StaleNode error, fix conflicts, etc.).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2248556</commentid>
    <comment_count>1</comment_count>
    <who name="Lauro Moura">lmoura</who>
    <bug_when>2026-09-09 07:07:57 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/73566</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2248562</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-09-09 07:19:18 -0700</bug_when>
    <thetext>Test gardening commit 320729@main (741f1cc7772d): &lt;https://commits.webkit.org/320729@main&gt;

Reviewed commits have been landed. Closing PR #73566 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2248674</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2026-09-09 13:17:38 -0700</bug_when>
    <thetext>&lt;rdar://problem/187042183&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2250766</commentid>
    <comment_count>4</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2026-09-15 12:24:54 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/74083</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2253765</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-09-23 15:06:23 -0700</bug_when>
    <thetext>Committed 321731@main (ff835bfba1ac): &lt;https://commits.webkit.org/321731@main&gt;

Reviewed commits have been landed. Closing PR #74083 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2254340</commentid>
    <comment_count>6</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2026-09-24 16:06:15 -0700</bug_when>
    <thetext>*** Bug 323694 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2272273</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-10-30 23:42:42 -0700</bug_when>
    <thetext>Committed 321067.651@safari-7626-branch (3200d473c5bb): &lt;https://commits.webkit.org/321067.651@safari-7626-branch&gt;

Reviewed commits have been landed. Closing PR #7594 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>