microsoft/playwright · error · Error

--mobile is not supported with the Firefox browser.

Error message

--mobile is not supported with the Firefox browser.

What it means

Thrown by configFromCLIOptions() when --mobile is set and the resolved browser is Firefox. The --mobile shorthand maps to a chromium/webkit device preset, and Firefox lacks equivalent mobile device descriptors in Playwright, so the combination is unsupported by design.

Source

Thrown at packages/playwright-core/src/tools/mcp/config.ts:311

  // Launch options
  const launchOptions: playwrightTypes.LaunchOptions = {
    channel,
    executablePath: cliOptions.executablePath,
    headless: cliOptions.headless,
  };

  // --sandbox was passed, enable the sandbox
  // --no-sandbox was passed, disable the sandbox
  if (cliOptions.sandbox !== undefined)
    launchOptions.chromiumSandbox = cliOptions.sandbox;

  let device = cliOptions.device;
  if (cliOptions.mobile) {
    if (device)
      throw new Error('Cannot use --mobile together with --device, pick one.');
    if (browserName === 'firefox')
      throw new Error('--mobile is not supported with the Firefox browser.');
    device = browserName === 'webkit' ? 'iPhone 17' : 'Pixel 10';
  }

  if (device && cliOptions.cdpEndpoint)
    throw new Error('Device emulation is not supported with cdpEndpoint.');

  // Context options
  const contextOptions: playwrightTypes.BrowserContextOptions = device ? playwright.devices[device] : {};

  if (cliOptions.proxyServer) {
    const proxy: playwrightTypes.LaunchOptions['proxy'] = { server: cliOptions.proxyServer };
    if (cliOptions.proxyBypass)
      proxy.bypass = cliOptions.proxyBypass;
    // Set on both to ensure CLI takes precedence over any proxy set in the config file
    // (launchOptions.proxy applies at browser launch, contextOptions.proxy at context creation).
    launchOptions.proxy = proxy;
    contextOptions.proxy = proxy;
  }

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Switch the browser to chromium or webkit if you need mobile emulation, e.g. `--browser chromium --mobile`.
  2. If you must use Firefox, drop --mobile and pass equivalent context options manually (userAgent, viewport, isMobile, etc.).
  3. Audit the config file and PLAYWRIGHT_MCP_BROWSER env var to ensure firefox is not being set implicitly.

Example fix

// before
playwright mcp --browser firefox --mobile
// after
playwright mcp --browser chromium --mobile
Defensive patterns

Strategy: validation

Validate before calling

if (cliOptions.mobile && browserName === 'firefox') {
  throw new Error('--mobile is unsupported on Firefox; use chromium or webkit.');
}

Type guard

function mobileSupportedFor(browserName?: string): boolean {
  return browserName === 'chromium' || browserName === 'webkit';
}

Prevention

When it happens

Trigger: Running `playwright mcp --browser firefox --mobile`, or setting both the browser to firefox (via --browser, PLAYWRIGHT_MCP_BROWSER, or config) and --mobile.

Common situations: Defaulting to firefox in a config file then adding --mobile on the command line; assuming --mobile works uniformly across browsers; CI matrix that reuses the same flags for every browser.

Related errors


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