dotnet/wpf · error · NoClickablePointException

UIA_E_NOCLICKABLEPOINT

UIA_E_NOCLICKABLEPOINT

Error message

description (from UiaGetErrorDescription or SR.UnknownCoreAPIError)

What it means

UiaCoreApi maps the native HRESULT UIA_E_NOCLICKABLEPOINT to NoClickablePointException. It is thrown when GetClickablePoint (or a native call requesting a clickable point) is made and the element has no point that can be clicked - either it has no ClickablePointProperty override and no bounding rectangle, or the computed point is obscured/off-screen. Message comes from UiaGetErrorDescription.

Solutions

  1. Use the element's BoundingRectangle center manually after ensuring the window is restored and on-screen
  2. Scroll the element into view and bring its window to foreground before requesting a clickable point
  3. Prefer pattern-based interaction (InvokePattern, TogglePattern, etc.) over clicking coordinates
  4. Use TryGetClickablePoint and fall back to other strategies instead of the throwing GetClickablePoint

Example fix

// before
var pt = element.GetClickablePoint();
// after
System.Windows.Point pt;
if (!element.TryGetClickablePoint(out pt))
{
    var r = element.Current.BoundingRectangle;
    pt = new System.Windows.Point(r.X + r.Width / 2, r.Y + r.Height / 2);
}
Defensive patterns

Strategy: fallback

Validate before calling

var rect = element.Current.BoundingRectangle;
bool hasPoint = rect.Width > 0 && rect.Height > 0 && !element.Current.IsOffscreen;

Try / catch

try { pt = element.GetClickablePoint(); }
catch (NoClickablePointException) { pt = CenterOf(element.Current.BoundingRectangle); }

Prevention

When it happens

Trigger: Calling AutomationElement.GetClickablePoint() or TryGetClickablePoint-based flows where the native core returns UIA_E_NOCLICKABLEPOINT (0x80040202), e.g. on elements with zero-size rectangles or fully occluded windows.

Common situations: Automating elements in minimized windows; zero-size or invisible containers; elements scrolled outside the visible viewport; overlapped windows hiding the element's rect.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/5db8a89fcf6a4bae. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/UiaCoreApi.cs:1194

            if (hr == UIA_E_ELEMENTNOTENABLED
            || hr == UIA_E_ELEMENTNOTAVAILABLE
            || hr == UIA_E_NOCLICKABLEPOINT
            || hr == UIA_E_PROXYASSEMBLYNOTLOADED)
            {
                string description;
                if (!UiaGetErrorDescription(out description))
                    description = SR.UnknownCoreAPIError;

                switch (hr)
                {
                    case UIA_E_ELEMENTNOTENABLED:
                        throw new ElementNotEnabledException(description);

                    case UIA_E_ELEMENTNOTAVAILABLE:
                        throw new ElementNotAvailableException(description);

                    case UIA_E_NOCLICKABLEPOINT:
                        throw new NoClickablePointException(description);

                    case UIA_E_PROXYASSEMBLYNOTLOADED:
                        throw new ProxyAssemblyNotLoadedException(description);
                }
            }

            // Not a UIA-specific exception - let COM Interop handle the rest.
            // (Marshal.ThrowExceptionForHR automatically calls GetErrorInfo to fill in the description
            // field - UIA sets the error info itself, so it will get propogated here.)
            Marshal.ThrowExceptionForHR(hr);
        }

        #endregion Private Methods

        #region Raw API methods

        //
        // Client-side methods...

View on GitHub (pinned to 81131a70a4)