{"record":{"id":"2f8b916469a90a8d","repo":"CloakHQ/CloakBrowser","slug":"unsupportedhumanizeselectorerror-selector","errorCode":null,"errorMessage":"UnsupportedHumanizeSelectorError: {selector}","messagePattern":"UnsupportedHumanizeSelectorError: (.+?)","errorType":"exception","errorClass":"UnsupportedHumanizeSelectorError","httpStatus":null,"severity":"error","filePath":"dotnet/src/CloakBrowser/Wrappers/LocatorHumanizer.cs","lineNumber":21,"sourceCode":"\nnamespace CloakBrowser.Wrappers;\n\n/// <summary>Humanized locator actions. Direct page.Locator selectors use the canonical isolated DOM world; unknown locator shapes retain the legacy Playwright path.</summary>\ninternal static class LocatorHumanizer\n{\n    private static double RemainingMs(double deadline) => Actionability.RemainingMs(deadline);\n\n    private static async Task<IsolatedWorld> WorldAsync(HumanCursor cursor) =>\n        await cursor.GetStealthAsync().ConfigureAwait(false) ?? throw new StealthWorldUnavailableError();\n\n    internal static async Task<StealthSnapshot> SnapshotAsync(HumanCursor cursor, string selector)\n    {\n        var (status, snapshot) = await StealthDom.SnapshotAsync(await WorldAsync(cursor).ConfigureAwait(false), selector).ConfigureAwait(false);\n        return status switch\n        {\n            StealthStatus.Ok when snapshot != null => snapshot.Value,\n            StealthStatus.NotFound => throw new ElementNotAttachedError(selector),\n            StealthStatus.Unsupported => throw new UnsupportedHumanizeSelectorError(selector),\n            _ => throw new StealthEvaluationError(selector),\n        };\n    }\n\n    internal static async Task EnsureActionableAsync(HumanCursor cursor, string selector,\n        IReadOnlySet<string> checks, double timeout, bool force)\n    {\n        var world = await WorldAsync(cursor).ConfigureAwait(false);\n        await Actionability.EnsureActionableAsync(cursor.Page, selector, checks, timeout, force, world).ConfigureAwait(false);\n    }\n\n    private static async Task<BoundingBox?> GetBoxAsync(\n        IsolatedWorld world, string selector, double timeoutMs)\n    {\n        double deadline = System.Environment.TickCount64 + System.Math.Max(0, timeoutMs);\n        var result = await StealthDom.BoxAsync(world, selector).ConfigureAwait(false);\n        while ((result.Status == StealthStatus.NotFound || result.Status == StealthStatus.EvaluationFailed)\n            && System.Environment.TickCount64 < deadline)","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/CloakHQ/CloakBrowser/blob/d6bad5de261bedf025280ace1d14e800aee13923/dotnet/src/CloakBrowser/Wrappers/LocatorHumanizer.cs#L3-L39","documentation":"UnsupportedHumanizeSelectorError mapped from StealthStatus.Unsupported: the stealth DOM engine cannot resolve this selector shape, so the humanized locator path cannot run for it.","triggerScenarios":"Using selector syntax the isolated-world snapshot doesn't support — e.g. Playwright-specific engine selectors (:has-text, :visible, >> chained engines, internal: selectors) rather than plain CSS/XPath.","commonSituations":"Copying selectors from Playwright traces/codegen (which emit :text= and >> chains) into humanized locator calls.","solutions":["Convert the selector to plain CSS or XPath understood by the stealth DOM engine","Use a stable data-testid CSS selector instead of Playwright pseudo-classes","Fall back to the non-humanized Playwright path for exotic selectors"],"exampleFix":"# before\nawait page.locator(\"button:has-text('Submit')\").human_click()\n\n# after\nawait page.locator(\"button[type='submit']\").human_click()","handlingStrategy":"type-guard","validationCode":"bool supported = selector.All(c => char.IsLetterOrDigit(c)) && !selector.Contains(\":has-text\") && !selector.Contains(\">>\");","typeGuard":"static bool IsStealthSupportedSelector(string s) => !s.Contains(\":\") && !s.Contains(\">>\") && !s.StartsWith(\"text=\");","tryCatchPattern":"catch (UnsupportedHumanizeSelectorError) { fall back to plain CSS equivalent or native Playwright path }","preventionTips":["Use plain CSS/XPath selectors for humanize paths","Avoid Playwright codegen pseudo-classes in humanize calls","Keep a helper that normalizes selectors to CSS"],"tags":["humanize","selector","playwright","unsupported-feature"],"backgroundTag":"unsupported-selector-engine","analyzedSha":"d6bad5de261bedf025280ace1d14e800aee13923","analyzedAt":"2026-08-28T14:13:12.918Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}