Show / Hide Table of Contents

Class Selector

GPAL Selector used to locate Application and Browser elements.
Instantiated with GPAL.Selector

Inheritance
System.Object
Selector
Implements
IAllowSelectorSettings
IAllowCallBack
IAllowToGPALObject<Selector>
IAllowImageSettings
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
Assembly: GPAL.dll
Syntax
public class Selector : IAllowSelectorSettings, IAllowCallBack, IAllowToGPALObject<Selector>, IAllowImageSettings

Properties

Browser

Browser associated with this selector.

Declaration
public Browser Browser { get; }
Property Value
Type Description
Browser

The browser used

DeltaX

Drag-and-drop deltaX to move from the elemenet.X + OffsetX

Declaration
public int DeltaX { get; }
Property Value
Type Description
System.Int32

X delta

DeltaY

Drag-and-drop deltaY to move from the elemenet.Y + OffsetY

Declaration
public int DeltaY { get; }
Property Value
Type Description
System.Int32

Y delta

ElementsFoundAndMatchedCount

Count of elements found for this selector (after match)

Declaration
public int ElementsFoundAndMatchedCount { get; }
Property Value
Type Description
System.Int32

ImageOffsetX

X offset from the top left corner to interact with the IMG element. also used as the starting spot for a drap and drop

Declaration
public int ImageOffsetX { get; }
Property Value
Type Description
System.Int32

X offset.

ImageOffsetY

Y offset fromm the top left corner to interact with the IMG element. also used as the starting spot for a drap and drop

Declaration
public int ImageOffsetY { get; }
Property Value
Type Description
System.Int32

Y offset.

InteractionType

Defined method to interact with this element.
NOTE: This can be overridden in the workflow.

Declaration
public Enums.InteractionType InteractionType { get; }
Property Value
Type Description
Enums.InteractionType

Hardware, JavaScript, Selenium

IsIFrame

Is this element an iframe?

Declaration
public bool IsIFrame { get; }
Property Value
Type Description
System.Boolean

True if this selector is an iframe,
False [default] if not.

IsShadowDom

Is this element a shadow dom root?

Declaration
public bool IsShadowDom { get; }
Property Value
Type Description
System.Boolean

True if this selector is a shadow dom root,
False [default] if not.

Name

The name you gave this selector, or one assigned by GPAL [selector1, selector2...]
Used in Information and Exception channel messages.
Also used as column headers when saving to a file.

Declaration
public string Name { get; }
Property Value
Type Description
System.String

The name of the selector.

OffsetX

X offset from the top left corner to interact with the element. Also used in drag-and-drop as the deltaX to move from the ImageOffsetX

Declaration
public int OffsetX { get; }
Property Value
Type Description
System.Int32

X offset.

OffsetY

Y offset fromm the top left corner to interact with the element. Also used in drag-and-drop as the deltaY to move from the ImageOffsetY

Declaration
public int OffsetY { get; }
Property Value
Type Description
System.Int32

Y offset.

SearchForSelector

Search for elements on the page.

Declaration
public bool SearchForSelector { get; }
Property Value
Type Description
System.Boolean

True to search for the element/image
False to just look on the current page.

SelectorPath

Returns the first defined selector path string

Declaration
public string SelectorPath { get; }
Property Value
Type Description
System.String

SelectorPaths

The selector paths defined to locate elements.

Declaration
public List<SelectorSettings.SelectorPathEntry> SelectorPaths { get; }
Property Value
Type Description
System.Collections.Generic.List<SelectorSettings.SelectorPathEntry>

The selector paths defined to locate elements

SelectorSettings

Declaration
public SelectorSettings SelectorSettings { get; }
Property Value
Type Description
SelectorSettings

SimulateMouse

Simulate moving the mouse to interact with this element?

Declaration
public bool SimulateMouse { get; }
Property Value
Type Description
System.Boolean

True to move the mouse to elements.
False [default] jump the mouse to elements.

StopOnNotFound

Stop the workflow if no elements are found for this selector.

Declaration
public bool StopOnNotFound { get; }
Property Value
Type Description
System.Boolean

True to stop the workflow.
False [default] continue the workflow.

WebSelectorFoundResults

Declaration
public List<GPALElement> WebSelectorFoundResults { get; set; }
Property Value
Type Description
System.Collections.Generic.List<GPALElement>

WebSelectorMatchedResults

Declaration
public List<GPALElement> WebSelectorMatchedResults { get; set; }
Property Value
Type Description
System.Collections.Generic.List<GPALElement>

WithHardware

Interact with this element using hardware emulation.

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

Fluent interface to define the selector more

WithJavascript

Declaration
[Obsolete("This method is not preferred. Consider using WithJavaScript instead.", false)]
public IAllowSelectorSettings WithJavascript { get; }
Property Value
Type Description
IAllowSelectorSettings

WithJavaScript

Interact with this element using javascript injected into the page.

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

Fluent interface to define the selector more

