Class ElementAssistant
Application ElementAssistant with fluent methods to help you manipulate AutomationElements in callback EventHandlers.
Instantiated with GPAL.ElementAssistant
Inheritance
System.Object
ElementAssistant
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: GPAL.dll
Syntax
public class ElementAssistant : IAllowForSelector, IAllowElementSettingsAndActions, IAllowElementSetting, IAllowElementActions
Examples
// CallIfFound handler
public static int FoundNotepadPane(Application application, List<GPALAutomationElement> foundElements, List<GPALAutomationElement> matchedElements, Selector selector)
{
ElementAssistant elementAssistant = (ElementAssistant) GPAL.ElementAssistant(application);
foreach (GPALAutomationElement element in foundElements)
{
elementAssistant
.ForSelector(selector) // for interaction type, offsetX and offsetY
.WithElement(element)
.WithHardware // can override the selector interaction type here for this one elem
.LeftClick();
}
return 0;
}
Properties
WithHardware
Interact with the GPALAutomationElement emulating hardware, not using UIAutomation;
Declaration
public IAllowElementSettingsAndActions WithHardware { get; }
Property Value
Methods
AppendFrom(String)
Appends text to the end of the input GPALAutomationElement defined with .WithElement
Declaration
public IAllowElementSettingsAndActions AppendFrom(string inputText)
Parameters
| Type |
Name |
Description |
| System.String |
inputText |
|
Returns
FillInFrom(String)
Fill In (Ovewrite) text of the input GPALAutomationElement defined with .WithElement
Declaration
public IAllowElementSettingsAndActions FillInFrom(string inputText)
Parameters
| Type |
Name |
Description |
| System.String |
inputText |
|
Returns
ForSelector(Selector)
The selector associated with the webelement(s) you are acting upon.
Used for the OffestX and OffsetY properties and Information and Exceptional channel messages.
Declaration
public IAllowElementSetting ForSelector(Selector selector)
Parameters
Returns
InsertFrom(String)
Insert text at the beginning of the input GPALAutomationElement defined with .WithElement
Declaration
public IAllowElementSettingsAndActions InsertFrom(string inputText)
Parameters
| Type |
Name |
Description |
| System.String |
inputText |
|
Returns
LeftClick(Enums.ModifierKeys)
Left click the GPALAutomationElement, optionally emulating pressing a modifier key at the same time.
Declaration
public IAllowElementSettingsAndActions LeftClick(Enums.ModifierKeys modifierKeys = Enums.ModifierKeys.None)
Parameters
Returns
LeftDoubleClick()
Left double click the GPALAutomationElement.
Declaration
public IAllowElementSettingsAndActions LeftDoubleClick()
Returns
PressModifierKey(Enums.ModifierKeys)
Press a modifier key: Alt, Control, Shift
Declaration
public IAllowElementSettingsAndActions PressModifierKey(Enums.ModifierKeys modifierKeys)
Parameters
Returns
ReleaseModifierKey(Enums.ModifierKeys)
Release a modifier key: Alt, Control, Shift
Declaration
public IAllowElementSettingsAndActions ReleaseModifierKey(Enums.ModifierKeys modifierKeys)
Parameters
Returns
RightClick()
Right click the GPALAutomationElement.
Declaration
public IAllowElementSettingsAndActions RightClick()
Returns
Declaration
public IAllowElementSettingsAndActions ScrollHorizontal(ScrollAmount scrollAmount)
Parameters
| Type |
Name |
Description |
| System.Windows.Automation.ScrollAmount |
scrollAmount |
|
Returns
Declaration
public IAllowElementSettingsAndActions ScrollHorizontalPercent(int percent)
Parameters
| Type |
Name |
Description |
| System.Int32 |
percent |
|
Returns
Declaration
public IAllowElementSettingsAndActions ScrollVertical(ScrollAmount scrollAmount)
Parameters
| Type |
Name |
Description |
| System.Windows.Automation.ScrollAmount |
scrollAmount |
|
Returns
ScrolVerticalPercent(Int32)
Declaration
public IAllowElementSettingsAndActions ScrolVerticalPercent(int percent)
Parameters
| Type |
Name |
Description |
| System.Int32 |
percent |
|
Returns
SendKeyCode(Byte)
Declaration
public IAllowElementSettingsAndActions SendKeyCode(byte keyCode)
Parameters
| Type |
Name |
Description |
| System.Byte |
keyCode |
|
Returns
WithElement(GPALAutomationElement)
Define the GPALAutomationElement to act upon.
Declaration
public IAllowElementSettingsAndActions WithElement(GPALAutomationElement AutomationElement)
Parameters
Returns
Implements