microsoft/playwright · error · Error

Connecting to SELENIUM_REMOTE_URL is only supported by Chrom

Error message

Connecting to SELENIUM_REMOTE_URL is only supported by Chromium

What it means

launchWithSeleniumHub is overridden only by Chromium; the base BrowserType implementation throws this error. Pointing Firefox or WebKit at a Selenium Hub (SELENIUM_REMOTE_URL) is not supported.

Source

Thrown at packages/playwright-core/src/server/browserType.ts:296

        transport = new PipeTransport(stdio[3], stdio[4]);
      }
      return { browserProcess, artifactsDir: prepared.artifactsDir, userDataDir: prepared.userDataDir, transport, wsEndpoint };
    } catch (error) {
      await progress.race(closeOrKill(DEFAULT_PLAYWRIGHT_TIMEOUT).catch(() => {}));
      throw error;
    }
  }

  async connectOverCDP(progress: Progress, params: channels.BrowserTypeConnectOverCDPParams): Promise<Browser> {
    throw new Error('CDP connections are only supported by Chromium');
  }

  async connectToWorker(progress: Progress, endpoint: string): Promise<Worker> {
    throw new Error('CDP connections are only supported by Chromium');
  }

  async launchWithSeleniumHub(progress: Progress, hubUrl: string, options: types.LaunchOptions): Promise<Browser> {
    throw new Error('Connecting to SELENIUM_REMOTE_URL is only supported by Chromium');
  }

  private _validateLaunchOptions(options: types.LaunchOptions): types.LaunchOptions {
    let { headless = true, downloadsPath, proxy } = options;
    if (debugMode() === 'inspector')
      headless = false;
    if (downloadsPath && !path.isAbsolute(downloadsPath))
      downloadsPath = path.join(process.cwd(), downloadsPath);
    if (options.socksProxyPort)
      proxy = { server: `socks5://127.0.0.1:${options.socksProxyPort}` };
    return { ...options, headless, downloadsPath, proxy };
  }

  protected _createUserDataDirArgMisuseError(userDataDirArg: string): Error {
    switch (this.attribution.playwright.options.sdkLanguage) {
      case 'java':
        return new Error(`Pass userDataDir parameter to 'BrowserType.launchPersistentContext(userDataDir, options)' instead of specifying '${userDataDirArg}' argument`);
      case 'python':

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Use chromium when SELENIUM_REMOTE_URL is set, since Selenium bridging is Chromium-only in Playwright.
  2. Unset SELENIUM_REMOTE_URL and launch the browser locally, or connect via a Playwright WebSocket server endpoint for non-Chromium.
  3. For Firefox/WebKit on a remote grid, use a grid that speaks the Playwright protocol, not Selenium.

Example fix

// before: SELENIUM_REMOTE_URL set, then
await firefox.launch();
// after
await chromium.launch(); // or unset SELENIUM_REMOTE_URL
Defensive patterns

Strategy: validation

Validate before calling

function assertSeleniumCompatible(browserType: { name: string }) {
  if (process.env.SELENIUM_REMOTE_URL && browserType.name !== 'chromium')
    throw new Error('SELENIUM_REMOTE_URL is set but only chromium is supported');
}

Type guard

function seleniumSupportedBrowser(bt: any): boolean {
  return !process.env.SELENIUM_REMOTE_URL || bt?.name === 'chromium';
}

Prevention

When it happens

Trigger: Setting SELENIUM_REMOTE_URL and calling firefox.launch() / webkit.launch() (the launch path routes to launchWithSeleniumHub, which is the throwing stub for those types).

Common situations: CI grid that only speaks WebDriver/Selenium but the test config selected firefox/webkit while expecting Selenium bridging. Copying a Chromium Selenium setup to another browser family.

Related errors


AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12). Data as JSON: /api/errors/175dd14cfe786d2d. Report an issue: GitHub.