{"record":{"id":"9b7761dc9151a8ae","repo":"CloakHQ/CloakBrowser","slug":"humanized-selector-selector-is-not-supported-by","errorCode":null,"errorMessage":"Humanized selector ${selector} is not supported by the isolated-world resolver. Supported: CSS, text=, xpath=, getByTestId, getByPlaceholder, getByAltText, getByTitle, getByText, getByLabel, and a trailing .first()/.nth()/.last(). Not supported: getByRole, chained locators (a >> b, .filter(), .and(), .or()), frameLocator, :visible and :nth-match. Use a CSS or text= selector for this action, or humanize:false to fall back to Playwright.","messagePattern":"Humanized selector (.+?) is not supported by the isolated-world resolver\\. Supported: CSS, text=, xpath=, getByTestId, getByPlaceholder, getByAltText, getByTitle, getByText, getByLabel, and a trailing \\.first\\(\\)/\\.nth\\(\\)/\\.last\\(\\)\\. Not supported: getByRole, chained locators \\(a >> b, \\.filter\\(\\), \\.and\\(\\), \\.or\\(\\)\\), frameLocator, :visible and :nth-match\\. Use a CSS or text= selector for this action, or humanize:false to fall back to Playwright\\.","errorType":"exception","errorClass":"UnsupportedHumanizeSelectorError","httpStatus":null,"severity":"error","filePath":"js/src/human/actionability.ts","lineNumber":134,"sourceCode":"  if (status === EVALUATION_FAILED) throw new StealthEvaluationError(selector);\n  if (status === NOT_FOUND) throw new ElementNotAttachedError(selector);\n  if (status !== OK || !data) throw new StealthEvaluationError(selector);\n  if (checks.has('visible') && !data.visible) throw new ElementNotVisibleError(selector);\n  if (checks.has('enabled') && !data.enabled) throw new ElementNotEnabledError(selector);\n  if (checks.has('editable') && !data.editable) throw new ElementNotEditableError(selector);\n}\n\nasync function readBox(\n  pageOrFrame: Page | Frame,\n  selector: string,\n): Promise<{ x: number; y: number; width: number; height: number } | null> {\n  const world = getWorld(pageOrFrame);\n  if (!world) throw new StealthWorldUnavailableError();\n\n  const { status, data } = await evalParsed(world, buildBoxJs(selector));\n  if (status === OK && data?.box) return data.box;\n  if (status === NOT_FOUND) return null;\n  if (status === UNSUPPORTED) throw new UnsupportedHumanizeSelectorError(selector);\n  throw new StealthEvaluationError(selector);\n}\n\nexport async function ensureActionable(\n  pageOrFrame: Page | Frame,\n  selector: string,\n  checks: ReadonlySet<CheckName>,\n  timeout: number = 30000,\n  force: boolean = false,\n): Promise<void> {\n  if (force) return;\n\n  const deadline = Date.now() + timeout;\n  let attempt = 0;\n  let lastError: Error | null = null;\n\n  while (true) {\n    const remainingMs = Math.max(0, deadline - Date.now());","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/CloakHQ/CloakBrowser/blob/d6bad5de261bedf025280ace1d14e800aee13923/js/src/human/actionability.ts#L116-L152","documentation":"readBox's selector resolution reported UNSUPPORTED: the humanized isolated-world resolver only accepts a limited selector grammar (CSS, text=, xpath=, getBy* testid/placeholder/altText/title/text/label with optional trailing .first()/.nth()/.last()). Constructs like getByRole, chained locators (>>, .filter(), .and(), .or()), frameLocator, :visible and :nth-match are rejected.","triggerScenarios":"Passing page.getByRole('button', { name: 'Go' })-style selectors or chained/filtered locator strings to humanized actions (humanClick, humanHover, humanType...) that internally call readBox/stealthActionable.","commonSituations":"Porting existing Playwright tests that lean on getByRole and .filter() — the two most common unsupported constructs — or using :visible pseudo-selectors copied from CSS-based test suites.","solutions":["Replace getByRole with a CSS, text=, or getByTestId selector (e.g. text=\"Sign in\" or [data-testid=\"sign-in\"])","Unwind chained locators: resolve to a single selector targeting the final element directly","Drop :visible / :nth-match — the actionability layer already performs visibility checks and .first()/.nth()/.last() are supported","If the selector cannot be simplified, pass humanize:false so the action uses Playwright's native locator engine"],"exampleFix":"// before\nawait humanClick(page, 'getByRole(\"button\", { name: \"Sign in\" })');\n// after\nawait humanClick(page, 'text=\"Sign in\"');\n// or bypass the isolated world\nawait page.getByRole('button', { name: 'Sign in' }).click();","handlingStrategy":"type-guard","validationCode":"const SUPPORTED = /^(?:[.#]?[\\w-]+|text=|xpath=|getBy(TestId|Placeholder|AltText|Title|Text|Label))/;\nif (!SUPPORTED.test(sel)) { /* use a native locator instead */ }","typeGuard":"function isUnsupportedHumanizeSelectorError(e: unknown): e is UnsupportedHumanizeSelectorError {\n  return e instanceof Error && /not supported by the isolated-world resolver/.test(e.message);\n}","tryCatchPattern":"try { await humanClick(page, sel); } catch (e) { if (isUnsupportedHumanizeSelectorError(e)) await page.locator(sel).click(); else throw e; }","preventionTips":["Standardize on data-testid or text= selectors for humanized actions","Avoid getByRole and locator chaining in humanized paths","Reach for humanize:false when rich locators are required"],"tags":["selector-unsupported","getbyrole","playwright","humanize"],"backgroundTag":"unsupported-selector-syntax","analyzedSha":"d6bad5de261bedf025280ace1d14e800aee13923","analyzedAt":"2026-08-28T14:13:12.918Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}