SeleniumHQ/selenium · error · WebDriverException
Unable to find url to connect to from capabilities
Error message
Unable to find url to connect to from capabilities
What it means
Raised by start_devtools() when no CDP websocket URL could be obtained — neither from the se:cdp capability nor from _get_cdp_details(). Without a websocket endpoint, Selenium cannot open a DevTools channel. This is the catch-all 'no endpoint found' failure for the CDP code path.
Source
Thrown at py/selenium/webdriver/remote/webdriver.py:1157
if value.upper() in allowed_values:
self.execute(Command.SET_SCREEN_ORIENTATION, {"orientation": value})
else:
raise WebDriverException("You can only set the orientation to 'LANDSCAPE' and 'PORTRAIT'")
def start_devtools(self) -> tuple[Any, WebSocketConnection]:
global cdp
import_cdp()
if self.caps.get("se:cdp"):
ws_url = self.caps.get("se:cdp")
cdp_version = self.caps.get("se:cdpVersion")
if cdp_version is None:
raise WebDriverException("CDP version not found in capabilities")
version = cdp_version.split(".")[0]
else:
version, ws_url = self._get_cdp_details()
if not ws_url:
raise WebDriverException("Unable to find url to connect to from capabilities")
if cdp is None:
raise WebDriverException("CDP module not loaded")
self._devtools = cdp.import_devtools(version)
if self._websocket_connection:
return self._devtools, self._websocket_connection
if self.caps["browserName"].lower() == "firefox":
raise RuntimeError("CDP support for Firefox has been removed. Please switch to WebDriver BiDi.")
if not isinstance(self.command_executor, RemoteConnection):
raise WebDriverException("command_executor must be a RemoteConnection instance for CDP support")
self._websocket_connection = WebSocketConnection(
ws_url,
self.command_executor.client_config.websocket_timeout,
self.command_executor.client_config.websocket_interval,
)
targets = self._websocket_connection.execute(self._devtools.target.get_targets())
for target in targets:View on GitHub (pinned to aa36b38e69)
Solutions
- Launch Chrome/Edge with --remote-debugging-port=9222 (or rely on Selenium Manager/Grid to inject it).
- Ensure the browser actually exposes /json/version with a webSocketDebuggerUrl field.
- If using Selenium Grid, confirm it injects se:cdp / se:cdpVersion; otherwise enable the debugger address in goog:chromeOptions.
Defensive patterns
Strategy: validation
Validate before calling
ws_url = driver.capabilities.get('se:cdp') or driver.capabilities.get('se:cdpVersion')
if not ws_url:
# ensure debugger address exists for local derivation
opts = driver.capabilities.get('goog:chromeOptions') or {}
if not opts.get('debuggerAddress'):
raise RuntimeError('No CDP endpoint; launch Chrome with --remote-debugging-port') Try / catch
from selenium.common.exceptions import WebDriverException
try:
devtools, conn = driver.start_devtools()
except WebDriverException as e:
if 'Unable to find url' in str(e):
# relaunch browser with remote debugging enabled
raise Prevention
- Launch Chromium with --remote-debugging-port=9222.
- Use Selenium Grid which injects se:cdp.
- Verify /json/version exposes webSocketDebuggerUrl before relying on CDP.
When it happens
Trigger: Calling driver.start_devtools() (or bidi_connection) when caps has no se:cdp AND _get_cdp_details() returns an empty/None websocket_url. This happens when the browser's /json/version endpoint did not expose webSocketDebuggerUrl, or when caps lack the chrome/edge debugger address entirely.
Common situations: Running against a headless or containerized Chrome/Edge whose DevTools endpoint is not exposed, a remote driver that strips debugger options, or a browser that was launched without --remote-debugging-port. Also seen when se:cdp is absent and the local debugger lookup fails.
Related errors
- CDP version not found in capabilities
- Can't get debugger address.
- CDP devtools module not loaded. Call import_devtools() first
- -32700
- CDP module not loaded
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/06aa8cb37c461d88.
Report an issue: GitHub.