WithSelenium

Interact with this element using Selenium [default].

Declaration
public IAllowSelectorSettings WithSelenium { get; }
Property Value
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

Methods

CallIfFound(Browser.CallIfDelegate)

Declaration
public IAllowSelectorSettings CallIfFound(Browser.CallIfDelegate callIfFound)
Parameters
Type Name Description
Browser.CallIfDelegate callIfFound
Returns
Type Description
IAllowSelectorSettings

CallIfNotFound(Browser.CallIfDelegate)

Declaration
public IAllowSelectorSettings CallIfNotFound(Browser.CallIfDelegate callIfNotFound)
Parameters
Type Name Description
Browser.CallIfDelegate callIfNotFound
Returns
Type Description
IAllowSelectorSettings

MatchAttribute(String)

Found elements must have attribute supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchAttribute(string textToMatch)
Parameters
Type Name Description
System.String textToMatch

text to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchAttributeRegex(String)

Found elements must have the attribute specified by regular expression in order to interact with them.

Declaration
public IAllowSelectorSettings MatchAttributeRegex(string textToMatch)
Parameters
Type Name Description
System.String textToMatch

text to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchFunction(Selector.appMatchingFunction)

Your custom application element matching function to examine found elements and return only those you 'match'

Declaration
public IAllowSelectorSettings MatchFunction(Selector.appMatchingFunction matchingFunction)
Parameters
Type Name Description
Selector.appMatchingFunction matchingFunction

Your matching function

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchFunction(Selector.webMatchingFunction)

Your custom web element matching function to examine found elements and return only those you 'match'

Declaration
public IAllowSelectorSettings MatchFunction(Selector.webMatchingFunction matchingFunction)
Parameters
Type Name Description
Selector.webMatchingFunction matchingFunction

Your matching function

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchHRef(String)

Found elements must match the HRef supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchHRef(string hrefToMatch)
Parameters
Type Name Description
System.String hrefToMatch

HRef to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchHRefRegex(String)

Found elements must match the HRef regular expression supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchHRefRegex(string hrefToMatch)
Parameters
Type Name Description
System.String hrefToMatch

HRef to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchPlaceholder(String)

Found elements must match the placeholder supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchPlaceholder(string placeholderToMatch)
Parameters
Type Name Description
System.String placeholderToMatch

Placeholder to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchPlaceholderRegex(String)

Found elements must match the placeholder regular expression supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchPlaceholderRegex(string placeholderToMatch)
Parameters
Type Name Description
System.String placeholderToMatch
Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchSrc(String)

Found elements must match the src supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchSrc(string srcToMatch)
Parameters
Type Name Description
System.String srcToMatch

Src to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchSrcRegex(String)

Found elements must match the src regular expression supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchSrcRegex(string srcToMatch)
Parameters
Type Name Description
System.String srcToMatch

Src to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchText(String)

Found elements must match the text supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchText(string textToMatch)
Parameters
Type Name Description
System.String textToMatch

Text to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchTextRegex(String)

Found elements must match the text regular expression supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchTextRegex(string textToMatch)
Parameters
Type Name Description
System.String textToMatch

Text to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchValue(String)

Found elements must match the value supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchValue(string valueToMatch)
Parameters
Type Name Description
System.String valueToMatch

Value to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

MatchValueRegex(String)

Found elements must match the value regular expression supplied in order to interact with them.

Declaration
public IAllowSelectorSettings MatchValueRegex(string valueToMatch)
Parameters
Type Name Description
System.String valueToMatch

Value to match

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

Remove()

Remove this selector from the current Unit of Work.

Declaration
public void Remove()

ToGPALObject()

Declaration
public Selector ToGPALObject()
Returns
Type Description
Selector

UseAttribute(String)

Declaration
public IAllowSelectorSettings UseAttribute(string attributeName)
Parameters
Type Name Description
System.String attributeName
Returns
Type Description
IAllowSelectorSettings

WithAutomationID(String)

Define Name used to find elements by name attribute.
Application only.

Declaration
public IAllowSelectorSettings WithAutomationID(string automationID)
Parameters
Type Name Description
System.String automationID
Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithClassName(String)

Define Name used to find elements by name attribute.
Application only.

Declaration
public IAllowSelectorSettings WithClassName(string className)
Parameters
Type Name Description
System.String className
Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithCSS(String)

Define CSS used to find elements.
Browser only.

Declaration
public IAllowSelectorSettings WithCSS(string css)
Parameters
Type Name Description
System.String css

The CSS

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithDeltaX(Int32)

Define the x offset from the Top Left corner to perform clicks.

Declaration
public IAllowSelectorSettings WithDeltaX(int deltaX)
Parameters
Type Name Description
System.Int32 deltaX
Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithDeltaY(Int32)

Define the y offset from the Top Left corner to perform clicks.

