-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Open
Labels
C-pyPython BindingsPython BindingsD-chromeI-defectSomething is not working as intendedSomething is not working as intended
Description
Description
When I add a request handler via BiDi, I am unable to .continue_request()
when the request contains a data URL. (I only tried this with Chrome, so I'm not sure how other browsers handle this).
"Data URLs" contain embedded data rather than a normal network location. They are common for embedding fonts, images, etc.
https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data
To reproduce: add a request handler and then navigate to a page that will make subsequent requests for a data URL.
Reproducible Code
from selenium import webdriver
def log_urls(request):
print(f"Intercepted URL: {request.url}")
request.continue_request()
options = webdriver.ChromeOptions()
options.enable_bidi = True
driver = webdriver.Chrome(options=options)
driver.network.add_request_handler("before_request", log_urls)
driver.browsing_context.navigate(
url="https://selenium.dev", context=driver.current_window_handle
)
Debugging Logs
File "/home/cgoldberg/code/venv/lib/python3.13/site-packages/selenium/webdriver/common/bidi/network.py", line 143, in _callback
callback(request)
~~~~~~~~^^^^^^^^^
File "/home/cgoldberg/.pyenv/versions/3.13.7/lib/python3.13/threading.py", line 1043, in _bootstrap_inner
self.run()
~~~~~~~~^^
File "/home/cgoldberg/code/./foo.py", line 11, in log_urls
request.continue_request()
~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/cgoldberg/code/venv/lib/python3.13/site-packages/selenium/webdriver/common/bidi/network.py", line 315, in continue_request
self.network.conn.execute(command_builder("network.continueRequest", params))
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cgoldberg/.pyenv/versions/3.13.7/lib/python3.13/threading.py", line 994, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cgoldberg/code/venv/lib/python3.13/site-packages/selenium/webdriver/remote/websocket_connection.py", line 73, in execute
raise WebDriverException(error_msg)
File "/home/cgoldberg/code/venv/lib/python3.13/site-packages/selenium/webdriver/remote/websocket_connection.py", line 86, in _callback
callback(event.from_json(params))
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
selenium.common.exceptions.WebDriverException: Message: no such request: Network request with ID '10788.49' doesn't exist
Metadata
Metadata
Assignees
Labels
C-pyPython BindingsPython BindingsD-chromeI-defectSomething is not working as intendedSomething is not working as intended