{"record":{"id":"f0ecc953e5d6b6e4","repo":"SeleniumHQ/selenium","slug":"cdp-support-for-firefox-is-removed-please-switch","errorCode":null,"errorMessage":"CDP support for Firefox is removed. Please switch to WebDriver BiDi.","messagePattern":"CDP support for Firefox is removed\\. Please switch to WebDriver BiDi\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"javascript/selenium-webdriver/lib/webdriver.js","lineNumber":1258,"sourceCode":"    let resultObj\n\n    let self = this\n    resultObj = self.validatePrintPageParams(keys, params)\n\n    return this.execute(new command.Command(command.Name.PRINT_PAGE).setParameters(resultObj))\n  }\n\n  /**\n   * Creates a new WebSocket connection.\n   * @return {!Promise<resolved>} A new CDP instance.\n   */\n  async createCDPConnection(target) {\n    let debuggerUrl\n\n    const caps = await this.getCapabilities()\n\n    if (caps['map_'].get('browserName') === 'firefox') {\n      throw new Error('CDP support for Firefox is removed. Please switch to WebDriver BiDi.')\n    }\n\n    if (process.env.SELENIUM_REMOTE_URL) {\n      const host = new URL(process.env.SELENIUM_REMOTE_URL).host\n      const sessionId = await this.getSession().then((session) => session.getId())\n      debuggerUrl = `ws://${host}/session/${sessionId}/se/cdp`\n    } else {\n      const seCdp = caps['map_'].get('se:cdp')\n      const vendorInfo = caps['map_'].get('goog:chromeOptions') || caps['map_'].get('ms:edgeOptions') || new Map()\n      debuggerUrl = seCdp || vendorInfo['debuggerAddress'] || vendorInfo\n    }\n    this._wsUrl = await this.getWsUrl(debuggerUrl, target, caps)\n    return new Promise((resolve, reject) => {\n      try {\n        this._cdpWsConnection = new WebSocket(this._wsUrl.replace('localhost', '127.0.0.1'))\n        this._cdpConnection = new cdp.CdpConnection(this._cdpWsConnection)\n      } catch (err) {\n        reject(err)","sourceCodeStart":1240,"sourceCodeEnd":1276,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/javascript/selenium-webdriver/lib/webdriver.js#L1240-L1276","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["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).","If you need CDP specifically, run the same test against Chrome or Edge where CDP remains supported.","Audit your codebase for all createCDPConnection calls and conditionalize them on browserName to avoid calling CDP on Firefox sessions.","Consult the Selenium migration guide for mapping each CDP domain method to its BiDi equivalent."],"exampleFix":"// before\nconst cdp = await driver.createCDPConnection('tab')\nawait cdp.execute('Network.enable', {})\n\n// after (WebDriver BiDi, works on Firefox)\nawait driver.bidi.network.start()\ndriver.bidi.network.add_request_handler(\n  ['*'],\n  callback\n)","handlingStrategy":"validation","validationCode":"const caps = await driver.getCapabilities()\nif (caps.get('browserName') !== 'firefox') {\n  const cdp = await driver.createCDPConnection('tab')\n} else {\n  // use BiDi instead\n}","typeGuard":null,"tryCatchPattern":"try {\n  const cdp = await driver.createCDPConnection('tab')\n} catch (e) {\n  if (/CDP support for Firefox is removed/.test(e.message)) {\n    // fall back to WebDriver BiDi APIs\n  } else throw e\n}","preventionTips":["Check browserName before calling CDP APIs in cross-browser tests.","Standardize on WebDriver BiDi for cross-browser network/script features.","Conditionally branch CDP vs BiDi code by browser to avoid this hard stop."],"tags":["javascript","cdp","firefox","bidi","deprecated-cdp","webdriver"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}