19using System.Collections.Generic;
22using System.Threading;
23using System.Threading.Tasks;
58 private ElementSettings ElementSettings {
get;
set; }
64 internal ElementAssistant()
66 ElementSettings =
new ElementSettings();
76 ElementSettings.InteractionType = InteractionType.Hardware;
86 if (InteractionType.Hardware == ElementSettings.InteractionType)
87 ElementHelper.HardwareClick(Application, ElementSettings.AutomationElement, ClickType.LeftClick, ModifierKeys.NONE);
89 ElementHelper.UIAutomationClick(Application, ElementSettings.Selector, ElementSettings.AutomationElement, ClickType.LeftClick, ModifierKeys.NONE);
101 if (InteractionType.Hardware == ElementSettings.InteractionType)
102 ElementHelper.HardwareClick(Application, ElementSettings.AutomationElement, ClickType.LeftClick, modifierKeys);
104 ElementHelper.UIAutomationClick(Application, ElementSettings.Selector, ElementSettings.AutomationElement, ClickType.LeftClick, modifierKeys);
115 if (InteractionType.Hardware == ElementSettings.InteractionType)
116 ElementHelper.HardwareClick(Application, ElementSettings.AutomationElement, ClickType.LeftDoubleClick, ModifierKeys.NONE);
119 ElementHelper.UIAutomationClick(Application, ElementSettings.Selector, ElementSettings.AutomationElement, ClickType.LeftDoubleClick, ModifierKeys.NONE);
131 if (InteractionType.Hardware == ElementSettings.InteractionType)
132 ElementHelper.HardwareClick(Application, ElementSettings.AutomationElement, ClickType.RightClick, ModifierKeys.NONE);
135 ElementHelper.UIAutomationClick(Application, ElementSettings.Selector, ElementSettings.AutomationElement, ClickType.RightClick, ModifierKeys.NONE);
148 ElementHelper.Scroll(Application, scrollAmount, ScrollTypes.Increments, ScrollTypes.Horizontal);
159 ElementHelper.Scroll(Application, percent, ScrollTypes.Percent, ScrollTypes.Horizontal);
170 ElementHelper.Scroll(Application, scrollAmount, ScrollTypes.Increments, ScrollTypes.Vertical);
181 ElementHelper.Scroll(Application, percent, ScrollTypes.Percent, ScrollTypes.Vertical);
192 ElementSettings.Selector = selector;
214 UnitOfWork.ElementNode elementNode =
new UnitOfWork.
ElementNode() { OffsetX = (int)(ElementSettings.Selector?.OffsetX ?? 5), OffsetY = (int)(ElementSettings.Selector?.OffsetY ?? 5), InteractionType = ElementSettings.InteractionType };
215 ElementHelper.FillInFrom(Application, ElementSettings.AutomationElement.Ae, elementNode, inputText, WriteMode.Overwrite);
226 ElementHelper.FillInFrom(Application, inputText, WriteMode.Insert);
237 UnitOfWork.ElementNode elementNode =
new UnitOfWork.
ElementNode() { OffsetX = (int)(ElementSettings.Selector?.OffsetX ?? 5), OffsetY = (int)(ElementSettings.Selector?.OffsetY ?? 5), InteractionType = ElementSettings.InteractionType };
238 ElementHelper.FillInFrom(Application, ElementSettings.AutomationElement.Ae, elementNode, inputText, WriteMode.Append);
251 HardwareHelper.SendKey(keyCode);
261 if (ModifierKeys.NONE != modifierKeys)
262 HardwareHelper.PressModifierKey(modifierKeys);
272 if (ModifierKeys.NONE != modifierKeys)
273 HardwareHelper.ReleaseModifierKeys(modifierKeys);
288 ElementSettings.Application = value;
Application object that contains the fluent methods to create your Application workflow....
IAllowElementSettingsAndActions LeftDoubleClick()
Left double click the GPALAutomationElement.
IAllowElementSettingsAndActions ReleaseModifierKey(ModifierKeys modifierKeys)
Release a modifier key: Alt, Control, Shift.
IAllowElementSettingsAndActions AppendFrom(string inputText)
Appends text to the end of the input GPALAutomationElement defined with .WithElement.
IAllowElementSettingsAndActions LeftClick(Enums.ModifierKeys modifierKeys)
Left click the GPALAutomationElement, optionally emulating pressing a modifier key at the same time.
IAllowElementSettingsAndActions ScrolVerticalPercent(int percent)
Scroll the GPALAutomationElement vertically to the given percentage of its scrollable range.
IAllowElementSettingsAndActions ScrollHorizontal(System.Windows.Automation.ScrollAmount scrollAmount)
Scroll the GPALAutomationElement horizontally by an increment amount.
IAllowElementSettingsAndActions WithHardware
Interact with the GPALAutomationElement emulating hardware, not using UIAutomation;.
IAllowElementSettingsAndActions InsertFrom(string inputText)
Insert text at the beginning of the input GPALAutomationElement defined with .WithElement.
IAllowElementSettingsAndActions RightClick()
Right click the GPALAutomationElement.
IAllowElementSettingsAndActions WithElement(IGPALAutomationElement AutomationElement)
Define the GPALAutomationElement to act upon.
IAllowElementSettingsAndActions LeftClick()
Left click the GPALAutomationElement.
IAllowElementSettingsAndActions FillInFrom(string inputText)
Fill In (Ovewrite) text of the input GPALAutomationElement defined with .WithElement.
IAllowElementSettingsAndActions ScrollVertical(System.Windows.Automation.ScrollAmount scrollAmount)
Scroll the GPALAutomationElement vertically by an increment amount.
IAllowElementSettingsAndActions SendKeyCode(byte keyCode)
Emulate pressing a special key like Home, End, Page Down. Use GPAL.VK_ defined virual keycodes or se...
IAllowElementSettingsAndActions PressModifierKey(ModifierKeys modifierKeys)
Press a modifier key: Alt, Control, Shift.
IAllowElementSettingsAndActions ScrollHorizontalPercent(int percent)
Scroll the GPALAutomationElement horizontally to the given percentage of its scrollable range.
IAllowElementSetting ForSelector(Selector selector)
The selector associated with the webelement(s) you are acting upon. Used for the OffestX and OffsetY...
Application workflow container for automation elements.
GPAL Selector used to locate Application and Browser elements. Instantiated with GPAL....
InteractionType InteractionType
Defined method to interact with this element. NOTE: This can be overridden in the workflow.
Everything revolves around the Unit of Work. A Unit of Work is defined as one or more selectors betw...