{"record":{"id":"28aa16b2b813b0d1","repo":"CloakHQ/CloakBrowser","slug":"isolated-world-dom-evaluation-failed-for-selecto-28aa16","errorCode":null,"errorMessage":"Isolated-world DOM evaluation failed for ${selector}","messagePattern":"Isolated-world DOM evaluation failed for (.+?)","errorType":"exception","errorClass":"StealthEvaluationError","httpStatus":null,"severity":"error","filePath":"js/src/human/index.ts","lineNumber":182,"sourceCode":"  y = 0;\n  initialized = false;\n}\n\n\n// ============================================================================\n// Canonical selector snapshot — isolated world only\n// ============================================================================\n\nasync function selectorSnapshot(\n  stealth: StealthEval | null,\n  selector: string,\n): Promise<SnapshotPayload> {\n  if (!stealth) throw new StealthWorldUnavailableError();\n  const { status, data } = await evalParsed(stealth, buildSnapshotJs(selector));\n  if (status === OK && data) return data as SnapshotPayload;\n  if (status === NOT_FOUND) throw new ElementNotAttachedError(selector);\n  if (status === UNSUPPORTED) throw new UnsupportedHumanizeSelectorError(selector);\n  throw new StealthEvaluationError(selector);\n}\n\n\n// ============================================================================\n// Page-level patching\n// ============================================================================\n\n/**\n * Replace page methods with human-like implementations.\n */\nfunction patchPage(page: Page, cfg: HumanConfig, cursor: CursorState): void {\n  const originals = {\n    click: page.click.bind(page),\n    dblclick: page.dblclick.bind(page),\n    hover: page.hover.bind(page),\n    type: page.type.bind(page),\n    fill: page.fill.bind(page),\n    check: page.check.bind(page),","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/CloakHQ/CloakBrowser/blob/d6bad5de261bedf025280ace1d14e800aee13923/js/src/human/index.ts#L164-L200","documentation":"selectorSnapshot evaluated the humanized selector's snapshot script inside the isolated (stealth) world, but the evaluation returned a status that is neither OK, NOT_FOUND, nor UNSUPPORTED — i.e. the injected JS threw or returned an unexpected protocol result. This is a catch-all for infrastructure failure of the in-page evaluation rather than a selector-syntax or element problem.","triggerScenarios":"evalParsed(stealth, buildSnapshotJs(selector)) returns an unexpected status (page navigating during evaluation, execution context destroyed, the world's CDP session dropped, or the snapshot script throwing for an unanticipated reason).","commonSituations":"Page navigation or reload racing the humanized action; browser/context closed mid-call; an extension or CSP interfering with injected script evaluation; version mismatch between the injected bundle and the library after a partial upgrade.","solutions":["Retry the action after awaiting a stable state (e.g. await page.waitForLoadState('load') or a waitForSelector on the element).","Verify the page hasn't navigated — wrap actions in expect-style polling or page.waitForURL before calling humanized APIs.","Check that the browser/context wasn't closed and that no other code is calling page.evaluate concurrently on the same world.","If it reproduces deterministically on one selector, capture the page console/CDP errors to identify why the snapshot script threw, and report it with the selector."],"exampleFix":"// before\nawait humanPress(page, 'text=Sign in', 'Enter'); // throws StealthEvaluationError mid-navigation\n\n// after\nawait page.waitForLoadState('domcontentloaded');\nawait page.locator('text=Sign in').first().waitFor();\nawait humanPress(page, 'text=Sign in', 'Enter');","handlingStrategy":"retry","validationCode":"await page.waitForLoadState('domcontentloaded');\nawait page.locator(selector).first().waitFor({ state: 'attached' });","typeGuard":"null","tryCatchPattern":"let lastErr: unknown;\nfor (let i = 0; i < 2; i++) {\n  try { return await humanPress(page, selector, 'Enter'); }\n  catch (e) {\n    lastErr = e;\n    if (!(e instanceof StealthEvaluationError)) throw e;\n    await page.waitForLoadState('load').catch(() => {});\n  }\n}\nthrow lastErr;","preventionTips":["Avoid humanized actions during known navigation windows (form submits, redirects).","Wait for a stable load state and element presence before acting.","Log selector + page.url() when this fires to spot navigation races."],"tags":["playwright","isolated-world","evaluation","cdp","race-condition"],"backgroundTag":"page-evaluation-failed","analyzedSha":"d6bad5de261bedf025280ace1d14e800aee13923","analyzedAt":"2026-08-28T14:13:12.918Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}