{"record":{"id":"ef7becd662d65f35","repo":"CloakHQ/CloakBrowser","slug":"unsupportedhumanizeselectorerror-ef7bec","errorCode":null,"errorMessage":"UnsupportedHumanizeSelectorError","messagePattern":"UnsupportedHumanizeSelectorError","errorType":"exception","errorClass":"UnsupportedHumanizeSelectorError","httpStatus":null,"severity":"error","filePath":"dotnet/src/CloakBrowser/Human/Actionability.cs","lineNumber":166,"sourceCode":"        int attempt = 0;\n        Exception? lastError = null;\n\n        while (true)\n        {\n            double remainingMs = Math.Max(0, deadline - NowMs());\n            if (remainingMs <= 0)\n            {\n                if (lastError != null)\n                    throw lastError;\n                throw new ActionabilityError(selector, \"timeout\", \"timeout expired before first check\");\n            }\n\n            try\n            {\n                var (status, snapshot) = await StealthDom.ActionableAsync(\n                    stealth, selector).ConfigureAwait(false);\n                if (status == StealthStatus.Unsupported)\n                    throw new UnsupportedHumanizeSelectorError(selector);\n                if (status == StealthStatus.EvaluationFailed)\n                    throw new StealthEvaluationError(selector);\n                if (status == StealthStatus.NotFound)\n                    throw new ElementNotAttachedError(selector);\n                if (status != StealthStatus.Ok || snapshot == null)\n                    throw new StealthEvaluationError(selector);\n\n                var value = snapshot.Value;\n                if (checks.Contains(\"visible\") && !value.Visible)\n                    throw new ElementNotVisibleError(selector);\n                if (checks.Contains(\"enabled\") && !value.Enabled)\n                    throw new ElementNotEnabledError(selector);\n                if (checks.Contains(\"editable\") && !value.Editable)\n                    throw new ElementNotEditableError(selector);\n                return;\n            }\n            catch (Exception error) when (error is ActionabilityError or StealthEvaluationError)\n            {","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/CloakHQ/CloakBrowser/blob/d6bad5de261bedf025280ace1d14e800aee13923/dotnet/src/CloakBrowser/Human/Actionability.cs#L148-L184","documentation":"The isolated-world DOM evaluator reported StealthStatus.Unsupported for the given selector, meaning the selector's shape is not something the stealth DOM engine can evaluate. The library throws UnsupportedHumanizeSelectorError so callers know to rewrite the selector rather than wait or retry.","triggerScenarios":"Calling EnsureActionableAsync/EnsureActionableWorldAsync with a selector type not supported by StealthDom.ActionableAsync — e.g. XPath, pseudo-elements, or complex CSS the evaluator cannot translate — so the first evaluation returns Unsupported.","commonSituations":"Passing XPath ('//div[@id=...]') where only simple CSS selectors are supported; using pseudo-classes like :has() or :nth-of-type() the evaluator rejects; copy-pasted DevTools selectors; library upgrades narrowing the supported selector grammar.","solutions":["Rewrite the selector as simple CSS (tag, id, class, attribute combinators).","Check the library docs for the exact selector grammar StealthDom supports.","Replace XPath with an equivalent CSS selector or resolve the element first and use a stable attribute selector."],"exampleFix":"// before\nawait Actionability.EnsureActionableAsync(page, \"//button[@id='submit']\", stealth);\n\n// after\nawait Actionability.EnsureActionableAsync(page, \"button#submit\", stealth);","handlingStrategy":"validation","validationCode":"static bool IsSupportedSelector(string s) =>\n    !s.StartsWith(\"//\") && !s.StartsWith(\"(\") && !s.Contains(\":has(\") && !s.Contains(\"::\");\nif (!IsSupportedSelector(selector)) selector = ToCssSelector(selector); // pre-normalize","typeGuard":"static bool IsSupportedHumanizeSelector(string selector) =>\n    selector.All(c => char.IsLetterOrDigit(c) || \" #.>[]:-_@[*=$^~|()'\\\"\".Contains(c)) && !selector.Contains(\"::\");","tryCatchPattern":"catch (UnsupportedHumanizeSelectorError ex)\n{\n    selector = Cssify(ex.Selector); // convert to plain CSS and retry\n    await Actionability.EnsureActionableAsync(page, selector, stealth);\n}","preventionTips":["Standardize on simple CSS selectors for humanized interactions.","Lint test selectors against the supported grammar in CI.","Convert XPath from DevTools/DOM explorers before pasting into code."],"tags":["selector","css","xpath","unsupported","humanize"],"backgroundTag":"unsupported-selector-syntax","analyzedSha":"d6bad5de261bedf025280ace1d14e800aee13923","analyzedAt":"2026-08-28T14:13:12.918Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}