{"record":{"id":"4f6e6adea9421896","repo":"microsoft/playwright","slug":"not-supported","errorCode":null,"errorMessage":"Not supported","messagePattern":"Not supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/webkit/webview/wvBrowser.ts","lineNumber":271,"sourceCode":"    entry.connection.close();\n    entry.page.didClose();\n  }\n\n  async _closeAllTabs(): Promise<void> {\n    for (const pageId of Array.from(this._tabs.keys()))\n      this._detachTab(pageId);\n    this._fireDidCloseOnce();\n  }\n\n  private _fireDidCloseOnce(): void {\n    if (this._didCloseFired)\n      return;\n    this._didCloseFired = true;\n    this.didClose();\n  }\n\n  async doCreateNewContext(options: types.BrowserContextOptions): Promise<BrowserContext> {\n    throw new Error('Not supported');\n  }\n\n  contexts(): BrowserContext[] {\n    return [this._context];\n  }\n\n  version(): string {\n    return '';\n  }\n\n  userAgent(): string {\n    return '';\n  }\n\n  isConnected(): boolean {\n    return this._tabs.size > 0;\n  }\n}","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/webkit/webview/wvBrowser.ts#L253-L289","documentation":"WVBrowser (the iOS Safari / WKWebView connection via ios_webkit_debug_proxy) exposes a single pre-existing browser context tied to the live Safari process. It cannot manufacture a fresh context because the underlying device only exposes whatever Safari is running. doCreateNewContext therefore unconditionally throws 'Not supported'.","triggerScenarios":"Calling browser.newContext() (or any path that triggers doCreateNewContext) on a browser obtained from webkit.connectOverCDP against a real iOS Safari session. The webview backend has exactly one context.","commonSituations":"Treating a connectOverCDP webview browser like a launched browser and trying to spin isolated contexts; test code reused from a chromium launch flow that calls newContext per test.","solutions":["Use browser.contexts()[0] (the existing WVBrowserContext) instead of browser.newContext().","If you need isolation, disconnect and reconnect rather than creating a context.","Restructure tests so each test does not call newContext on a webview browser."],"exampleFix":"// before\nconst browser = await webkit.connectOverCDP(endpoint);\nconst context = await browser.newContext(); // Not supported\n\n// after\nconst browser = await webkit.connectOverCDP(endpoint);\nconst context = browser.contexts()[0];","handlingStrategy":"validation","validationCode":"function useExistingContext(browser) {\n  const contexts = browser.contexts();\n  if (!contexts.length) throw new Error('No context attached to webview browser');\n  return contexts[0];\n}\nconst context = useExistingContext(browser); // instead of browser.newContext()","typeGuard":null,"tryCatchPattern":"let context;\ntry { context = await browser.newContext(); }\ncatch (e) {\n  if (/Not supported/i.test(String(e.message))) context = browser.contexts()[0];\n  else throw e;\n}","preventionTips":["Never call browser.newContext() on a connectOverCDP webview browser.","Reuse browser.contexts()[0].","Disconnect/reconnect for isolation rather than creating contexts."],"tags":["webview","ios","safari","capability","not-supported"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}