C# Class TestAutomationEssentials.Selenium.BrowserElement

Represents a single DOM element in a browser
This class wraps Selenium's IWebElement to provide additional capabilities for logging, automatic waiting and more.
Inheritance: ElementsContainer, IWebElement, IWrapsElement
Mostra file Open project: arnonax/TestEssentials Class Usage Examples

Private Properties

Property Type Description
BrowserElement System
CreateActionsSequence OpenQA.Selenium.Interactions.Actions
GetParentLocator OpenQA.Selenium.By
GetWebElement IWebElement
GetWebElement IWebElement
ISearchContext IWebElement
ISearchContext ReadOnlyCollection
IWebElement string
IWebElement void
IWebElement void
IsAvailable bool
IsReady bool
SafeGetDOMRoot IDOMRoot

Public Methods

Method Description
BrowserElement ( ElementsContainer container, By by, Func selector, string description ) : System

Initializes a new instance of BrowserElement given its container, a 'By' filter a selector and description

BrowserElement ( ElementsContainer container, By by, string description ) : System

Initialized a new instance of BrowserElement given its container, a specific 'By' filter and description

Click ( ) : void
DoubleClick ( ) : void

Performs a double-click on the element

DragAndDrop ( BrowserElement target ) : void

Drags the current element onto the target element

GetAttribute ( string attributeName ) : string
GetParent ( string description ) : BrowserElement

Returns the immediate parent element containing the current element

Hover ( ) : void

Hovers the mouse over the element

WaitToDisappear ( int seconds = DefaultWaitTimeout ) : void

Waits for the current element to disappear. That is, either become invisible or completely removed from the DOM

Protected Methods

Method Description
Activate ( ) : void
BrowserElement ( BrowserElement otherElement ) : System

Copy constructor

BrowserElement ( BrowserElement otherElement, string description ) : System

Constructs a new instance of BrowserElement by copying its properties, except of its description from another element

GetSearchContext ( ) : ISearchContext

Private Methods

Method Description
BrowserElement ( IDOMRoot domRoot, Func getWebElement, string description ) : System
CreateActionsSequence ( ) : OpenQA.Selenium.Interactions.Actions
GetParentLocator ( ) : By
GetWebElement ( ) : IWebElement
GetWebElement ( ElementsContainer elementsContainer, By by, Func selector, string description ) : IWebElement
ISearchContext ( By by ) : IWebElement
ISearchContext ( By by ) : ReadOnlyCollection
IWebElement ( string propertyName ) : string
IWebElement ( ) : void
IWebElement ( string text ) : void
IsAvailable ( IWebElement el ) : bool
IsReady ( ) : bool
SafeGetDOMRoot ( ElementsContainer otherElement, string paramName ) : IDOMRoot

Method Details

Activate() protected method

protected Activate ( ) : void
return void

BrowserElement() protected method

Copy constructor
protected BrowserElement ( BrowserElement otherElement ) : System
otherElement BrowserElement Other object from which to copy the properties into the new object
return System

BrowserElement() protected method

Constructs a new instance of BrowserElement by copying its properties, except of its description from another element
is null
protected BrowserElement ( BrowserElement otherElement, string description ) : System
otherElement BrowserElement The existing element to copy its properties from
description string The new description to use for the new object
return System

BrowserElement() public method

Initializes a new instance of BrowserElement given its container, a 'By' filter a selector and description
Any of the arguments is null
public BrowserElement ( ElementsContainer container, By by, Func selector, string description ) : System
container ElementsContainer The container that contains the relevant element. Typically this is a , , or a containing
by OpenQA.Selenium.By A filter mechanism used to filter the matching elements
selector Func A delegate that is used to select the sepecific element from the filtered elements
description string The description of the new element
return System

BrowserElement() public method

Initialized a new instance of BrowserElement given its container, a specific 'By' filter and description
Any of the arguments is null
public BrowserElement ( ElementsContainer container, By by, string description ) : System
container ElementsContainer The container that contains the relevant element. Typically this is a , , or a containing
by OpenQA.Selenium.By A filter mechanism used to find the element. If multiple elements match the filter, the first one is used
description string The description of the new element
return System

Click() public method

public Click ( ) : void
return void

DoubleClick() public method

Performs a double-click on the element
public DoubleClick ( ) : void
return void

DragAndDrop() public method

Drags the current element onto the target element
is null
public DragAndDrop ( BrowserElement target ) : void
target BrowserElement The target element to drop the current element onto
return void

GetAttribute() public method

public GetAttribute ( string attributeName ) : string
attributeName string
return string

GetParent() public method

Returns the immediate parent element containing the current element
public GetParent ( string description ) : BrowserElement
description string The description to give to the parent element
return BrowserElement

GetSearchContext() protected method

protected GetSearchContext ( ) : ISearchContext
return ISearchContext

Hover() public method

Hovers the mouse over the element
public Hover ( ) : void
return void

WaitToDisappear() public method

Waits for the current element to disappear. That is, either become invisible or completely removed from the DOM
The current element hasn't been disappeared for the specified period
public WaitToDisappear ( int seconds = DefaultWaitTimeout ) : void
seconds int Timeout in seconds to wait for the element to disappear
return void