GPAL - Generally Positive Automation Library v1.0
GPAL The Fluent Automation LIbrary
Loading...
Searching...
No Matches
GenerallyPositive.GPALElement Class Reference

Pseudo element used in Applications and Browser workflows for image matching and unified automation. Implements IGPALElement and mimics IWebElement where possible. More...

Inheritance diagram for GenerallyPositive.GPALElement:
GenerallyPositive.IGPALElement

Public Member Functions

void Clear ()
 Clears the element's value (if supported by underlying element).
void Click (ModifierKeys modifierKeys)
 Performs a click with optional keyboard modifiers.
void Click ()
 Performs a standard left click.
void MiddleClick (ModifierKeys modifierKeys=ModifierKeys.NONE)
 Performs a middle mouse button click.
void Hide ()
 Hides the element via JavaScript (sets display:none).
IWebElement FindElement (By by)
 Finds a child element using Selenium By locator.
ReadOnlyCollection< IWebElement > FindElements (By by)
 Finds all child elements using Selenium By locator.
string GetAttribute (string attributeName)
 Gets an attribute value with fallback to internal dictionary.
void SetAttribute (string attributeName, string value)
 Directly sets a DOM attribute on this element via element.setAttribute(attributeName, value), using OttoMagic, Puppeteer or JavaScript depending on the active engine. Hardware automation has no equivalent operation, so it falls back to whichever of Selenium/JavaScript or Puppeteer is configured. See Browser.IAllowSetAttributeValue.SetAttribute for the distinction between this and SendString/FillIn*.
string GetCssValue (string propertyName)
 Gets a computed CSS value.
string GetDomAttribute (string attributeName)
 Gets a DOM attribute.
string GetDomProperty (string propertyName)
 Gets a DOM property.
ISearchContext GetShadowRoot ()
 Returns the ShadowRoot if available.
void SendKeys (string text)
 Sends keystrokes to the element.
void Submit ()
 Submits the form if the element is part of one.
bool IsDisabled ()
 Checks if the element is disabled via attributes or properties.
bool IsEnabled ()
 Checks if the element is enabled.
bool IsClickable (bool publishEvent=true)
 Determines whether the element appears clickable based on visibility, disabled state, and CSS.
async Task DisposeAsync ()
 Asynchronously releases resources (especially Puppeteer object handles).
void Dispose ()
 Disposes the element (fire-and-forget async cleanup).

Properties

Browser.Browser Browser [get, set]
 Associated Browser instance.
GPALElement ShadowRoot [get, set]
 Shadow root if the element contains one.
Dictionary< string, object > Attributes = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase) [get, set]
 All raw attributes returned from the automation backend.
Dictionary< string, object > CssAttributes [get, set]
 CSS computed style properties for the element.
Dictionary< string, object > DomAttributes [get, set]
 DOM attributes of the element.
Dictionary< string, object > DomProperties [get, set]
 DOM properties of the element.
IWebDriver WrappedDriver [get, set]
 The underlying Selenium WebDriver instance.
dynamic WebElement [get, set]
 The wrapped Selenium IWebElement or internal dynamic element.
string ElementHandle [get, set]
int ElementNodeId [get, set]
int ElementBackendNodeId [get, set]
Selector Selector [get, set]
 Selector used to locate this element.
string Name [get, set]
 Name attribute of the element.
string AttributeName [get, set]
 Custom attribute name (used internally).
string TagName [get, set]
 HTML tag name of the element.
string Text [get, set]
 Visible text content of the element.
bool Enabled [get, set]
 Whether the element is enabled.
bool Selected [get, set]
 Whether the element is selected (e.g. checkboxes, radio buttons).
Point Location [get, set]
 Screen coordinates of the element.
Size Size [get, set]
 Dimensions of the element.
bool Displayed [get, set]
 Whether the element is visible on the page.
string Href [get, set]
 href attribute (for links).
string Src [get, set]
 src attribute (for images, scripts, etc.).
string Value [get, set]
 value attribute (inputs, textareas, etc.).
string Placeholder [get, set]
 placeholder attribute.
string Xpath [get, set]
 XPath used to locate this element.
XPathInfo[] Xpaths [get, set]
 Array of alternative XPaths with match counts.
