{"record":{"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/1fa9837ec26533512fdcad8baebf249771bd340a/packages/browser/src/client/tester/context.ts#L425-L461","documentation":"page.getByLabelText is a locator method only provided by full browser-automation providers. The default page object throws this error, interpolating the active provider name, when the method is called without a provider that registers it. Identical in cause to the other locator stubs in the same object.","triggerScenarios":"Calling page.getByLabelText(...) under the preview provider or any custom provider that has not registered a getByLabelText implementation via page.extend().","commonSituations":"Form-testing code copied from Playwright docs into a preview-provider Vitest project; missing provider installation; wrong provider string in config.","solutions":["Configure test.browser.provider to 'playwright' or 'webdriverio' and install the provider package.","Replace with a CSS/attribute query: document.querySelector('[aria-label=\"X\"]') or label-for lookup.","Register the method yourself via page.extend({ getByLabelText }) if building a custom provider."],"exampleFix":"// before\nconst field = page.getByLabelText('Email')\n// after (preview provider)\nconst field = document.querySelector('input[aria-label=\"Email\"]')!","handlingStrategy":"validation","validationCode":"if (getBrowserState().provider === 'preview') {\n  document.querySelector('[aria-label=\"Email\"]')\n} else {\n  page.getByLabelText('Email')\n}","typeGuard":"function supportsLocators(): boolean {\n  return ['playwright', 'webdriverio'].includes(getBrowserState().provider ?? '')\n}","tryCatchPattern":null,"preventionTips":["Use a full provider when locator APIs are required.","Map label-based queries to attribute selectors under preview.","Centralize provider-capability checks in a test helper."],"tags":["browser","locators","provider","preview"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}