Declaration
public IAllowSelectorSettings WithDeltaY(int deltaY)
Parameters
Type Name Description
System.Int32 deltaY
Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithHRef(String)

Declaration
public IAllowSelectorSettings WithHRef(string HRefFullOrPartial)
Parameters
Type Name Description
System.String HRefFullOrPartial
Returns
Type Description
IAllowSelectorSettings

WithImage(IGPALFile)

Define an image to match on-screen.
The top left corner is used as the start of the element.
Image matching forces hardware interaction with this element.

Declaration
public IAllowImageSettings WithImage(IGPALFile imageToFindPath)
Parameters
Type Name Description
IGPALFile imageToFindPath
Returns
Type Description
IAllowImageSettings

Fluent interface to define the selector more

WithImage(Image)

Define an image to match on-screen.
The top left corner is used as the start of the element.
Image matching forces hardware interaction with this element.

Declaration
public IAllowImageSettings WithImage(Image image)
Parameters
Type Name Description
System.Drawing.Image image

The image to match

Returns
Type Description
IAllowImageSettings

Fluent interface to define the selector more

WithImage(String)

Define an image to match on-screen.
The top left corner is used as the start of the element.
Image matching forces hardware interaction with this element.

Declaration
public IAllowImageSettings WithImage(string base64String)
Parameters
Type Name Description
System.String base64String
Returns
Type Description
IAllowImageSettings

Fluent interface to define the selector more

WithImageOffsetX(Int32)

Define the x offset from the Top Left corner to perform clicks.

Declaration
public IAllowImageSettings WithImageOffsetX(int offsetX)
Parameters
Type Name Description
System.Int32 offsetX

X offset

Returns
Type Description
IAllowImageSettings

Fluent interface to define the selector more

WithImageOffsetY(Int32)

Define the y offset from the Top Left corner to perform clicks.

Declaration
public IAllowImageSettings WithImageOffsetY(int offsetY)
Parameters
Type Name Description
System.Int32 offsetY

Y offset

Returns
Type Description
IAllowImageSettings

Fluent interface to define the selector more

WithName(String)

Define Name used to find elements by name attribute.
Application only.

Declaration
public IAllowSelectorSettings WithName(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithOCR(String)

Use OCR to find the text on-screen.

Declaration
public IAllowSelectorSettings WithOCR(string textToFind)
Parameters
Type Name Description
System.String textToFind

Text to find

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithOffsetX(Int32)

Define the x offset from the Top Left corner to perform clicks.

Declaration
public IAllowSelectorSettings WithOffsetX(int offsetX)
Parameters
Type Name Description
System.Int32 offsetX

X offset

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithOffsetY(Int32)

Define the y offset from the Top Left corner to perform clicks.

Declaration
public IAllowSelectorSettings WithOffsetY(int offsetY)
Parameters
Type Name Description
System.Int32 offsetY

Y offset

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithSearchForSelector(Boolean)

Search for a matching image when using hardware emulation or image matching.
Finding an element on page involves scrolling down the page (sending Page Down key presses).

Declaration
public IAllowImageSettings WithSearchForSelector(bool searchForElement)
Parameters
Type Name Description
System.Boolean searchForElement

True to search for the element/image
False to just look on the current page.

Returns
Type Description
IAllowImageSettings

Fluent interface to define the selector more

WithSelectorName(String)

A common name for this selector.
Used in Information and Exception channel messages.

Declaration
public IAllowSelectorSettings WithSelectorName(string name)
Parameters
Type Name Description
System.String name

The selector name

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithSimulateMouse(Boolean)

Simulate a human moving the mouse when interacting with this element.

Declaration
public IAllowSelectorSettings WithSimulateMouse(bool moveWithArc)
Parameters
Type Name Description
System.Boolean moveWithArc

True to move the mouse to the element.
False [default] jump the mouse to the element.

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithStopOnNotFound(Boolean)

Stop the workflow if this selector is not found.

Declaration
public IAllowSelectorSettings WithStopOnNotFound(bool stopOnNotFound)
Parameters
Type Name Description
System.Boolean stopOnNotFound

True to stop the workflow.
False [default] continue the workflow.

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithText(String)

Define Text used to find elements by text attribute.
Browser only.

Declaration
public IAllowSelectorSettings WithText(string text)
Parameters
Type Name Description
System.String text

The text

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithValue(String)

Define Value used to find elements by value attribute.
Browser only.

Declaration
public IAllowSelectorSettings WithValue(string value)
Parameters
Type Name Description
System.String value

The value

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

WithXPath(String)

Define XPath used to find elements
Both.

Declaration
public IAllowSelectorSettings WithXPath(string xPath)
Parameters
Type Name Description
System.String xPath

The XPath

Returns
Type Description
IAllowSelectorSettings

Fluent interface to define the selector more

Implements

IAllowSelectorSettings
IAllowCallBack
IAllowToGPALObject<TResult>
IAllowImageSettings
In This Article
Back to top Generated by DocFX