Skip to main content

Text

Return the automation control text.

public string Text;

Return Value

The text value of the automation control, such as the window caption or button text. This is the Name field of the underlying windows AutomationElement.

Note that some automation controls may not have text readable by this method.

For many AutomationControl types it many be necessary to read text content via the AutomationElement e.g.

myAutomationControl.Element.Current.

Example

AutomationControl wind_1 = FindTopAutomationWindow("", "WindowsForms10.Window.8.app");
if (wind_1.Text.Contains("SomeText"))
{
....