Show / Hide Table of Contents

Class ElementDescription

Describes how to identify an test object by its attributes, like Id, Name, XPath and any conbinations of them. WebEngine Framework can localize test object with multiple attributes. For web application testing, use the derived class WebElementDescription

Inheritance
Object
ElementDescription
AppElementDescription
WebElementDescription
Namespace: AxaFrance.WebEngine.Web
Assembly: AxaFrance.WebEngine.Web.dll
Syntax
public abstract class ElementDescription

Fields

| Edit this page View Source

driver

WebDriver used to identify test objects.

Declaration
protected WebDriver driver
Field Value
Type Description
WebDriver

Properties

| Edit this page View Source

IsDisplayed

Check if The WebElement is displayed on the screen (In the current viewport or not)

Declaration
public bool IsDisplayed { get; }
Property Value
Type Description
Boolean

True if the element exists and is displayed. False if the element exsits but not displayed. OpenQA.Selenium.NoSuchElementException if the element can't be find in the DOM.

Remarks

If it is required to perform actions on non-displayed element, please bring the element into view before the action, using ScrollIntoView method.

| Edit this page View Source

IsEnabled

Get the value indicating whether the current element is enabled.

Declaration
public bool IsEnabled { get; }
Property Value
Type Description
Boolean

True if the element is enabled, otherwise: False

| Edit this page View Source

IsSelected

Check if the WebElement is selected. Applies only on checkboxes, options in a select element and radio buttons

Declaration
public bool IsSelected { get; }
Property Value
Type Description
Boolean

True is the element is selected, otherwise, false

| Edit this page View Source

Value

Get the Value attribute of the current web element (For Input text box for example)

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

Methods

| Edit this page View Source

ApplyAttribute(FindsByAttribute)

Applies the locator defined in FindsByAttribute. this function is called automatically before InternalFindElements()

Declaration
public abstract void ApplyAttribute(FindsByAttribute attr)
Parameters
Type Name Description
FindsByAttribute attr
| Edit this page View Source

Clear()

Clear the content of the current web element. (for text-box and text areas)

Declaration
public void Clear()
| Edit this page View Source

Click()

Click on Web element.

Declaration
public void Click()
| Edit this page View Source

Exists()

Check if the given element exists on the screen

Declaration
public bool Exists()
Returns
Type Description
Boolean

true if the element exists, otherwise: false

| Edit this page View Source

Exists(Int32)

Check if the given element exists on the screen, with given sychronization timeout.

Declaration
public bool Exists(int timeoutSecond)
Parameters
Type Name Description
Int32 timeoutSecond

object synchronization timeout in second.

Returns
Type Description
Boolean

True is the element exists in the current web page, Otherwise False

| Edit this page View Source

FindElement()

Gets The IWebElement with current element description, using default timeout

Declaration
public IWebElement FindElement()
Returns
Type Description
IWebElement

The Web element localized by the description.

Remarks

Default timeout is

| Edit this page View Source

FindElement(By)

Find a sub-element of the current element, with default synchronization timeout.

Declaration
public IWebElement FindElement(By by)
Parameters
Type Name Description
By by

Mecanism of find sub-elements

Returns
Type Description
IWebElement

The indentified web element.

| Edit this page View Source

FindElement(By, Int32)

Find the first element within the context of the current element. with provided synchronization timeout

Declaration
public IWebElement FindElement(By by, int timeoutSecond)
Parameters
Type Name Description
By by

Mecanism of find elements.

Int32 timeoutSecond

synchronization timeout in second.

Returns
Type Description
IWebElement
| Edit this page View Source

FindElement(Int32)

Gets the Web Element using curent element description, with customized timeout.

Declaration
public IWebElement FindElement(int timeoutSecond)
Parameters
Type Name Description
Int32 timeoutSecond

object syncchronization timeout in second.

Returns
Type Description
IWebElement

The indentified web element.

| Edit this page View Source

FindElements()

This method find all possible elements given the current selection criteria. If there is no element match an OpenQA.Selenium.NoSuchElementException will be thrown

Declaration
public IReadOnlyCollection<IWebElement> FindElements()
Returns
Type Description
IReadOnlyCollection<IWebElement>

A collection of OpenQA.Selenium.IWebElement matches the element selection criteria

| Edit this page View Source

FindElements(By)

Find elements within the context of the current element.

Declaration
public IReadOnlyCollection<IWebElement> FindElements(By by)
Parameters
Type Name Description
By by

Mecanism of find elements

Returns
Type Description
IReadOnlyCollection<IWebElement>
| Edit this page View Source

FindElements(Int32)

This method find all possible elements given the current selection criteria. If there is no element match an OpenQA.Selenium.NoSuchElementException will be thrown

Declaration
public IReadOnlyCollection<IWebElement> FindElements(int timeoutSecond)
Parameters
Type Name Description
Int32 timeoutSecond

Timeout in seconds

Returns
Type Description
IReadOnlyCollection<IWebElement>

A collection of OpenQA.Selenium.IWebElement matches the element selection criteria

| Edit this page View Source

GetAttribute(String)

Get the value of the specified DOM attribute of this element.

Declaration
public string GetAttribute(string attributeName)
Parameters
Type Name Description
String attributeName

the name of Html DOM attribute.

Returns
Type Description
String

The value of the indicated attribute.

| Edit this page View Source

GetProperty(String)

Get the value of the specified DOM property of this element. for example GetProperty("value") will get the current value of a textbox

Declaration
public string GetProperty(string propertyName)
Parameters
Type Name Description
String propertyName

the name of Html Property.

Returns
Type Description
String

The value of the indicated attribute.

| Edit this page View Source

GetScreenshot()

Generates an screenshot of this specific element

Declaration
public byte[] GetScreenshot()
Returns
Type Description
Byte[]

The screenshot image in RAW Binary data format.

| Edit this page View Source

GetText()

Get the Text attribute of the current web element.

Declaration
public string GetText()
Returns
Type Description
String

The Text of the current web element

| Edit this page View Source

InternalClick()

Default behavior of Click

Declaration
protected virtual void InternalClick()
| Edit this page View Source

InternalFindElement()

Implemente element identifying algorithm, without the need of object synchronization.

Declaration
protected abstract IWebElement InternalFindElement()
Returns
Type Description
IWebElement

Identified test object.

| Edit this page View Source

InternalFindElements()

Implemente element identifying algorithm, without the need of object synchronization.

Declaration
protected abstract IReadOnlyCollection<IWebElement> InternalFindElements()
Returns
Type Description
IReadOnlyCollection<IWebElement>

Identified test objects

| Edit this page View Source

InternalGetScreenshot()

Implemente screenshot generation for the current specific element

Declaration
protected abstract byte[] InternalGetScreenshot()
Returns
Type Description
Byte[]

The screenshot image in RAW Binary data format.

| Edit this page View Source

Perform(Action)

Perform a secured action that may be influnced by web application reload behavoirs to avoid errors, such as OpenQA.Selenium.StaleElementReferenceException

Declaration
protected void Perform(Action action)
Parameters
Type Name Description
Action action

The action to be performed. The name of the method

| Edit this page View Source

Perform(Action<Int32>, Int32)

Perform a secured action that may be influnced by web application reload behavoirs to avoid errors, such as OpenQA.Selenium.StaleElementReferenceException

Declaration
protected void Perform(Action<int> action, int param)
Parameters
Type Name Description
Action<Int32> action

The action to be performed. The name of the method

Int32 param

The parameter of the delegated method

| Edit this page View Source

Perform(Action<String>, String)

Perform a secured action that may be influnced by web application reload behavoirs to avoid errors, such as OpenQA.Selenium.StaleElementReferenceException

Declaration
protected void Perform(Action<string> action, string param)
Parameters
Type Name Description
Action<String> action

The action to be performed. The name of the method

String param

The parameter of the delegated method

| Edit this page View Source

Perform(Func<Boolean>)

Perform a secured action that may be influnced by web application reload behavoirs to avoid errors, such as OpenQA.Selenium.StaleElementReferenceException

Declaration
protected bool Perform(Func<bool> action)
Parameters
Type Name Description
Func<Boolean> action

The action to be performed. The name of the method

Returns
Type Description
Boolean

value returned by underlying method

| Edit this page View Source

Perform(Func<Byte[]>)

Perform an action which returns an screenshot of the given element or context

Declaration
protected byte[] Perform(Func<byte[]> action)
Parameters
Type Name Description
Func<Byte[]> action

Delegation which returns an screenshot

Returns
Type Description
Byte[]

A screenshot of given element or context.

| Edit this page View Source

Perform(Func<String, IWebElement>, String)

Perform a secured action that may be influnced by web application reload behavoirs to avoid errors, such as OpenQA.Selenium.StaleElementReferenceException

Declaration
protected IWebElement Perform(Func<string, IWebElement> action, string param)
Parameters
Type Name Description
Func<String, IWebElement> action

The action to be performed. The name of the method

String param

The parameter of the action.

Returns
Type Description
IWebElement
| Edit this page View Source

Perform(Func<String, String>, String)

Perform a secured action that may be influnced by web application reload behavoirs to avoid errors, such as OpenQA.Selenium.StaleElementReferenceException

Declaration
protected string Perform(Func<string, string> action, string param)
Parameters
Type Name Description
Func<String, String> action

The action to be performed. The name of the method

String param

The parameter of the delegated method

Returns
Type Description
String

value returned by underlying method

| Edit this page View Source

Perform(Func<String>)

Perform a secured action that may be influnced by web application reload behavoirs to avoid errors, such as OpenQA.Selenium.StaleElementReferenceException

Declaration
protected string Perform(Func<string> action)
Parameters
Type Name Description
Func<String> action

The action to be performed. The name of the method

Returns
Type Description
String

value returned by underlying method

| Edit this page View Source

SendKeys(String)

Send keys (text) to the current web element. (for textbox or text areas). Sendkeys does not clear the current value in the textbox or text areas. The text will be inserted according to the cursor location. If you want to ensure the textbox contains exactly the value you want to set, use the function SetValue(String)

Declaration
public void SendKeys(string text)
Parameters
Type Name Description
String text

the text to send

| Edit this page View Source

SetValue(String)

Set the value of the current web element. For textbox or text areas. SetValue clears existing value in the textbox or text area before input the text in it. If you want to append or insert the text without clearing current value, use the function SendKeys(String)

Declaration
public void SetValue(string text)
Parameters
Type Name Description
String text

The text to set.

| Edit this page View Source

UseDriver(WebDriver)

Sets the Selenium WebDriver to use for object indentification. If the WebElement is declared within a PageModel there is no need to apply the WebDriver to use.

Declaration
public ElementDescription UseDriver(WebDriver driver)
Parameters
Type Name Description
WebDriver driver

WebDriver to be used to locate objects

Returns
Type Description
ElementDescription
  • Edit this page
  • View Source
In this article
Back to top Copyright ® 2016-2024 AXA France, All rights reserved.