{"record":{"id":"6d39a56df5ba2224","repo":"SeleniumHQ/selenium","slug":"cdp-version-not-found-in-capabilities","errorCode":null,"errorMessage":"CDP version not found in capabilities","messagePattern":"CDP version not found in capabilities","errorType":"exception","errorClass":"WebDriverException","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/remote/webdriver.py","lineNumber":1151,"sourceCode":"            value: Orientation to set it to.\n\n        Example:\n            `driver.orientation = \"landscape\"`\n        \"\"\"\n        allowed_values = [\"LANDSCAPE\", \"PORTRAIT\"]\n        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(","sourceCodeStart":1133,"sourceCodeEnd":1169,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/remote/webdriver.py#L1133-L1169","documentation":"Raised by start_devtools() when the session capabilities contain a 'se:cdp' endpoint URL but no 'se:cdpVersion' string. Selenium needs the CDP (Chrome DevTools Protocol) major version to load the matching devtools API module, so a missing version makes it impossible to select the right protocol bindings. This path is taken only when se:cdp is present (e.g. when talking to Selenium Grid which injects these caps).","triggerScenarios":"Connecting to a Selenium Grid or remote that sets caps['se:cdp'] to a websocket URL but omits caps['se:cdpVersion']. Then calling driver.start_devtools() or accessing driver.bidi_connection().","commonSituations":"An older Grid version, a misconfigured Grid, or a custom remote endpoint that injects se:cdp without the version. Upgrading the Selenium Grid/server usually resolves version-mismatch cap omissions.","solutions":["Upgrade the Selenium Grid / standalone server to a version that emits both se:cdp and se:cdpVersion.","If you control the remote, ensure it reports the CDP version alongside the endpoint URL.","As a fallback, drop the se:cdp cap so Selenium derives version+url locally via _get_cdp_details() from the debugger address instead."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"caps = driver.capabilities\nif caps.get('se:cdp') and not caps.get('se:cdpVersion'):\n    raise RuntimeError('Remote provided se:cdp without se:cdpVersion; upgrade Grid')\ndriver.start_devtools()","typeGuard":null,"tryCatchPattern":"from selenium.common.exceptions import WebDriverException\ntry:\n    driver.start_devtools()\nexcept WebDriverException:\n    # fall back: drop se:cdp and derive locally via debugger address\n    pass","preventionTips":["Use a Selenium Grid/server version that emits both se:cdp and se:cdpVersion.","Check capabilities for the version before calling CDP APIs.","Prefer WebDriver BiDi where possible to avoid version coupling."],"tags":["cdp","devtools","capabilities","grid"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}