CloakHQ/CloakBrowser · error · StealthEvaluationError
Isolated-world DOM evaluation failed for ${selector}
Error message
Isolated-world DOM evaluation failed for ${selector} What it means
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.
Source
Thrown at js/src/human/index.ts:182
y = 0;
initialized = false;
}
// ============================================================================
// Canonical selector snapshot — isolated world only
// ============================================================================
async function selectorSnapshot(
stealth: StealthEval | null,
selector: string,
): Promise<SnapshotPayload> {
if (!stealth) throw new StealthWorldUnavailableError();
const { status, data } = await evalParsed(stealth, buildSnapshotJs(selector));
if (status === OK && data) return data as SnapshotPayload;
if (status === NOT_FOUND) throw new ElementNotAttachedError(selector);
if (status === UNSUPPORTED) throw new UnsupportedHumanizeSelectorError(selector);
throw new StealthEvaluationError(selector);
}
// ============================================================================
// Page-level patching
// ============================================================================
/**
* Replace page methods with human-like implementations.
*/
function patchPage(page: Page, cfg: HumanConfig, cursor: CursorState): void {
const originals = {
click: page.click.bind(page),
dblclick: page.dblclick.bind(page),
hover: page.hover.bind(page),
type: page.type.bind(page),
fill: page.fill.bind(page),
check: page.check.bind(page),View on GitHub (pinned to d6bad5de26)
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.
Example fix
// before
await humanPress(page, 'text=Sign in', 'Enter'); // throws StealthEvaluationError mid-navigation
// after
await page.waitForLoadState('domcontentloaded');
await page.locator('text=Sign in').first().waitFor();
await humanPress(page, 'text=Sign in', 'Enter'); Defensive patterns
Strategy: retry
Validate before calling
await page.waitForLoadState('domcontentloaded');
await page.locator(selector).first().waitFor({ state: 'attached' }); Type guard
null
Try / catch
let lastErr: unknown;
for (let i = 0; i < 2; i++) {
try { return await humanPress(page, selector, 'Enter'); }
catch (e) {
lastErr = e;
if (!(e instanceof StealthEvaluationError)) throw e;
await page.waitForLoadState('load').catch(() => {});
}
}
throw lastErr; Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Invalid browser version pin. Use a full numeric Chromium ver
- Isolated-world DOM evaluation failed for "<viewport>"
- Isolated-world DOM evaluation failed for '{selector}'
- Download completed but binary not found at expected path: ${
- Isolated-world DOM evaluation failed for ${selector}
AI-assisted analysis of CloakHQ/CloakBrowser@d6bad5de26 (2026-08-28).
Data as JSON: /api/errors/28aa16b2b813b0d1.
Report an issue: GitHub.