{"record":{"id":"ad3838006860c315","repo":"vitest-dev/vitest","slug":"method-framelocator-is-not-supported-by-the-p","errorCode":null,"errorMessage":"Method \"frameLocator\" is not supported by the \"${provider}\" provider.","messagePattern":"Method \"frameLocator\" is not supported by the \"(.+?)\" provider\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser/src/client/tester/context.ts","lineNumber":464,"sourceCode":"    throw new Error(`Method \"getByTestId\" is not supported by the \"${provider}\" provider.`)\n  },\n  getByAltText() {\n    throw new Error(`Method \"getByAltText\" is not supported by the \"${provider}\" provider.`)\n  },\n  getByPlaceholder() {\n    throw new Error(`Method \"getByPlaceholder\" is not supported by the \"${provider}\" provider.`)\n  },\n  getByText() {\n    throw new Error(`Method \"getByText\" is not supported by the \"${provider}\" provider.`)\n  },\n  getByTitle() {\n    throw new Error(`Method \"getByTitle\" is not supported by the \"${provider}\" provider.`)\n  },\n  elementLocator() {\n    throw new Error(`Method \"elementLocator\" is not supported by the \"${provider}\" provider.`)\n  },\n  frameLocator() {\n    throw new Error(`Method \"frameLocator\" is not supported by the \"${provider}\" provider.`)\n  },\n  extend(methods) {\n    for (const key in methods) {\n      (page as any)[key] = (methods as any)[key].bind(page)\n    }\n    return page\n  },\n}\n\nfunction convertToLocator(element: Element | Locator): Locator {\n  if (element instanceof Element) {\n    return page.elementLocator(element)\n  }\n  return element\n}\n\nfunction getTaskFullName(task: RunnerTask): string {\n  return task.suite ? `${getTaskFullName(task.suite)} ${task.name}` : task.name","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/browser/src/client/tester/context.ts#L446-L482","documentation":"page.frameLocator targets nested iframe contexts and requires a full browser provider that understands frame switching. The default page stub throws with the active provider name; preview mode runs inside a single iframe and has no frame-navigation capability, so the call cannot be satisfied.","triggerScenarios":"Calling page.frameLocator('iframe#child') while provider is 'preview'; testing embedded video/ad iframes without a full provider; copying Playwright frame examples into a preview-provider project.","commonSituations":"Tests for embedded widgets/portals; default provider config; missing provider install.","solutions":["Configure test.browser.provider to 'playwright' or 'webdriverio' to get frameLocator support.","Under preview, access the iframe's document directly via document.querySelector('iframe').contentDocument (same-origin only).","Restructure tests to avoid cross-frame interactions under preview."],"exampleFix":"// before\nconst frame = page.frameLocator('iframe#child')\n// after (preview provider, same-origin)\nconst doc = document.querySelector('iframe#child')!.contentDocument!\nconst btn = doc.querySelector('button')!","handlingStrategy":"validation","validationCode":"if (getBrowserState().provider === 'preview') {\n  // same-origin iframe access via contentDocument\n  document.querySelector('iframe')?.contentDocument?.querySelector('button')\n} else {\n  page.frameLocator('iframe').getByRole('button')\n}","typeGuard":"function supportsFrames(): boolean {\n  return ['playwright', 'webdriverio'].includes(getBrowserState().provider ?? '')\n}","tryCatchPattern":null,"preventionTips":["Use a full provider for cross-frame testing.","Restrict preview tests to same-origin iframe access via contentDocument.","Document provider capabilities around iframes."],"tags":["browser","locators","provider","preview","iframe"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}