dotnet/wpf · error · NoClickablePointException

SR.LogicalElementNoClickablePoint

Error message

SR.LogicalElementNoClickablePoint

What it means

GetClickablePoint returns a screen point that can be clicked, but UIA providers may not expose any clickable point. When TryGetClickablePoint returns false, the wrapper throws NoClickablePointException with SR.LogicalElementNoClickablePoint, as documented by the method's exception clause.

Solutions

  1. Call TryGetClickablePoint instead and handle the false return
  2. Fall back to BoundingRectangle center when no clickable point exists
  3. Scroll the element into view (ScrollItemPattern) and retry

Example fix

// before
Point pt = element.GetClickablePoint();
// after
if (!element.TryGetClickablePoint(out Point pt))
    pt = element.BoundingRectangle.Center();
Defensive patterns

Strategy: fallback

Validate before calling

bool hasClickable = element.TryGetClickablePoint(out _);
Rect bounds = element.BoundingRectangle;
bool onScreen = bounds.IntersectsWith(SystemInformation.VirtualScreen);

Type guard

bool TryGetClickPoint(AutomationElement e, out Point pt) => e.TryGetClickablePoint(out pt);

Try / catch

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

Prevention

When it happens

Trigger: Calling GetClickablePoint() on an element whose provider does not supply the ClickablePointProperty value, or whose clickable point is off-screen/obscured so no valid point exists.

Common situations: Mouse-based UI test automation on elements like menus, non-rectangular or virtualized items; elements scrolled outside the viewport; providers that simply omit ClickablePoint.

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/c663a8059d82e469. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/AutomationElement.cs:918

            
            // the providers point is either no good or they did not have one so poke around 
            // trying to find one.
            if (ClickablePoint.HitTestForClickablePoint( (AutomationElement)this, out pt) )
                return true;
            
            return false;
        }
        
        /// <summary>
        /// Get a point that can be clicked on.  This throws the NoClickablePointException if there is no clickable point
        /// </summary>
        /// <returns>A point that can be used by a client to click on this LogicalElement</returns>
        /// <exception cref="NoClickablePointException">If there is not clickable point for this element</exception>
        public Point GetClickablePoint()
        {
            Point pt;
            if ( !TryGetClickablePoint( out pt ) )
                throw new NoClickablePointException(SR.LogicalElementNoClickablePoint);

            return pt;
        }
        #endregion Public Methods


        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------
 
        #region Public Properties

        /// <summary>
        /// Get root element for current desktop
        /// </summary>
        /// <returns>root element for current desktop</returns>

View on GitHub (pinned to 81131a70a4)