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

  1. Set test.browser.provider to 'playwright' or 'webdriverio' and install the package.
  2. Under preview, use document.querySelector('[placeholder="Search"]').
  3. 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

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


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 page

View on GitHub (pinned to 1fa9837ec2)