Class WebElementDescription
The Object Description how to identify the Element for Web Application.
Inherited Members
Namespace: AxaFrance.WebEngine.Web
Assembly: AxaFrance.WebEngine.Web.dll
Syntax
public class WebElementDescription : ElementDescription
Constructors
| Edit this page View SourceWebElementDescription()
Initialize the Element. If the element is not created within a PageModel, you should use UseDriver(WebDriver) before us the element.
Declaration
public WebElementDescription()
WebElementDescription(WebDriver)
Initialize the ElementDescription with a given WebDriver as contexte to use.
Declaration
public WebElementDescription(WebDriver driver)
Parameters
| Type | Name | Description |
|---|---|---|
| WebDriver | driver | WebDriver instance to use. |
Properties
| Edit this page View SourceAttributes
Other non-standard HTML Elements
Declaration
public IEnumerable<HtmlAttribute> Attributes { get; set; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<HtmlAttribute> |
ClassName
CSS class name
Declaration
public string ClassName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
CssSelector
CssSelector of the element. avoid to use CssSelector if other identification method is available.
Declaration
public string CssSelector { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Id
The Id attribute of the HTML element.
Declaration
public string Id { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
InnerText
InnerText of HTML element.
Declaration
public string InnerText { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
IsVisibleInViewPort
Checks if the WebElement is displayed in the current viewport. This function is based on javascript function getBoundingClientRect(), it may not working on older version (67.0) of Chrome on mobile devices.
Declaration
public bool IsVisibleInViewPort { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LinkText
The Text of a Hyperlink
Declaration
public string LinkText { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Name
The Name attribute of the HTML element.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ShadowRoot
Describes the ShadowRoot if the element is placed in a shadow DOM. The description of the current element wil be based in the scope of the ShadowRoot.
Declaration
public WebElementDescription ShadowRoot { get; set; }
Property Value
| Type | Description |
|---|---|
| WebElementDescription |
Remarks
Warning: When searching an element in the ShadowRoot: You can only use CssSelctor to describe the element.
TagName
The HTML Tag name
Declaration
public string TagName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
XPath
XPath of the element. avoid to use absolute XPATH if another identification method is available.
Declaration
public string XPath { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceApplyAttribute(FindsByAttribute)
Applies the locator defined in FindsByAttribute. this function is called automatically before InternalFindElements()
Declaration
public override void ApplyAttribute(FindsByAttribute attr)
Parameters
| Type | Name | Description |
|---|---|---|
| FindsByAttribute | attr |
Overrides
| Edit this page View SourceAsSelect()
Returns an WebElement as OpenQA.Selenium.Support.UI.SelectElement to get more possible operations.
Declaration
public SelectElement AsSelect()
Returns
| Type | Description |
|---|---|
| SelectElement | An OpenQA.Selenium.Support.UI.SelectElement object represents an HTML <select> tag. |
CheckByValue(string)
Checks an RadioButton from a given RadioGroup (used for radio button group, <input type="radio"> elements)
Declaration
public IWebElement CheckByValue(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | the value to be checked in current Radiobutton group. |
Returns
| Type | Description |
|---|---|
| IWebElement |
DragAndDropTo(ElementDescription)
Drag the current element and drop it to element. It may not work on Mobile Devices.
Declaration
public void DragAndDropTo(ElementDescription element)
Parameters
| Type | Name | Description |
|---|---|---|
| ElementDescription | element | The target element to drop. |
DragAndDropTo(IWebElement)
Drag the current element and drop it to element.
Declaration
public void DragAndDropTo(IWebElement element)
Parameters
| Type | Name | Description |
|---|---|---|
| IWebElement | element | The target element to drop. |
GetInnerHtml()
Gets the InnerHtml of the current element.
Declaration
public string GetInnerHtml()
Returns
| Type | Description |
|---|---|
| string | A string representation of InnerHtml the current WebElement |
GetOuterHtml()
Gets the OuterHtml of the current element.
Declaration
public string GetOuterHtml()
Returns
| Type | Description |
|---|---|
| string | A string representation of InnerHtml the current WebElement |
InternalClick()
Overrides the default behavior of Click: Scrolling the element into view to avoid ElementClickInterceptedException
Declaration
protected override void InternalClick()
Overrides
| Edit this page View SourceInternalFindElement()
Implemente element identifying algorithm, without the need of object synchronization.
Declaration
protected override IWebElement InternalFindElement()
Returns
| Type | Description |
|---|---|
| IWebElement | Identified test object. |
Overrides
| Edit this page View SourceInternalFindElements()
Implemente element identifying algorithm, without the need of object synchronization.
Declaration
protected override IReadOnlyCollection<IWebElement> InternalFindElements()
Returns
| Type | Description |
|---|---|
| IReadOnlyCollection<IWebElement> | Identified test objects |
Overrides
| Edit this page View SourceInternalGetScreenshot()
Implemente screenshot generation for the current specific element
Declaration
protected override byte[] InternalGetScreenshot()
Returns
| Type | Description |
|---|---|
| byte[] | The screenshot image in RAW Binary data format. |
Overrides
| Edit this page View SourceMouseHover()
Simulate a mouse hover on the indicated WebElement.
Declaration
public void MouseHover()
RightClick()
Simulate a mouse right click on the indicated WebElement.
Declaration
public void RightClick()
ScrollIntoView()
Scroll the current element into the visible area.
Declaration
public void ScrollIntoView()
SelectByIndex(int)
Select an option from html tag <select> by its displayed text.
Declaration
public void SelectByIndex(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The 0-based index to be selected. |
SelectByText(string)
Select an option from html tag <select> by its displayed text.
Declaration
public void SelectByText(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | the text value to be selected. |
SelectByValue(string)
Select an option from html tag <select> by its value.
Declaration
public void SelectByValue(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | the text value to be selected. |
SetSecure(string)
Set the value of a password textbox
Declaration
public void SetSecure(string encrypted)
Parameters
| Type | Name | Description |
|---|---|---|
| string | encrypted | A base64 formatted encrypted data. using default encrptionkey provided in appsetting.json |
ToString()
Shows a string representation of this WebElementDescription
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string representation of this WebElementDescription |