vitest-dev/vitest · error · Error
Method "getByTitle" is not supported by the
Error message
Method "getByTitle" is not supported by the "${provider}" provider. What it means
page.getByTitle is a locator method that requires a full browser provider. The default page stub throws, interpolating the active provider name. Title attribute lookup uses provider selector engines absent from preview.
Solutions
- Configure test.browser.provider to 'playwright' or 'webdriverio'.
- Under preview, use document.querySelector('[title="Close"]').
- Register the method via page.extend for a custom provider.
Example fix
// before
const tip = page.getByTitle('Close')
// after (preview provider)
const tip = document.querySelector('[title="Close"]')! Defensive patterns
Strategy: validation
Validate before calling
if (getBrowserState().provider === 'preview') {
document.querySelector('[title="Close"]')
} else {
page.getByTitle('Close')
} Type guard
function supportsLocators(): boolean {
return ['playwright', 'webdriverio'].includes(getBrowserState().provider ?? '')
} Prevention
- Switch to a full provider when title-based location is needed.
- Map getByTitle to [title="..."] under preview.
- Centralize provider capability checks.
When it happens
Trigger: Calling page.getByTitle('Close') while provider is 'preview' or a custom provider without the method registered.
Common situations: Tooltip/title-based tests migrated from Playwright/RTL; default provider config; missing provider install.
Related errors
- Method "elementLocator" is not supported by the
- Method "frameLocator" is not supported by the
- Method "getByAltText" is not supported by the
- Method "getByLabelText" is not supported by the
- Method "getByPlaceholder" is not supported by the
AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11).
Data as JSON: /api/errors/439c32a2cd083ff5.
Report an issue: GitHub.
Appendix: source
Thrown at packages/browser/src/client/tester/context.ts:458
throw new Error(`Method "getByRole" is not supported by the "${provider}" provider.`)
},
getByLabelText() {
throw new Error(`Method "getByLabelText" is not supported by the "${provider}" provider.`)
},
getByTestId() {
throw new Error(`Method "getByTestId" is not supported by the "${provider}" provider.`)
},
getByAltText() {
throw new Error(`Method "getByAltText" is not supported by the "${provider}" provider.`)
},
getByPlaceholder() {
throw new Error(`Method "getByPlaceholder" is not supported by the "${provider}" provider.`)
},
getByText() {
throw new Error(`Method "getByText" is not supported by the "${provider}" provider.`)
},
getByTitle() {
throw new Error(`Method "getByTitle" is not supported by the "${provider}" provider.`)
},
elementLocator() {
throw new Error(`Method "elementLocator" is not supported by the "${provider}" provider.`)
},
frameLocator() {
throw new Error(`Method "frameLocator" is not supported by the "${provider}" provider.`)
},
extend(methods) {
for (const key in methods) {
(page as any)[key] = (methods as any)[key].bind(page)
}
return page
},
}
function convertToLocator(element: Element | Locator): Locator {
if (element instanceof Element) {
return page.elementLocator(element)View on GitHub (pinned to 1fa9837ec2)