vitest-dev/vitest · error · Error
Method "getByPlaceholder" is not supported by the
Error message
Method "getByPlaceholder" is not supported by the "${provider}" provider. What it means
page.getByPlaceholder is a locator method implemented only by full providers. The default page stub throws with the active provider name. Placeholder-based location requires a provider selector engine; preview falls back to manual DOM queries.
Solutions
- Set test.browser.provider to 'playwright' or 'webdriverio' and install the package.
- Under preview, use document.querySelector('[placeholder="Search"]').
- Register the method via page.extend in a custom provider.
Example fix
// before
const q = page.getByPlaceholder('Search')
// after (preview provider)
const q = document.querySelector('input[placeholder="Search"]')! Defensive patterns
Strategy: validation
Validate before calling
if (getBrowserState().provider === 'preview') {
document.querySelector('[placeholder="Search"]')
} else {
page.getByPlaceholder('Search')
} Type guard
function supportsLocators(): boolean {
return ['playwright', 'webdriverio'].includes(getBrowserState().provider ?? '')
} Prevention
- Configure a full provider for placeholder-based location.
- Use [placeholder="..."] selectors under preview.
- Wrap provider-specific queries in a helper.
When it happens
Trigger: Calling page.getByPlaceholder('Search') while provider is 'preview' or a custom provider lacking the method.
Common situations: Form validation tests ported 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 "getByRole" is not supported by the
AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11).
Data as JSON: /api/errors/12e5a73c6036e5ca.
Report an issue: GitHub.
Appendix: source
Thrown at packages/browser/src/client/tester/context.ts:452
}],
error,
)
})
},
getByRole() {
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 pageView on GitHub (pinned to 1fa9837ec2)