Skip to content

[πŸ› Bug]: Python - staleness_of is crashing with Node with given id does not belong to the documentΒ #15401

@nijel

Description

@nijel

What happened?

The staleness_of predicate occasionally crashes with:

selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Node with given id does not belong to the document"}

This happens like in a few percent of test runs. Maybe this error should consider the element to be stale as well?

How can we reproduce the issue?

old_page = driver.find_element(By.TAG_NAME, "html")
button = driver.find_element(By.ID, "login-button")
button.click()
WebDriverWait(driver, timeout).until(staleness_of(old_page))

Relevant log output

 DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/url {'url': 'http://localhost:44713/'}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/window/rect {'x': None, 'y': None, 'width': 1200, 'height': 1024}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":{"height":1024,"width":1200,"x":10,"y":10}} | headers=HTTPHeaderDict({'Content-Length': '52', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element {'using': 'tag name', 'value': 'html'}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":{"element-6066-11e4-a52e-4f735466cecf":"f.96315BEE3240B233DDF88038EB78D53F.d.B4463F82CF9BAD5A90FF59C60049C91A.e.1462"}} | headers=HTTPHeaderDict({'Content-Length': '128', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element {'using': 'css selector', 'value': '[id="login-button"]'}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":{"element-6066-11e4-a52e-4f735466cecf":"f.96315BEE3240B233DDF88038EB78D53F.d.B4463F82CF9BAD5A90FF59C60049C91A.e.1463"}} | headers=HTTPHeaderDict({'Content-Length': '128', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element/f.96315BEE3240B233DDF88038EB78D53F.d.B4463F82CF9BAD5A90FF59C60049C91A.e.1463/click {}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 GET http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element/f.96315BEE3240B233DDF88038EB78D53F.d.B4463F82CF9BAD5A90FF59C60049C91A.e.1462/enabled {}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=404 | data={"value":{"error":"stale element reference","message":"stale element reference: stale element not found\n  (Session info: chrome=134.0.6998.35)","stacktrace":"#0 0x55eaf3e9946a \u003Cunknown>\n#1 0x55eaf3952ed0 \u003Cunknown>\n#2 0x55eaf396642b \u003Cunknown>\n#3 0x55eaf39651e2 \u003Cunknown>\n#4 0x55eaf395a479 \u003Cunknown>\n#5 0x55eaf39585df \u003Cunknown>\n#6 0x55eaf395c268 \u003Cunknown>\n#7 0x55eaf395c2f3 \u003Cunknown>\n#8 0x55eaf399f4ca \u003Cunknown>\n#9 0x55eaf39ca862 \u003Cunknown>\n#10 0x55eaf399833a \u003Cunknown>\n#11 0x55eaf39caa2e \u003Cunknown>\n#12 0x55eaf39f0ceb \u003Cunknown>\n#13 0x55eaf39ca633 \u003Cunknown>\n#14 0x55eaf39961be \u003Cunknown>\n#15 0x55eaf3997981 \u003Cunknown>\n#16 0x55eaf3e5f86b \u003Cunknown>\n#17 0x55eaf3e6373c \u003Cunknown>\n#18 0x55eaf3e46f12 \u003Cunknown>\n#19 0x55eaf3e642b4 \u003Cunknown>\n#20 0x55eaf3e2b0af \u003Cunknown>\n#21 0x55eaf3e87ad8 \u003Cunknown>\n#22 0x55eaf3e87cb6 \u003Cunknown>\n#23 0x55eaf3e982e6 \u003Cunknown>\n#24 0x7fa51929caa4 \u003Cunknown>\n#25 0x7fa519329c3c \u003Cunknown>\n"}} | headers=HTTPHeaderDict({'Content-Length': '1062', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element {'using': 'css selector', 'value': '[id="id_username"]'}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":{"element-6066-11e4-a52e-4f735466cecf":"f.96315BEE3240B233DDF88038EB78D53F.d.8D2E11A2AABD120F510736E8D4507135.e.1469"}} | headers=HTTPHeaderDict({'Content-Length': '128', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element/f.96315BEE3240B233DDF88038EB78D53F.d.8D2E11A2AABD120F510736E8D4507135.e.1469/value {'text': '[email protected]', 'value': ['w', 'e', 'b', 'l', 'a', 't', 'e', '@', 'e', 'x', 'a', 'm', 'p', 'l', 'e', '.', 'o', 'r', 'g']}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element {'using': 'css selector', 'value': '[id="id_password"]'}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":{"element-6066-11e4-a52e-4f735466cecf":"f.96315BEE3240B233DDF88038EB78D53F.d.8D2E11A2AABD120F510736E8D4507135.e.1470"}} | headers=HTTPHeaderDict({'Content-Length': '128', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element/f.96315BEE3240B233DDF88038EB78D53F.d.8D2E11A2AABD120F510736E8D4507135.e.1470/value {'text': 'testpassword', 'value': ['t', 'e', 's', 't', 'p', 'a', 's', 's', 'w', 'o', 'r', 'd']}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element {'using': 'tag name', 'value': 'html'}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":{"element-6066-11e4-a52e-4f735466cecf":"f.96315BEE3240B233DDF88038EB78D53F.d.8D2E11A2AABD120F510736E8D4507135.e.1477"}} | headers=HTTPHeaderDict({'Content-Length': '128', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element {'using': 'xpath', 'value': '//input[@value="Sign in"]'}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":{"element-6066-11e4-a52e-4f735466cecf":"f.96315BEE3240B233DDF88038EB78D53F.d.8D2E11A2AABD120F510736E8D4507135.e.1475"}} | headers=HTTPHeaderDict({'Content-Length': '128', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 POST http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element/f.96315BEE3240B233DDF88038EB78D53F.d.8D2E11A2AABD120F510736E8D4507135.e.1475/click {}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:403 GET http://localhost:34823/session/cb29bcff3d26a9a5bf8a9d3ee542865b/element/f.96315BEE3240B233DDF88038EB78D53F.d.8D2E11A2AABD120F510736E8D4507135.e.1477/enabled {}
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:436 Remote response: status=500 | data={"value":{"error":"unknown error","message":"unknown error: unhandled inspector error: {\"code\":-32000,\"message\":\"Node with given id does not belong to the document\"}\n  (Session info: chrome=134.0.6998.35)","stacktrace":"#0 0x55eaf3e9946a \u003Cunknown>\n#1 0x55eaf3952ed0 \u003Cunknown>\n#2 0x55eaf3939690 \u003Cunknown>\n#3 0x55eaf3937f2d \u003Cunknown>\n#4 0x55eaf39386ef \u003Cunknown>\n#5 0x55eaf39640b5 \u003Cunknown>\n#6 0x55eaf39667a6 \u003Cunknown>\n#7 0x55eaf39651e2 \u003Cunknown>\n#8 0x55eaf395a479 \u003Cunknown>\n#9 0x55eaf39585df \u003Cunknown>\n#10 0x55eaf395c268 \u003Cunknown>\n#11 0x55eaf395c2f3 \u003Cunknown>\n#12 0x55eaf399f4ca \u003Cunknown>\n#13 0x55eaf39ca862 \u003Cunknown>\n#14 0x55eaf399833a \u003Cunknown>\n#15 0x55eaf39caa2e \u003Cunknown>\n#16 0x55eaf39f0ceb \u003Cunknown>\n#17 0x55eaf39ca633 \u003Cunknown>\n#18 0x55eaf39961be \u003Cunknown>\n#19 0x55eaf3997981 \u003Cunknown>\n#20 0x55eaf3e5f86b \u003Cunknown>\n#21 0x55eaf3e6373c \u003Cunknown>\n#22 0x55eaf3e46f12 \u003Cunknown>\n#23 0x55eaf3e642b4 \u003Cunknown>\n#24 0x55eaf3e2b0af \u003Cunknown>\n#25 0x55eaf3e87ad8 \u003Cunknown>\n#26 0x55eaf3e87cb6 \u003Cunknown>\n#27 0x55eaf3e982e6 \u003Cunknown>\n#28 0x7fa51929caa4 \u003Cunknown>\n#29 0x7fa519329c3c \u003Cunknown>\n"}} | headers=HTTPHeaderDict({'Content-Length': '1270', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
DEBUG    selenium.webdriver.remote.remote_connection:remote_connection.py:465 Finished Request

Operating System

Ubuntu

Selenium version

Python 4.29.0

What are the browser(s) and version(s) where you see this issue?

Chromium 134.0.6998.0

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 134.0.6998.35

Are you using Selenium Grid?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    G-chromedriverRequires fixes in ChromeDriverI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions