TreeWalker Class

Definition

Provides methods and properties used to navigate the UI Automation tree.

public ref class TreeWalker sealed
public sealed class TreeWalker
type TreeWalker = class
Public NotInheritable Class TreeWalker
Inheritance
TreeWalker

Remarks

UI Automation clients view the UI Automation elements on the desktop as a set of AutomationElement objects arranged in a tree structure.

Using the TreeWalker class, a client application can navigate the UI Automation tree by selecting a view of the tree and stepping from one AutomationElement to another in a specified direction using the GetFirstChild, GetLastChild, GetPreviousSibling, GetNextSibling, and GetParent methods.

Navigating the UI Automation tree using TreeWalker can result in cross-process calls and is not as efficient as locating an element using the FindAll or FindFirst methods.

If your client application might try to find elements in its own user interface, you must make all UI Automation calls on a separate thread.

Constructors

TreeWalker(Condition)

Initializes a new instance of the TreeWalker class.

Fields

ContentViewWalker

Represents a predefined TreeWalker containing a view of elements in the tree that are marked as content controls.

ControlViewWalker

Represents a predefined TreeWalker containing a view of elements in the tree that are marked as controls.

RawViewWalker

Represents a predefined TreeWalker containing a view of all the elements in the tree.

Properties

Condition

Gets the object that defines the view for the TreeWalker object.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetFirstChild(AutomationElement)

Retrieves the first child element of the specified AutomationElement.

GetFirstChild(AutomationElement, CacheRequest)

Retrieves the first child element of the specified AutomationElement and caches properties and patterns.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLastChild(AutomationElement)

Retrieves the last child element of the specified AutomationElement.

GetLastChild(AutomationElement, CacheRequest)

Retrieves the last child element of the specified AutomationElement and caches properties and patterns.

GetNextSibling(AutomationElement)

Retrieves the next sibling element of the specified AutomationElement.

GetNextSibling(AutomationElement, CacheRequest)

Retrieves the next sibling element of the specified AutomationElement and caches properties and patterns.

GetParent(AutomationElement)

Retrieves the parent element of the specified AutomationElement.

GetParent(AutomationElement, CacheRequest)

Retrieves the parent element of the specified AutomationElement and caches properties and patterns.

GetPreviousSibling(AutomationElement)

Retrieves the previous sibling of the specified AutomationElement.

GetPreviousSibling(AutomationElement, CacheRequest)

Retrieves the previous sibling of the specified AutomationElement and caches properties and patterns.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Normalize(AutomationElement)

Retrieves the node itself, if it satisfies the Condition, or the nearest parent or ancestor node that satisfies the Condition.

Normalize(AutomationElement, CacheRequest)

Retrieves the node itself, if it satisfies the Condition, or the nearest parent or ancestor node that satisfies the Condition, and caches properties and patterns.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also