string Css [get, set]
 CSS selector used to locate this element.
string FullXPath [get, set]
 Full absolute XPath.
ClientRectangle BoundingRect [get, set]
 Client bounding rectangle with detailed coordinates.
string PageURL [get, set]
 Current page URL when the element was captured.
string Type [get, set]
 The type of the element, for input, this can be many.

Detailed Description

Pseudo element used in Applications and Browser workflows for image matching and unified automation. Implements IGPALElement and mimics IWebElement where possible.

No methods are implemented on image-only elements. Use this primarily for debugging and image-based actions.

Key properties that are actually used: Location, Size, Text, TagName, WrappedDriver.

Definition at line 142 of file GPALElement.cs.

Member Function Documentation

◆ Clear()

void GenerallyPositive.GPALElement.Clear ( )

Clears the element's value (if supported by underlying element).

Implements GenerallyPositive.IGPALElement.

Definition at line 567 of file GPALElement.cs.

◆ Click() [1/2]

void GenerallyPositive.GPALElement.Click ( )

Performs a standard left click.

Implements GenerallyPositive.IGPALElement.

Definition at line 593 of file GPALElement.cs.

◆ Click() [2/2]

void GenerallyPositive.GPALElement.Click ( ModifierKeys modifierKeys)

Performs a click with optional keyboard modifiers.

Implements GenerallyPositive.IGPALElement.

Definition at line 578 of file GPALElement.cs.

◆ Dispose()

void GenerallyPositive.GPALElement.Dispose ( )

Disposes the element (fire-and-forget async cleanup).

Definition at line 808 of file GPALElement.cs.

◆ DisposeAsync()

async Task GenerallyPositive.GPALElement.DisposeAsync ( )

Asynchronously releases resources (especially Puppeteer object handles).

Definition at line 783 of file GPALElement.cs.

◆ FindElement()

IWebElement GenerallyPositive.GPALElement.FindElement ( By by)

Finds a child element using Selenium By locator.

Definition at line 615 of file GPALElement.cs.

◆ FindElements()

ReadOnlyCollection< IWebElement > GenerallyPositive.GPALElement.FindElements ( By by)

Finds all child elements using Selenium By locator.

Definition at line 623 of file GPALElement.cs.

◆ GetAttribute()

string GenerallyPositive.GPALElement.GetAttribute ( string attributeName)

Gets an attribute value with fallback to internal dictionary.

Implements GenerallyPositive.IGPALElement.

Definition at line 631 of file GPALElement.cs.

◆ GetCssValue()

string GenerallyPositive.GPALElement.GetCssValue ( string propertyName)

Gets a computed CSS value.

Implements GenerallyPositive.IGPALElement.

Definition at line 678 of file GPALElement.cs.

◆ GetDomAttribute()

string GenerallyPositive.GPALElement.GetDomAttribute ( string attributeName)

Gets a DOM attribute.

Implements GenerallyPositive.IGPALElement.

Definition at line 684 of file GPALElement.cs.

◆ GetDomProperty()

string GenerallyPositive.GPALElement.GetDomProperty ( string propertyName)

Gets a DOM property.

Implements GenerallyPositive.IGPALElement.

Definition at line 690 of file GPALElement.cs.

◆ GetShadowRoot()

ISearchContext GenerallyPositive.GPALElement.GetShadowRoot ( )

Returns the ShadowRoot if available.

Definition at line 696 of file GPALElement.cs.

◆ Hide()

void GenerallyPositive.GPALElement.Hide ( )

Hides the element via JavaScript (sets display:none).

Implements GenerallyPositive.IGPALElement.

Definition at line 608 of file GPALElement.cs.

◆ IsClickable()

bool GenerallyPositive.GPALElement.IsClickable ( bool publishEvent = true)

Determines whether the element appears clickable based on visibility, disabled state, and CSS.

Parameters
publishEventWhether to log a warning if not clickable.

Implements GenerallyPositive.IGPALElement.

Definition at line 740 of file GPALElement.cs.

◆ IsDisabled()

bool GenerallyPositive.GPALElement.IsDisabled ( )

Checks if the element is disabled via attributes or properties.

Implements GenerallyPositive.IGPALElement.

