microsoft/playwright · error · Error

Method not implemented.

Error message

Method not implemented.

What it means

The iOS Safari webview backend throws 'Method not implemented.' for context capabilities the WKWebView/ios_webkit_debug_proxy surface does not expose: granting permissions (doGrantPermissions), clearing permissions, geolocation, and several other overrides. These are deliberate capability gaps, not transient failures — calling them signals the test is asking for a feature the backend cannot provide.

Source

Thrown at packages/playwright-core/src/server/webkit/webview/wvBrowser.ts:368

      };
      return cookie;
    });
    await page.setCookies(protocolCookies);
  }

  async doClearCookies() {
    const page = this._cookiePage();
    if (!page)
      return;
    const cookies = await page.getCookies();
    await page.deleteCookies(cookies.map(c => ({
      cookieName: c.name,
      url: `${c.secure ? 'https' : 'http'}://${c.domain.replace(/^\./, '')}${c.path}`,
    })));
  }

  async doGrantPermissions(origin: string, permissions: string[]) {
    throw new Error('Method not implemented.');
  }

  async doClearPermissions() {
    throw new Error('Method not implemented.');
  }

  async setGeolocation(geolocation?: types.Geolocation): Promise<void> {
    throw new Error('Method not implemented.');
  }

  async doUpdateExtraHTTPHeaders(): Promise<void> {
    for (const page of this.pages())
      await (page.delegate as WVPage).updateExtraHTTPHeaders();
  }

  async setUserAgent(userAgent: string | undefined): Promise<void> {
    this._options.userAgent = userAgent;
    for (const page of this.pages())

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Skip or conditionally disable permission/geolocation/offline tests when running against the webview (iOS Safari) backend.
  2. Detect the backend (e.g. browser version/connection type) and branch to an alternative or a skip annotation.
  3. Request the feature upstream if essential; meanwhile avoid the unsupported context methods.

Example fix

// before
test('geoflow', async ({ context }) => {
  await context.setGeolocation({ latitude: 0, longitude: 0 }); // Method not implemented
});

// after
test('geoflow', async ({ context, browserName }) => {
  test.skip(browserName === 'webkit' && isWebView, 'geolocation not supported on iOS webview');
  await context.setGeolocation({ latitude: 0, longitude: 0 });
});
Defensive patterns

Strategy: validation

Validate before calling

const UNSUPPORTED = ['grantPermissions','clearPermissions','setGeolocation','clearCache'];
function isSupportedOnWebView(method) { return !UNSUPPORTED.includes(method); }
if (isSupportedOnWebView('setGeolocation')) await context.setGeolocation(geo);

Try / catch

try { await context.grantPermissions(perms); }
catch (e) {
  if (/Method not implemented/i.test(String(e.message))) {
    console.warn('permissions not supported on this backend — skipping');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling context.grantPermissions(...), context.clearPermissions(), context.setGeolocation(...), context.clearCookies (via doClose/cancelDownload/doSetHTTPCredentials/doUpdateOffline/clearCache) on a webkit.connectOverCDP iOS Safari context.

Common situations: Reusing a cross-browser test suite (built for chromium) that grants permissions or sets geolocation; testing geoflows or notification permissions against iOS Safari.

Related errors


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