{"record":{"id":"650747d3ba535c5e","repo":"microsoft/playwright","slug":"inner-has-locator-must-belong-to-the-same-frame","errorCode":null,"errorMessage":"Inner \"has\" locator must belong to the same frame.","messagePattern":"Inner \"has\" locator must belong to the same frame\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/client/locator.ts","lineNumber":67,"sourceCode":"export class Locator implements api.Locator {\n  _frame: Frame;\n  _selector: string;\n  _apiName = 'Locator';\n\n  constructor(frame: Frame, selector: string, options?: LocatorOptions) {\n    this._frame = frame;\n    this._selector = selector;\n\n    if (options?.hasText)\n      this._selector += ` >> internal:has-text=${escapeForTextSelector(options.hasText, false)}`;\n\n    if (options?.hasNotText)\n      this._selector += ` >> internal:has-not-text=${escapeForTextSelector(options.hasNotText, false)}`;\n\n    if (options?.has) {\n      const locator = options.has;\n      if (locator._frame !== frame)\n        throw new Error(`Inner \"has\" locator must belong to the same frame.`);\n      this._selector += ` >> internal:has=` + JSON.stringify(locator._selector);\n    }\n\n    if (options?.hasNot) {\n      const locator = options.hasNot;\n      if (locator._frame !== frame)\n        throw new Error(`Inner \"hasNot\" locator must belong to the same frame.`);\n      this._selector += ` >> internal:has-not=` + JSON.stringify(locator._selector);\n    }\n\n    if (options?.visible !== undefined)\n      this._selector += ` >> visible=${options.visible ? 'true' : 'false'}`;\n\n    if (inspect.custom)\n      (this as any)[inspect.custom] = () => this._inspect();\n  }\n\n  private async _withElement<R>(task: (handle: ElementHandle<SVGElement | HTMLElement>, timeout?: number) => Promise<R>, options: { title: string, internal?: boolean, timeout?: number, signal?: AbortSignal }): Promise<R> {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/client/locator.ts#L49-L85","documentation":"Error \"Inner \"has\" locator must belong to the same frame.\" thrown in microsoft/playwright.","triggerScenarios":"Thrown at packages/playwright-core/src/client/locator.ts:67 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-12T13:17:24.610Z"}