Definition at line 719 of file GPALElement.cs.

◆ IsEnabled()

bool GenerallyPositive.GPALElement.IsEnabled ( )

Checks if the element is enabled.

Implements GenerallyPositive.IGPALElement.

Definition at line 731 of file GPALElement.cs.

◆ MiddleClick()

void GenerallyPositive.GPALElement.MiddleClick ( ModifierKeys modifierKeys = ModifierKeys::NONE)

Performs a middle mouse button click.

Implements GenerallyPositive.IGPALElement.

Definition at line 599 of file GPALElement.cs.

◆ SendKeys()

void GenerallyPositive.GPALElement.SendKeys ( string text)

Sends keystrokes to the element.

Implements GenerallyPositive.IGPALElement.

Definition at line 705 of file GPALElement.cs.

◆ SetAttribute()

void GenerallyPositive.GPALElement.SetAttribute ( string attributeName,
string value )

Directly sets a DOM attribute on this element via element.setAttribute(attributeName, value), using OttoMagic, Puppeteer or JavaScript depending on the active engine. Hardware automation has no equivalent operation, so it falls back to whichever of Selenium/JavaScript or Puppeteer is configured. See Browser.IAllowSetAttributeValue.SetAttribute for the distinction between this and SendString/FillIn*.

Parameters
attributeNameName of the attribute to set (e.g. "disabled", "value", "data-foo")
valueValue to assign to the attribute

Implements GenerallyPositive.IGPALElement.

Definition at line 672 of file GPALElement.cs.

◆ Submit()

void GenerallyPositive.GPALElement.Submit ( )

Submits the form if the element is part of one.

Implements GenerallyPositive.IGPALElement.

Definition at line 712 of file GPALElement.cs.

Property Documentation

◆ AttributeName

string GenerallyPositive.GPALElement.AttributeName
getset

Custom attribute name (used internally).

Implements GenerallyPositive.IGPALElement.

Definition at line 288 of file GPALElement.cs.

◆ Attributes

Dictionary<string, object> GenerallyPositive.GPALElement.Attributes = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
getset

All raw attributes returned from the automation backend.

Implements GenerallyPositive.IGPALElement.

Definition at line 157 of file GPALElement.cs.

◆ BoundingRect

ClientRectangle GenerallyPositive.GPALElement.BoundingRect
getset

Client bounding rectangle with detailed coordinates.

Implements GenerallyPositive.IGPALElement.

Definition at line 433 of file GPALElement.cs.

◆ Browser

Browser.Browser GenerallyPositive.GPALElement.Browser
getset

Associated Browser instance.

Definition at line 147 of file GPALElement.cs.

◆ Css

string GenerallyPositive.GPALElement.Css
getset

CSS selector used to locate this element.

Implements GenerallyPositive.IGPALElement.

Definition at line 419 of file GPALElement.cs.

◆ CssAttributes

Dictionary<string, object> GenerallyPositive.GPALElement.CssAttributes
getset

CSS computed style properties for the element.

Implements GenerallyPositive.IGPALElement.

Definition at line 163 of file GPALElement.cs.

◆ Displayed

bool GenerallyPositive.GPALElement.Displayed
getset

Whether the element is visible on the page.

Implements GenerallyPositive.IGPALElement.

Definition at line 347 of file GPALElement.cs.

◆ DomAttributes

Dictionary<string, object> GenerallyPositive.GPALElement.DomAttributes
getset

DOM attributes of the element.

Implements GenerallyPositive.IGPALElement.

Definition at line 192 of file GPALElement.cs.

◆ DomProperties

Dictionary<string, object> GenerallyPositive.GPALElement.DomProperties
getset

DOM properties of the element.

Implements GenerallyPositive.IGPALElement.

Definition at line 221 of file GPALElement.cs.

◆ ElementBackendNodeId

int GenerallyPositive.GPALElement.ElementBackendNodeId
getset

Definition at line 263 of file GPALElement.cs.

◆ ElementHandle

string GenerallyPositive.GPALElement.ElementHandle
getset

Definition at line 261 of file GPALElement.cs.

◆ ElementNodeId

int GenerallyPositive.GPALElement.ElementNodeId
getset

