vitest-dev/vitest · error · Error

Method "getByTitle" is not supported by the "${provider}" pr

Error message

Method "getByTitle" is not supported by the "${provider}" provider.

What it means

page.getByTitle is a throwing stub (packages/browser/src/client/tester/context.ts:457-458). Title queries are only on Locator instances (getElementLocatorSelectors wires locator.getByTitle at context.ts:520). The page-level call throws.

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 d568f8ce37)

Solutions

  1. Use a Locator: page.elementLocator(document.body).getByTitle('Save document').
  2. Register page.getByTitle via browser.locators.extend(...) if a top-level shortcut is needed.

Example fix

// before
const el = page.getByTitle('Save')
// after
const el = page.elementLocator(document.body).getByTitle('Save')
Defensive patterns

Strategy: type-guard

Validate before calling

const root = page.elementLocator(document.body)
const el = root.getByTitle('Save document')

Prevention

When it happens

Trigger: Calling page.getByTitle('Save document') directly on the page object.

Common situations: Tooltip/aria-title tests; expecting Playwright-style page.getByTitle.

Related errors


AI-assisted analysis of vitest-dev/vitest@d568f8ce37 (2026-08-03). Data as JSON: /data/errors/439c32a2cd083ff5.json. Report an issue: GitHub.