{"record":{"id":"657098d242dcce0b","repo":"microsoft/playwright","slug":"empty-by-locator-start-with-one-of-by-role-b","errorCode":null,"errorMessage":"Empty \"by\" locator. Start with one of by.role(), by.text(), by.testId() and friends.","messagePattern":"Empty \"by\" locator\\. Start with one of by\\.role\\(\\), by\\.text\\(\\), by\\.testId\\(\\) and friends\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/isomorphic/by.ts","lineNumber":143,"sourceCode":"    return this._append(name => getByTestIdSelector(name, testId));\n  }\n\n  text(text: string | RegExp, options?: { exact?: boolean }): By {\n    return this._append(() => getByTextSelector(text, options));\n  }\n\n  title(text: string | RegExp, options?: { exact?: boolean }): By {\n    return this._append(() => getByTitleSelector(text, options));\n  }\n}\n\nexport const by: By = new ByImpl(() => '');\n\n// The test id attribute is only known once the By is bound to a page, hence the deferred build.\nexport function resolveBy(by: By, testIdAttributeName: string): string {\n  const selector = (by as ByImpl)._build(testIdAttributeName);\n  if (!selector)\n    throw new Error(`Empty \"by\" locator. Start with one of by.role(), by.text(), by.testId() and friends.`);\n  return selector;\n}\n","sourceCodeStart":125,"sourceCodeEnd":146,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/isomorphic/by.ts#L125-L146","documentation":"Error \"Empty \"by\" locator. Start with one of by.role(), by.text(), by.testId() and friends.\" thrown in microsoft/playwright.","triggerScenarios":"Thrown at packages/isomorphic/by.ts:143 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}