SeleniumHQ/selenium · error · WebDriverException
Can't get debugger address.
Error message
Can't get debugger address.
What it means
Raised by _get_cdp_details() when reading the debugger address from goog:chromeOptions (Chrome) or ms:edgeOptions (Edge) raises AttributeError — i.e. the options capability is None or otherwise lacks a .get method. The method expects a dict with a 'debuggerAddress' key; if the browser-specific options cap is missing or null, .get('debuggerAddress') on None blows up and is caught here.
Source
Thrown at py/selenium/webdriver/remote/webdriver.py:1450
if self._request is None:
from selenium.webdriver.common.api_request_context import APIRequestContext
self._request = APIRequestContext(self)
return self._request
def _get_cdp_details(self):
import json
import urllib3
http = urllib3.PoolManager()
try:
if self.caps.get("browserName") == "chrome":
debugger_address = self.caps.get("goog:chromeOptions").get("debuggerAddress")
elif self.caps.get("browserName") in ("MicrosoftEdge", "webview2"):
debugger_address = self.caps.get("ms:edgeOptions").get("debuggerAddress")
except AttributeError:
raise WebDriverException("Can't get debugger address.")
res = http.request("GET", f"http://{debugger_address}/json/version")
data = json.loads(res.data)
browser_version = data.get("Browser")
websocket_url = data.get("webSocketDebuggerUrl")
import re
version = re.search(r".*/(\d+)\.", browser_version).group(1)
return version, websocket_url
# Virtual Authenticator Methods
def add_virtual_authenticator(self, options: VirtualAuthenticatorOptions) -> None:
"""Adds a virtual authenticator with the given options.
Example:View on GitHub (pinned to aa36b38e69)
Solutions
- Ensure the browser reports goog:chromeOptions / ms:edgeOptions with a debuggerAddress (launch with --remote-debugging-port).
- Use Selenium Grid which injects se:cdp/se:cdpVersion so _get_cdp_details() is not needed.
- If constructing caps manually, include the options dict with a valid debuggerAddress.
Defensive patterns
Strategy: validation
Validate before calling
browser = driver.capabilities.get('browserName')
opts_key = 'goog:chromeOptions' if browser == 'chrome' else 'ms:edgeOptions'
opts = driver.capabilities.get(opts_key) or {}
if not isinstance(opts, dict) or not opts.get('debuggerAddress'):
raise RuntimeError(f'{opts_key} missing debuggerAddress; launch with --remote-debugging-port') Type guard
def has_debugger_address(driver) -> bool:
browser = driver.capabilities.get('browserName')
key = 'goog:chromeOptions' if browser == 'chrome' else 'ms:edgeOptions'
opts = driver.capabilities.get(key)
return isinstance(opts, dict) and bool(opts.get('debuggerAddress')) Try / catch
from selenium.common.exceptions import WebDriverException
try:
driver.start_devtools()
except WebDriverException as e:
if "Can't get debugger address" in str(e):
raise Prevention
- Launch Chromium with --remote-debugging-port so debuggerAddress is populated.
- Use Selenium Grid to inject se:cdp/se:cdpVersion, avoiding _get_cdp_details().
- Include the vendor options dict when constructing caps manually.
When it happens
Trigger: Calling start_devtools()/bidi_connection() (which fall back to _get_cdp_details() when se:cdp is absent) on a Chrome/Edge session whose goog:chromeOptions or ms:edgeOptions capability is None or absent. The browserName matches 'chrome' or ('MicrosoftEdge'/'webview2') but the options dict is null.
Common situations: A remote/Grid that strips the vendor options caps, a manually-constructed capabilities dict that omits goog:chromeOptions, or a Chromium-based browser that does not report debuggerAddress. Note: for a browserName that is neither chrome nor edge, debugger_address is never assigned and you get a downstream NameError, not this message.
Related errors
- CDP version not found in capabilities
- Unable to find url to connect to from capabilities
- CDP devtools module not loaded. Call import_devtools() first
- CDP module not loaded
- command_executor must be a RemoteConnection instance for CDP
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/b6a9b3008503b8f8.
Report an issue: GitHub.