{"id":"f0898dda2be149c3","repo":"vitest-dev/vitest","slug":"method-getbytext-is-not-supported-by-the-prov","errorCode":null,"errorMessage":"Method \"getByText\" is not supported by the \"${provider}\" provider.","messagePattern":"Method \"getByText\" is not supported by the \"(.+?)\" provider\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser/src/client/tester/context.ts","lineNumber":455,"sourceCode":"    })\n  },\n  getByRole() {\n    throw new Error(`Method \"getByRole\" is not supported by the \"${provider}\" provider.`)\n  },\n  getByLabelText() {\n    throw new Error(`Method \"getByLabelText\" is not supported by the \"${provider}\" provider.`)\n  },\n  getByTestId() {\n    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","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/browser/src/client/tester/context.ts#L437-L473","documentation":"page.getByText is a throwing stub (packages/browser/src/client/tester/context.ts:454-455). Text-content queries are available only on Locator instances (getElementLocatorSelectors wires locator.getByText at context.ts:519). The page-level call throws.","triggerScenarios":"Calling page.getByText('Welcome') directly on the page object.","commonSituations":"The most common porting mistake: testing-library getByText and Playwright page.getByText both exist, so users expect it on Vitest's page.","solutions":["Use a Locator: page.elementLocator(document.body).getByText('Welcome').","Register page.getByText via browser.locators.extend(...) for a top-level shortcut."],"exampleFix":"// before\nconst heading = page.getByText('Welcome back')\n// after\nconst heading = page.elementLocator(document.body).getByText('Welcome back')","handlingStrategy":"type-guard","validationCode":"const root = page.elementLocator(document.body)\nconst heading = root.getByText('Welcome')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to page.elementLocator(document.body).getByText; never call page.getByText.","Register an extension if migrating a large testing-library codebase that uses top-level getByText."],"tags":["browser","locators","getbytext","page","unsupported"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}