Export (0) Print
Expand All

AutomationElement.GetClickablePoint Method

Retrieves a point on the AutomationElement that can be clicked.

Namespace: System.Windows.Automation
Assembly: UIAutomationClient (in uiautomationclient.dll)

public Point GetClickablePoint ()
public Point GetClickablePoint ()
public function GetClickablePoint () : Point
Not applicable.

Return Value

The physical screen coordinates of a point that can be used by a client to click on this element.

Exception typeCondition

NoClickablePointException

There is no clickable point.

ElementNotAvailableException

The UI for the AutomationElement no longer exists.

An AutomationElement is not clickable if it is completely obscured by another window.

An AutomationElement is clickable when it satisfies all the following conditions:

  • It is programmatically visible and available with the UI Automation tree.

  • It is scrolled fully into view within its parent container, if any. If the element is clipped, there is no guarantee that it is clickable.

  • The element is not obscured by any other UI element. If the element is partially obscured by some UI element other than its ancestors, it might not be clickable.

  • The window containing the element must itself be clickable. For example, the window is not clickable if the containing window is completely transparent. Mouse clicks will click through to the window underneath, so any controls within the transparent window will not return clickable points.

  • If the element is a container (such as list or tree view), it must have a point that when clicked will cause the background of the control to be focused. If every part of the container control is occupied by a child element, it is not clickable.

There is no guarantee that a control will do anything when clicked on a point defined as clickable by the UI Automation provider. Consider using control patterns instead to perform actions on controls.

The following code retrieves a clickable point for a control and moves the system cursor to that point.

// element is an AutomationElement.
System.Windows.Point clickablePoint = element.GetClickablePoint();
System.Windows.Forms.Cursor.Position = new System.Drawing.Point((int)clickablePoint.X, (int)clickablePoint.Y);

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft