{"record":{"id":"06aa8cb37c461d88","repo":"SeleniumHQ/selenium","slug":"unable-to-find-url-to-connect-to-from-capabilities","errorCode":null,"errorMessage":"Unable to find url to connect to from capabilities","messagePattern":"Unable to find url to connect to from capabilities","errorType":"exception","errorClass":"WebDriverException","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/remote/webdriver.py","lineNumber":1157,"sourceCode":"        if value.upper() in allowed_values:\n            self.execute(Command.SET_SCREEN_ORIENTATION, {\"orientation\": value})\n        else:\n            raise WebDriverException(\"You can only set the orientation to 'LANDSCAPE' and 'PORTRAIT'\")\n\n    def start_devtools(self) -> tuple[Any, WebSocketConnection]:\n        global cdp\n        import_cdp()\n        if self.caps.get(\"se:cdp\"):\n            ws_url = self.caps.get(\"se:cdp\")\n            cdp_version = self.caps.get(\"se:cdpVersion\")\n            if cdp_version is None:\n                raise WebDriverException(\"CDP version not found in capabilities\")\n            version = cdp_version.split(\".\")[0]\n        else:\n            version, ws_url = self._get_cdp_details()\n\n        if not ws_url:\n            raise WebDriverException(\"Unable to find url to connect to from capabilities\")\n\n        if cdp is None:\n            raise WebDriverException(\"CDP module not loaded\")\n\n        self._devtools = cdp.import_devtools(version)\n        if self._websocket_connection:\n            return self._devtools, self._websocket_connection\n        if self.caps[\"browserName\"].lower() == \"firefox\":\n            raise RuntimeError(\"CDP support for Firefox has been removed. Please switch to WebDriver BiDi.\")\n        if not isinstance(self.command_executor, RemoteConnection):\n            raise WebDriverException(\"command_executor must be a RemoteConnection instance for CDP support\")\n        self._websocket_connection = WebSocketConnection(\n            ws_url,\n            self.command_executor.client_config.websocket_timeout,\n            self.command_executor.client_config.websocket_interval,\n        )\n        targets = self._websocket_connection.execute(self._devtools.target.get_targets())\n        for target in targets:","sourceCodeStart":1139,"sourceCodeEnd":1175,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/remote/webdriver.py#L1139-L1175","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"ws_url = driver.capabilities.get('se:cdp') or driver.capabilities.get('se:cdpVersion')\nif not ws_url:\n    # ensure debugger address exists for local derivation\n    opts = driver.capabilities.get('goog:chromeOptions') or {}\n    if not opts.get('debuggerAddress'):\n        raise RuntimeError('No CDP endpoint; launch Chrome with --remote-debugging-port')","typeGuard":null,"tryCatchPattern":"from selenium.common.exceptions import WebDriverException\ntry:\n    devtools, conn = driver.start_devtools()\nexcept WebDriverException as e:\n    if 'Unable to find url' in str(e):\n        # relaunch browser with remote debugging enabled\n        raise","preventionTips":["Launch Chromium with --remote-debugging-port=9222.","Use Selenium Grid which injects se:cdp.","Verify /json/version exposes webSocketDebuggerUrl before relying on CDP."],"tags":["cdp","devtools","websocket","capabilities"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}