Show / Hide Table of Contents

Class ElementAssistant

Browser ElementAssistant object with fluent methods to help you manipulate WebElements in Callback EventHandlers.
Instantiated with GPAL.ElementAssistant()

Inheritance
System.Object
ElementAssistant
Implements
IAllowElementSettingsAndActions
IAllowElementSetting
IAllowElementActions
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()
Namespace: GenerallyPositive.Browser
Assembly: GPAL.dll
Syntax
public class ElementAssistant : IAllowElementSettingsAndActions, IAllowElementSetting, IAllowElementActions
Examples
public static int CallIfFound(Browser browser, List<GPALElement> foundElements, List<GPALElement> matchedElements, Selector selector)
{
    elementAssistant = (ElementAssistant) GPAL.ElementAssistant(browser);

    foreach (GPALElement webElement in matchedElements)
    {
        elementAssistant
            .ForSelector(selector)  // for interaction type, offsetX and offsetY
            .WithElement(webElement)
            .WithJavscript // can override the selector interaction type here for this one elem
            .LeftClick();
    }
}

Properties

WithHardware

Interact with the webelement using hardware emulation

Declaration
public IAllowElementSettingsAndActions WithHardware { get; }
Property Value
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

WithJavaScript

Interact with the webelement using javascript

Declaration
public IAllowElementSettingsAndActions WithJavaScript { get; }
Property Value
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

Methods

AppendFrom(String)

Appends text to the end of the input webelement defined with .WithElement

Declaration
public IAllowElementSettingsAndActions AppendFrom(string inputText)
Parameters
Type Name Description
System.String inputText
Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

FillInFrom(String)

Fill In (Ovewrite) text of the input webelement defined with .WithElement

Declaration
public IAllowElementSettingsAndActions FillInFrom(string inputText)
Parameters
Type Name Description
System.String inputText
Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

InsertFrom(String)

Insert text at the beginning of the input webelement defined with .WithElement

Declaration
public IAllowElementSettingsAndActions InsertFrom(string inputText)
Parameters
Type Name Description
System.String inputText
Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

LeftClick(Enums.ModifierKeys)

Left click the webelement, optionally emulating pressing a modifier key at the same time.

Declaration
public IAllowElementSettingsAndActions LeftClick(Enums.ModifierKeys modifierKeys = Enums.ModifierKeys.None)
Parameters
Type Name Description
Enums.ModifierKeys modifierKeys

Optional modifier key press

Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

LeftClick(GPALElement)

Left click the webelement, optionally emulating pressing a modifier key at the same time.

Declaration
public IAllowElementSettingsAndActions LeftClick(GPALElement webElement)
Parameters
Type Name Description
GPALElement webElement
Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

LeftDoubleClick()

Left double click the webelement.

Declaration
public IAllowElementSettingsAndActions LeftDoubleClick()
Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

LeftDoubleClick(GPALElement)

Left double click the webelement.

Declaration
public IAllowElementSettingsAndActions LeftDoubleClick(GPALElement webElement)
Parameters
Type Name Description
GPALElement webElement
Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

PressModifierKey(Enums.ModifierKeys)

Press a modifier key: Alt, Control, Shift

Declaration
public IAllowElementSettingsAndActions PressModifierKey(Enums.ModifierKeys modifierKeys)
Parameters
Type Name Description
Enums.ModifierKeys modifierKeys

Alt, Control, Shift

Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

ReleaseModifierKey(Enums.ModifierKeys)

Release a modifier key: Alt, Control, Shift

Declaration
public IAllowElementSettingsAndActions ReleaseModifierKey(Enums.ModifierKeys modifierKeys)
Parameters
Type Name Description
Enums.ModifierKeys modifierKeys

Alt, Control, Shift

Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

RightClick(GPALElement)

Right click the webelement.

Declaration
public IAllowElementSettingsAndActions RightClick(GPALElement webElement = null)
Parameters
Type Name Description
GPALElement webElement
Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

ScrollHorizontalPixels(Int32)

Scroll the element horizontally by number of pixels.
Negative numbers scroll left. JavaScript only

Declaration
public IAllowElementSettingsAndActions ScrollHorizontalPixels(int scrollAmount)
Parameters
Type Name Description
System.Int32 scrollAmount

Positive integer scrolls right.
Negative integer scolls left.

Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

ScrollVerticalPixels(Int32)

Scroll the element vertically by number of pixels.
Negative numbers scroll up. JavaScript only

Declaration
public IAllowElementSettingsAndActions ScrollVerticalPixels(int scrollAmount)
Parameters
Type Name Description
System.Int32 scrollAmount

Positive integer scrolls down.
Negative integer scolls down.

Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

SendKey(Byte)

Emulate pressing a special key like Home, End, Page Down.
Use GPAL.VK_ defined virual keycodes or send any you want to send.
https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

Declaration
public IAllowElementSettingsAndActions SendKey(byte keyCode)
Parameters
Type Name Description
System.Byte keyCode
Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

SendString(String)

Send the string using hardware emulation.

Declaration
public IAllowElementSettingsAndActions SendString(string textToSend)
Parameters
Type Name Description
System.String textToSend
Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

WithElement(GPALElement)

Define the element to act upon.

Declaration
public IAllowElementSettingsAndActions WithElement(GPALElement GPALElement)
Parameters
Type Name Description
GPALElement GPALElement

The GPALElement to interact with

Returns
Type Description
IAllowElementSettingsAndActions

Fluent interface to write your element handling workflow

Implements

IAllowElementSettingsAndActions
IAllowElementSetting
IAllowElementActions
In This Article
Back to top Generated by DocFX