Definition at line 262 of file GPALElement.cs.

◆ Enabled

bool GenerallyPositive.GPALElement.Enabled
getset

Whether the element is enabled.

Implements GenerallyPositive.IGPALElement.

Definition at line 309 of file GPALElement.cs.

◆ FullXPath

string GenerallyPositive.GPALElement.FullXPath
getset

Full absolute XPath.

Implements GenerallyPositive.IGPALElement.

Definition at line 426 of file GPALElement.cs.

◆ Href

string GenerallyPositive.GPALElement.Href
getset

href attribute (for links).

Implements GenerallyPositive.IGPALElement.

Definition at line 374 of file GPALElement.cs.

◆ Location

Point GenerallyPositive.GPALElement.Location
getset

Screen coordinates of the element.

Implements GenerallyPositive.IGPALElement.

Definition at line 323 of file GPALElement.cs.

◆ Name

string GenerallyPositive.GPALElement.Name
getset

Name attribute of the element.

Definition at line 281 of file GPALElement.cs.

◆ PageURL

string GenerallyPositive.GPALElement.PageURL
getset

Current page URL when the element was captured.

Implements GenerallyPositive.IGPALElement.

Definition at line 440 of file GPALElement.cs.

◆ Placeholder

string GenerallyPositive.GPALElement.Placeholder
getset

placeholder attribute.

Implements GenerallyPositive.IGPALElement.

Definition at line 395 of file GPALElement.cs.

◆ Selected

bool GenerallyPositive.GPALElement.Selected
getset

Whether the element is selected (e.g. checkboxes, radio buttons).

Implements GenerallyPositive.IGPALElement.

Definition at line 316 of file GPALElement.cs.

◆ Selector

Selector GenerallyPositive.GPALElement.Selector
getset

Selector used to locate this element.

Definition at line 276 of file GPALElement.cs.

◆ ShadowRoot

GPALElement GenerallyPositive.GPALElement.ShadowRoot
getset

Shadow root if the element contains one.

Implements GenerallyPositive.IGPALElement.

Definition at line 152 of file GPALElement.cs.

◆ Size

Size GenerallyPositive.GPALElement.Size
getset

Dimensions of the element.

Implements GenerallyPositive.IGPALElement.

Definition at line 340 of file GPALElement.cs.

◆ Src

string GenerallyPositive.GPALElement.Src
getset

src attribute (for images, scripts, etc.).

Implements GenerallyPositive.IGPALElement.

Definition at line 381 of file GPALElement.cs.

◆ TagName

string GenerallyPositive.GPALElement.TagName
getset

HTML tag name of the element.

Implements GenerallyPositive.IGPALElement.

Definition at line 295 of file GPALElement.cs.

◆ Text

string GenerallyPositive.GPALElement.Text
getset

Visible text content of the element.

Implements GenerallyPositive.IGPALElement.

Definition at line 302 of file GPALElement.cs.

◆ Type

string GenerallyPositive.GPALElement.Type
getset

The type of the element, for input, this can be many.

Definition at line 447 of file GPALElement.cs.

◆ Value

string GenerallyPositive.GPALElement.Value
getset

value attribute (inputs, textareas, etc.).

Implements GenerallyPositive.IGPALElement.

Definition at line 388 of file GPALElement.cs.

◆ WebElement

dynamic GenerallyPositive.GPALElement.WebElement
getset

The wrapped Selenium IWebElement or internal dynamic element.

Implements GenerallyPositive.IGPALElement.

Definition at line 255 of file GPALElement.cs.

◆ WrappedDriver

IWebDriver GenerallyPositive.GPALElement.WrappedDriver
getset

The underlying Selenium WebDriver instance.

Definition at line 249 of file GPALElement.cs.

◆ Xpath

string GenerallyPositive.GPALElement.Xpath
getset

XPath used to locate this element.

Implements GenerallyPositive.IGPALElement.

Definition at line 402 of file GPALElement.cs.

◆ Xpaths

XPathInfo [] GenerallyPositive.GPALElement.Xpaths
getset

Array of alternative XPaths with match counts.

Implements GenerallyPositive.IGPALElement.

Definition at line 409 of file GPALElement.cs.


The documentation for this class was generated from the following file: