AutomationControl Class

This class represents windows objects that are returned by calls to FindTopAutomationWindow, FindTopAutomationWindows, Automation.FindControl and Automation.FindControls.

An AutomationControl object is similar to the WinDriver Control and has almost the same properties and methods but wraps the Windows .NET System.Windows.Automation.AutomationElement object and uses the NET System.Windows.Automation methods.

The AutomationControl is able to interact with windows that are not visible to the Control and can provide a much greater range of functionality by directly using System.Windows.Automation methods.  The penalty is that finding a WinDriver AutomationControl can be much slower than finding a WinDriver Control object that wraps the Windows handle.

AutomationControls can be windows, dialogs, buttons, comboBoxes or any other windows object that can be identified as a NET System.Windows.Automation.AutomationElement.  The WinDriver AutomationClass used the Microsoft System.Windows.Automation namespace described in http://msdn.microsoft.com/en-us/library/ms590934.aspx.  Using the AutomationElement of the AutomationControl you have full access to Microsoft Automation described in http://msdn.microsoft.com/en-us/library/system.windows.automation.automationelement.aspx.  Note that you should use the Current property of the element, e.g.

string shortcut =myControl.Element.Current.AcceleratorKey;

AutomationControl Class Properties

Property Description

string AutomationId

The underlying AutomationElement ID.  This should be unique for the application but not all elements have a value.

ControlType ControlType

The underlying AutomationElement Type such as Button, Checkbox etc.  See System.Windows.Automation.AutomationIdentifier for the list.

AutomationElement Element

The .Net System.Windows.Automation.AutomationElement

bool Enabled

True if the windows control is enabled

HandleRef Handle

The unique Windows handle.  Not all AutomationControls have a handle.

Rectangle Rectangle

A System.Drawing.Rectangle.  From this object you can get numerous other coordinate properties.

string Text

The control's text value such as the window caption or label. This is the AutomationElement Name value. Note that it may be empty for some controls.

bool Visible

True if the windows control is visible

Point Center

The center of the control as a System.Drawing.Point

int Height, Width

The control height and width in pixels

int X, Y

The absolute X and Y screen coordinates of the top left hand corner of the window

Point Center

The center of the Window as a System.Drawing.Point

The AutomationControl class MetaData:

namespace Facilita.Fc.WinDriver

{

publicclassAutomationControl : BaseControl

{

public AutomationControl(AutomationElement element, WinDriverVirtualUser vu);

publicoverridestring AutomationId { get; }

publicoverridestring Class { get; }

publicoverrideControlType ControlType { get; }

publicAutomationElement Element { get; }

publicoverridebool Enabled { get; }

publicoverrideHandleRef Handle { get; }

publicoverrideRectangle Rectangle { get; }

publicoverridestring Text { get; }

publicoverridebool Visible { get; }

publicoverridevoid ActivateMenuItem(paramsstring[] menuItemPath);

publicoverridevoid ClickButton();

publicvoid ClickButtonWithLabel(string label);

publicoverridevoid DoubleLeftClick(int moveRight, int moveDown);

publicoverridevoid ExpandTreeItem(string name);

publicAutomationControl FindControl(ControlType controlType);

publicAutomationControl FindControl(MatchCriteria matchCriteria);

publicAutomationControl FindControl(string wantedText);

publicAutomationControl FindControl(ControlType controlType, int maxWait);

publicAutomationControl FindControl(MatchCriteria matchCriteria, int maxWait);

publicAutomationControl FindControl(string wantedText, ControlType controlType);

publicAutomationControl FindControl(string wantedText, int maxWait);

publicAutomationControl FindControl(string wantedText, string wantedClass);

publicAutomationControl FindControl(string wantedText, TextMatch textMatch);

publicAutomationControl FindControl(string wantedText, ControlType controlType, int maxWait);

publicAutomationControl FindControl(string wantedText, string wantedClass, int maxWait);

publicAutomationControl FindControl(string wantedText, string wantedClass, TextMatch textMatch);

publicAutomationControl FindControl(string wantedText, TextMatch textMatch, ControlType controlType);

publicAutomationControl FindControl(string wantedText, TextMatch textMatch, int maxWait);

publicAutomationControl FindControl(string wantedText, string wantedClass, TextMatch textMatch, int maxWait);

publicAutomationControl FindControl(string wantedText, TextMatch textMatch, ControlType controlType, int maxWait);

publicAutomationControl FindControlByAutomationId(string automationId);

publicIList<AutomationControl> FindControls(ControlType controlType);

publicIList<AutomationControl> FindControls(MatchCriteria matchCriteria);

publicIList<AutomationControl> FindControls(Predicate<AutomationControl> selectionFunction);

publicIList<AutomationControl> FindControls(string wantedText);

publicIList<AutomationControl> FindControls(string wantedText, ControlType controlType);

publicIList<AutomationControl> FindControls(string wantedText, string wantedClass);

publicIList<AutomationControl> FindControls(string wantedText, TextMatch textMatch);

publicIList<AutomationControl> FindControls(string wantedText, string wantedClass, TextMatch textMatch);

publicIList<AutomationControl> FindControls(string wantedText, TextMatch textMatch, ControlType controlType);

publicoverrideIList<string> GetComboBoxItems();

publicoverrideIList<string> GetListBoxItems();

publicoverrideint GetListItemCount();

publicoverridePoint GetListItemLocation(int index);

publicoverridePoint GetTreeItemLocation(string name);

publicoverrideRectangle GetTreeItemRectangle(string name);

publicoverridestring GetTreeItemText(int index);

publicoverrideint GetTreeViewItemCount();

publicoverridevoid LeftClick(int moveRight, int moveDown);

publicoverridevoid RightClick(int moveRight, int moveDown);

publicoverridevoid SelectComboBoxItem(int item);

publicoverridevoid SelectComboBoxItem(string item);

publicoverridevoid SelectListBoxItem(int item);

publicoverridevoid SelectListBoxItem(string item);

publicoverridevoid SelectTreeItem(string name);

publicoverridevoid SetForegroundWindow();

publicControl ToControl();

publicvoid WaitForRecreatedControl(AutomationControl control);

publicvoid WaitForRecreatedControl(AutomationControl control, int maxWait);

publicoverridevoid WaitForWindowCount(string wantedClass, int count, int maxWait);

}

}

 

This topic was last updated on November 20, 2019, at 03:32:07 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2020 Eggplant