{"record":{"id":"b6a9b3008503b8f8","repo":"SeleniumHQ/selenium","slug":"can-t-get-debugger-address","errorCode":null,"errorMessage":"Can't get debugger address.","messagePattern":"Can't get debugger address\\.","errorType":"exception","errorClass":"WebDriverException","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/remote/webdriver.py","lineNumber":1450,"sourceCode":"        if self._request is None:\n            from selenium.webdriver.common.api_request_context import APIRequestContext\n\n            self._request = APIRequestContext(self)\n        return self._request\n\n    def _get_cdp_details(self):\n        import json\n\n        import urllib3\n\n        http = urllib3.PoolManager()\n        try:\n            if self.caps.get(\"browserName\") == \"chrome\":\n                debugger_address = self.caps.get(\"goog:chromeOptions\").get(\"debuggerAddress\")\n            elif self.caps.get(\"browserName\") in (\"MicrosoftEdge\", \"webview2\"):\n                debugger_address = self.caps.get(\"ms:edgeOptions\").get(\"debuggerAddress\")\n        except AttributeError:\n            raise WebDriverException(\"Can't get debugger address.\")\n\n        res = http.request(\"GET\", f\"http://{debugger_address}/json/version\")\n        data = json.loads(res.data)\n\n        browser_version = data.get(\"Browser\")\n        websocket_url = data.get(\"webSocketDebuggerUrl\")\n\n        import re\n\n        version = re.search(r\".*/(\\d+)\\.\", browser_version).group(1)\n\n        return version, websocket_url\n\n    # Virtual Authenticator Methods\n    def add_virtual_authenticator(self, options: VirtualAuthenticatorOptions) -> None:\n        \"\"\"Adds a virtual authenticator with the given options.\n\n        Example:","sourceCodeStart":1432,"sourceCodeEnd":1468,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/remote/webdriver.py#L1432-L1468","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"browser = driver.capabilities.get('browserName')\nopts_key = 'goog:chromeOptions' if browser == 'chrome' else 'ms:edgeOptions'\nopts = driver.capabilities.get(opts_key) or {}\nif not isinstance(opts, dict) or not opts.get('debuggerAddress'):\n    raise RuntimeError(f'{opts_key} missing debuggerAddress; launch with --remote-debugging-port')","typeGuard":"def has_debugger_address(driver) -> bool:\n    browser = driver.capabilities.get('browserName')\n    key = 'goog:chromeOptions' if browser == 'chrome' else 'ms:edgeOptions'\n    opts = driver.capabilities.get(key)\n    return isinstance(opts, dict) and bool(opts.get('debuggerAddress'))","tryCatchPattern":"from selenium.common.exceptions import WebDriverException\ntry:\n    driver.start_devtools()\nexcept WebDriverException as e:\n    if \"Can't get debugger address\" in str(e):\n        raise","preventionTips":["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."],"tags":["cdp","devtools","capabilities","chrome","edge"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}