SeleniumHQ/selenium · error · Error

CDP support for Firefox is removed. Please switch to WebDriv

Error message

CDP support for Firefox is removed. Please switch to WebDriver BiDi.

What it means

Thrown as a generic Error by WebDriver.createCDPConnection() when the active session's browserName capability equals 'firefox'. Selenium has permanently removed Chrome DevTools Protocol (CDP) support for Firefox; the message directs users to WebDriver BiDi instead. The check reads caps['map_'].get('browserName') and hard-stops before any CDP WebSocket connection is attempted.

Source

Thrown at javascript/selenium-webdriver/lib/webdriver.js:1258

    let resultObj

    let self = this
    resultObj = self.validatePrintPageParams(keys, params)

    return this.execute(new command.Command(command.Name.PRINT_PAGE).setParameters(resultObj))
  }

  /**
   * Creates a new WebSocket connection.
   * @return {!Promise<resolved>} A new CDP instance.
   */
  async createCDPConnection(target) {
    let debuggerUrl

    const caps = await this.getCapabilities()

    if (caps['map_'].get('browserName') === 'firefox') {
      throw new Error('CDP support for Firefox is removed. Please switch to WebDriver BiDi.')
    }

    if (process.env.SELENIUM_REMOTE_URL) {
      const host = new URL(process.env.SELENIUM_REMOTE_URL).host
      const sessionId = await this.getSession().then((session) => session.getId())
      debuggerUrl = `ws://${host}/session/${sessionId}/se/cdp`
    } else {
      const seCdp = caps['map_'].get('se:cdp')
      const vendorInfo = caps['map_'].get('goog:chromeOptions') || caps['map_'].get('ms:edgeOptions') || new Map()
      debuggerUrl = seCdp || vendorInfo['debuggerAddress'] || vendorInfo
    }
    this._wsUrl = await this.getWsUrl(debuggerUrl, target, caps)
    return new Promise((resolve, reject) => {
      try {
        this._cdpWsConnection = new WebSocket(this._wsUrl.replace('localhost', '127.0.0.1'))
        this._cdpConnection = new cdp.CdpConnection(this._cdpWsConnection)
      } catch (err) {
        reject(err)

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Replace createCDPConnection() and all CDP calls with the equivalent WebDriver BiDi APIs (e.g. driver.bidi.network for network interception, driver.bidi.script for script evaluation).
  2. If you need CDP specifically, run the same test against Chrome or Edge where CDP remains supported.
  3. Audit your codebase for all createCDPConnection calls and conditionalize them on browserName to avoid calling CDP on Firefox sessions.
  4. Consult the Selenium migration guide for mapping each CDP domain method to its BiDi equivalent.

Example fix

// before
const cdp = await driver.createCDPConnection('tab')
await cdp.execute('Network.enable', {})

// after (WebDriver BiDi, works on Firefox)
await driver.bidi.network.start()
driver.bidi.network.add_request_handler(
  ['*'],
  callback
)
Defensive patterns

Strategy: validation

Validate before calling

const caps = await driver.getCapabilities()
if (caps.get('browserName') !== 'firefox') {
  const cdp = await driver.createCDPConnection('tab')
} else {
  // use BiDi instead
}

Try / catch

try {
  const cdp = await driver.createCDPConnection('tab')
} catch (e) {
  if (/CDP support for Firefox is removed/.test(e.message)) {
    // fall back to WebDriver BiDi APIs
  } else throw e
}

Prevention

When it happens

Trigger: Calling driver.createCDPConnection('tab') or any CDP-based API on a Firefox WebDriver session. The capability map is fetched, browserName is checked, and if it is 'firefox' the Error is thrown immediately.

Common situations: Migrating a test suite from Chrome to Firefox while still using CDP-based APIs (e.g. for network interception, performance logs, or page instrumentation); copy-pasting Chrome-oriented CDP code into a cross-browser test; upgrading to a Selenium version where Firefox CDP was removed (previously experimental, now hard-rejected).

Related errors


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