SeleniumHQ/selenium · error · RuntimeError

CDP support for Firefox has been removed. Please switch to W

Error message

CDP support for Firefox has been removed. Please switch to WebDriver BiDi.

What it means

Raised by `execute_cdp_cmd` when the session's browserName is 'firefox'. Selenium removed Firefox CDP support; the CDP endpoint is Chromium-only, and Firefox users should use the standards-track WebDriver BiDi protocol instead. It is a RuntimeError.

Source

Thrown at py/selenium/webdriver/remote/webdriver.py:463

        """Execute Chrome Devtools Protocol command and get returned result.

        The command and command args should follow chrome devtools protocol domains/commands:
          - https://chromedevtools.github.io/devtools-protocol/

        Args:
            cmd: Command name.
            cmd_args: Command args. Empty dict {} if there is no command args.

        Returns:
            A dict, empty dict {} if there is no result to return. To
            getResponseBody: {'base64Encoded': False, 'body': 'response body
            string'}

        Example:
            `driver.execute_cdp_cmd("Network.getResponseBody", {"requestId": requestId})`
        """
        if self.caps["browserName"].lower() == "firefox":
            raise RuntimeError("CDP support for Firefox has been removed. Please switch to WebDriver BiDi.")
        return self.execute("executeCdpCommand", {"cmd": cmd, "params": cmd_args})["value"]

    def execute(
        self,
        driver_command: str | Generator[dict[str, Any], Any, Any],
        params: dict[str, Any] | None = None,
    ) -> Any:
        """Sends a command to be executed by a command.CommandExecutor.

        Args:
            driver_command: The name of the command to execute as a string.
                Can also be a BiDi protocol command generator.
            params: A dictionary of named parameters to send with the command.
                Ignored when ``driver_command`` is a BiDi generator.

        Returns:
            The command's JSON response loaded into a dictionary object.
        """

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Use the WebDriver BiDi API for Firefox: driver.bidi.<module> or the bidi connection.
  2. Gate CDP calls behind a Chromium check: if driver.caps['browserName'].lower() == 'chrome'.
  3. Replace the specific CDP command with a BiDi or cross-browser equivalent.

Example fix

# before
driver.execute_cdp_cmd('Network.setCacheDisabled', {'cacheDisabled': True})  # on Firefox

# after (use BiDi, or guard)
if driver.caps['browserName'].lower() in ('chrome','edge'):
    driver.execute_cdp_cmd('Network.setCacheDisabled', {'cacheDisabled': True})
else:
    # use WebDriver BiDi equivalents for Firefox
Defensive patterns

Strategy: type-guard

Validate before calling

is_chromium = driver.caps['browserName'].lower() in ('chrome','edge','chromium')
if not is_chromium:
    raise RuntimeError('execute_cdp_cmd is Chromium-only; use WebDriver BiDi for Firefox')

Type guard

def supports_cdp(driver) -> bool:
    return driver.caps.get('browserName','').lower() in ('chrome','edge','chromium')

Try / catch

if supports_cdp(driver):
    driver.execute_cdp_cmd(cmd, params)
else:
    # use BiDi path

Prevention

When it happens

Trigger: Calling `driver.execute_cdp_cmd(...)` on a Firefox session, or running cross-browser test code that unconditionally uses CDP against a Firefox driver.

Common situations: Porting Chrome-only CDP snippets (Network throttling, emulation, JS coverage) to Firefox; shared test helpers that call execute_cdp_cmd without a browser check; older code that relied on Firefox's experimental CDP.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/5fab418713bd850c. Report an issue: GitHub.