Class ElementWrapperExtensions
Defines a collection of extensions for IElementWrapper<TElement> objects.
Inheritance
Namespace: Legerity.Extensions
Assembly: Legerity.Core.dll
Syntax
public static class ElementWrapperExtensions : object
Methods
| Improve this Doc View SourceFindElementByPartialText<TElement>(IElementWrapper<TElement>, String)
Finds the first element in the given element that matches the specified text partially.
Declaration
public static IWebElement FindElementByPartialText<TElement>(this IElementWrapper<TElement> element, string text)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The remote web element. |
System.String | text | The partial text to find. |
Returns
Type | Description |
---|---|
IWebElement | A |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
FindElementByText<TElement>(IElementWrapper<TElement>, String)
Finds the first element in the given element that matches the specified text.
Declaration
public static IWebElement FindElementByText<TElement>(this IElementWrapper<TElement> element, string text)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The remote web element. |
System.String | text | The text to find. |
Returns
Type | Description |
---|---|
IWebElement | A |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
FindElementsByPartialText<TElement>(IElementWrapper<TElement>, String)
Finds all the elements in the given element that matches the specified text partially.
Declaration
public static ReadOnlyCollection<IWebElement> FindElementsByPartialText<TElement>(this IElementWrapper<TElement> element, string text)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The remote web element. |
System.String | text | The partial text to find. |
Returns
Type | Description |
---|---|
ReadOnlyCollection<IWebElement> | A readonly collection of |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
FindElementsByText<TElement>(IElementWrapper<TElement>, String)
Finds all the elements in the given element that matches the specified text.
Declaration
public static ReadOnlyCollection<IWebElement> FindElementsByText<TElement>(this IElementWrapper<TElement> element, string text)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The remote web element. |
System.String | text | The text to find. |
Returns
Type | Description |
---|---|
ReadOnlyCollection<IWebElement> | A readonly collection of |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
FindWebElement<TElement>(IElementWrapper<TElement>, By)
Finds the first element in the given element that matches the
Declaration
public static RemoteWebElement FindWebElement<TElement>(this IElementWrapper<TElement> element, By locator)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The remote web element. |
By | locator | The locator to find the element. |
Returns
Type | Description |
---|---|
RemoteWebElement | A |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
FindWebElements<TElement>(IElementWrapper<TElement>, By)
Finds all the elements in the given element that matches the
Declaration
public static ReadOnlyCollection<RemoteWebElement> FindWebElements<TElement>(this IElementWrapper<TElement> element, By locator)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The remote web element. |
By | locator | The locator to find the elements. |
Returns
Type | Description |
---|---|
ReadOnlyCollection<RemoteWebElement> | A readonly collection of |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
GetAllChildElements<TElement>(IElementWrapper<TElement>)
Retrieves all child elements that can be located by the driver for the given element.
Declaration
public static ReadOnlyCollection<IWebElement> GetAllChildElements<TElement>(this IElementWrapper<TElement> element)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The remote web driver. |
Returns
Type | Description |
---|---|
ReadOnlyCollection<IWebElement> | A readonly collection of |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
GetBoundingRect<TElement>(IElementWrapper<TElement>)
Determines the bounding rectangle for the specified element.
Declaration
public static Rectangle GetBoundingRect<TElement>(this IElementWrapper<TElement> element)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The element to determine the rect for. |
Returns
Type | Description |
---|---|
Rectangle | The elements bounding rectangle. |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
TryWaitUntil<TElement, TResult>(IElementWrapper<TElement>, Func<IElementWrapper<TElement>, TResult>, Nullable<TimeSpan>, Int32, Action<Exception>)
Attempts to wait until a specified element condition is met, with an optional timeout.
Declaration
public static bool TryWaitUntil<TElement, TResult>(this IElementWrapper<TElement> element, Func<IElementWrapper<TElement>, TResult> condition, TimeSpan? timeout = null, int retries = 0, Action<Exception> exceptionHandler = null)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The element to wait on. |
Func<IElementWrapper<TElement>, TResult> | condition | The condition of the element to wait on. |
System.Nullable<TimeSpan> | timeout | The optional timeout wait on the condition being true. |
System.Int32 | retries | An optional count of retries after a timeout before accepting the failure. |
Action<Exception> | exceptionHandler | The optional exception handler thrown if an error occurs as a result of timeout. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the wait was a success. |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
TResult | The type of expected result from the wait condition. |
WaitUntil<TElement, TResult>(IElementWrapper<TElement>, Func<IElementWrapper<TElement>, TResult>, Nullable<TimeSpan>, Int32)
Waits until a specified element condition is met, with an optional timeout.
Declaration
public static TResult WaitUntil<TElement, TResult>(this IElementWrapper<TElement> element, Func<IElementWrapper<TElement>, TResult> condition, TimeSpan? timeout = null, int retries = 0)
where TElement : IWebElement
Parameters
Type | Name | Description |
---|---|---|
IElementWrapper<TElement> | element | The element to wait on. |
Func<IElementWrapper<TElement>, TResult> | condition | The condition of the element to wait on. |
System.Nullable<TimeSpan> | timeout | The optional timeout wait on the condition being true. |
System.Int32 | retries | An optional count of retries after a timeout before accepting the failure. |
Returns
Type | Description |
---|---|
TResult | The |
Type Parameters
Name | Description |
---|---|
TElement | The type of |
TResult | The type of expected result from the wait condition. |