{"id":"c359b485f110b8b8","repo":"vitest-dev/vitest","slug":"method-getbylabeltext-is-not-supported-by-the","errorCode":null,"errorMessage":"Method \"getByLabelText\" is not supported by the \"${provider}\" provider.","messagePattern":"Method \"getByLabelText\" is not supported by the \"(.+?)\" provider\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser/src/client/tester/context.ts","lineNumber":443,"sourceCode":"      }\n      if (!hasActiveTrace) {\n        return Promise.resolve()\n      }\n      return triggerCommand(\n        '__vitest_markTrace',\n        [{\n          name,\n          stack: bodyOrOptions?.stack ?? error?.stack,\n        }],\n        error,\n      )\n    })\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.`)","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/browser/src/client/tester/context.ts#L425-L461","documentation":"page.getByLabelText is a throwing stub (packages/browser/src/client/tester/context.ts:442-443). The page-level label query is not implemented by default; label-text queries live on Locator instances (getElementLocatorSelectors wires locator.getByLabelText at context.ts:515). Calling it directly on page throws with the active provider name.","triggerScenarios":"Calling page.getByLabelText('Email') on the page object without registering an extension or going through a Locator.","commonSituations":"Porting @testing-library/react getByLabelText usage into Vitest Browser; assuming page mirrors Playwright/WebdriverIO page APIs.","solutions":["Resolve via a Locator: page.elementLocator(document.body).getByLabelText('Email').","Register an extension: browser.locators.extend({ getByLabelText: (text, opts) => page.elementLocator(document.body).locator(getByLabelSelector(text, opts)) }).","Use vitest/browser's locator helpers (getByLabelSelector from ivya) to build the selector."],"exampleFix":"// before\nconst input = page.getByLabelText('Email')\n// after\nconst input = page.elementLocator(document.body).getByLabelText('Email')","handlingStrategy":"type-guard","validationCode":"const root = page.elementLocator(document.body)\nconst input = root.getByLabelText('Email')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always resolve label queries via a Locator.","Register a page-level extension if your test style requires getByLabelText on page."],"tags":["browser","locators","getbylabeltext","page","unsupported"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}