CloakHQ/CloakBrowser · error · StealthEvaluationError

Isolated-world DOM evaluation failed for ${selector}

Error message

Isolated-world DOM evaluation failed for ${selector}

What it means

Thrown by stealthActionable when the isolated-world evaluation of the actionability probe returns EVALUATION_FAILED (or an unexpected status/missing data). It means the injected script ran but the DOM read itself errored, so the library cannot vouch for the element's state.

Source

Thrown at js/src/human/actionability.ts:116

  const idx = Math.min(attempt, BACKOFF_MS.length - 1);
  return new Promise(resolve => setTimeout(resolve, BACKOFF_MS[idx]));
}

// ---------------------------------------------------------------------------
// Pre-scroll actionability
// ---------------------------------------------------------------------------

async function stealthActionable(
  pageOrFrame: Page | Frame,
  selector: string,
  checks: ReadonlySet<CheckName>,
): Promise<void> {
  const world = getWorld(pageOrFrame);
  if (!world) throw new StealthWorldUnavailableError();

  const { status, data } = await evalParsed(world, buildActionableJs(selector));
  if (status === UNSUPPORTED) throw new UnsupportedHumanizeSelectorError(selector);
  if (status === EVALUATION_FAILED) throw new StealthEvaluationError(selector);
  if (status === NOT_FOUND) throw new ElementNotAttachedError(selector);
  if (status !== OK || !data) throw new StealthEvaluationError(selector);
  if (checks.has('visible') && !data.visible) throw new ElementNotVisibleError(selector);
  if (checks.has('enabled') && !data.enabled) throw new ElementNotEnabledError(selector);
  if (checks.has('editable') && !data.editable) throw new ElementNotEditableError(selector);
}

async function readBox(
  pageOrFrame: Page | Frame,
  selector: string,
): Promise<{ x: number; y: number; width: number; height: number } | null> {
  const world = getWorld(pageOrFrame);
  if (!world) throw new StealthWorldUnavailableError();

  const { status, data } = await evalParsed(world, buildBoxJs(selector));
  if (status === OK && data?.box) return data.box;
  if (status === NOT_FOUND) return null;
  if (status === UNSUPPORTED) throw new UnsupportedHumanizeSelectorError(selector);

View on GitHub (pinned to d6bad5de26)

Solutions

  1. Retry the action — transient navigation/DOM races often clear on the next attempt
  2. Verify the page is not navigating while the action runs (await waitForLoadState or a stable selector)
  3. If it reproduces deterministically, test the same selector in the page console; if Playwright's native locator works, pass humanize:false to bypass the isolated-world probe
  4. Check for iframe/frame confusion — ensure you pass the correct Page or Frame to the humanized API

Example fix

// before
await humanClick(page, '#submit');
// after
await page.waitForLoadState('networkidle');
await humanClick(page, '#submit', { humanize: false }); // fallback if world is flaky
Defensive patterns

Strategy: retry

Validate before calling

await page.waitForLoadState('domcontentloaded'); // avoid evaluating mid-navigation

Type guard

function isStealthEvaluationError(e: unknown): e is StealthEvaluationError {
  return e instanceof Error && /Isolated-world DOM evaluation failed/.test(e.message);
}

Try / catch

try { await humanClick(page, sel); } catch (e) { if (isStealthEvaluationError(e)) { await page.waitForTimeout(250); await humanClick(page, sel); } else throw e; }

Prevention

When it happens

Trigger: Calling ensureActionable (directly or via humanClick/humanType/humanFill etc.) when evalParsed(world, buildActionableJs(selector)) returns status === EVALUATION_FAILED, or status !== OK, or data is falsy after the OK check.

Common situations: Page navigating or context destroyed mid-evaluation, SPA tearing down DOM while the probe runs, JS exceptions inside the isolated world (e.g. CSP or extension interference), or a corrupted/stale isolated world after a frame detach.

Related errors


AI-assisted analysis of CloakHQ/CloakBrowser@d6bad5de26 (2026-08-28). Data as JSON: /api/errors/8f4e6a0383591787. Report an issue: GitHub.