Search Results for

    Show / Hide Table of Contents

    Class ElementExtensions

    Defines a collection of extensions for elements.

    Inheritance
    System.Object
    ElementExtensions
    Namespace: Legerity.Extensions
    Assembly: Legerity.Core.dll
    Syntax
    public static class ElementExtensions : object

    Methods

    | Improve this Doc View Source

    FindElementByPartialText(IWebElement, String)

    Finds the first element in the given element that matches the specified text partially.

    Declaration
    public static IWebElement FindElementByPartialText(this IWebElement element, string text)
    Parameters
    Type Name Description
    IWebElement element

    The remote web element.

    System.String text

    The partial text to find.

    Returns
    Type Description
    IWebElement

    A .

    | Improve this Doc View Source

    FindElementByText(IWebElement, String)

    Finds the first element in the given element that matches the specified text.

    Declaration
    public static IWebElement FindElementByText(this IWebElement element, string text)
    Parameters
    Type Name Description
    IWebElement element

    The remote web element.

    System.String text

    The text to find.

    Returns
    Type Description
    IWebElement

    A .

    | Improve this Doc View Source

    FindElementsByPartialText(IWebElement, String)

    Finds all the elements in the given element that matches the specified text partially.

    Declaration
    public static ReadOnlyCollection<IWebElement> FindElementsByPartialText(this IWebElement element, string text)
    Parameters
    Type Name Description
    IWebElement element

    The remote web element.

    System.String text

    The partial text to find.

    Returns
    Type Description
    ReadOnlyCollection<IWebElement>

    A readonly collection of .

    | Improve this Doc View Source

    FindElementsByText(IWebElement, String)

    Finds all the elements in the given element that matches the specified text.

    Declaration
    public static ReadOnlyCollection<IWebElement> FindElementsByText(this IWebElement element, string text)
    Parameters
    Type Name Description
    IWebElement element

    The remote web element.

    System.String text

    The text to find.

    Returns
    Type Description
    ReadOnlyCollection<IWebElement>

    A readonly collection of .

    | Improve this Doc View Source

    FindWebElement(IWebElement, By)

    Finds the first element in the given element that matches the locator.

    Declaration
    public static RemoteWebElement FindWebElement(this IWebElement element, By locator)
    Parameters
    Type Name Description
    IWebElement element

    The remote web element.

    By locator

    The locator to find the element.

    Returns
    Type Description
    RemoteWebElement

    A .

    | Improve this Doc View Source

    FindWebElements(IWebElement, By)

    Finds all the elements in the given element that matches the locator.

    Declaration
    public static ReadOnlyCollection<RemoteWebElement> FindWebElements(this IWebElement element, By locator)
    Parameters
    Type Name Description
    IWebElement element

    The remote web element.

    By locator

    The locator to find the elements.

    Returns
    Type Description
    ReadOnlyCollection<RemoteWebElement>

    A readonly collection of .

    | Improve this Doc View Source

    GetAllChildElements(IWebElement)

    Retrieves all child elements that can be located by the driver for the given element.

    Declaration
    public static ReadOnlyCollection<IWebElement> GetAllChildElements(this IWebElement element)
    Parameters
    Type Name Description
    IWebElement element

    The remote web driver.

    Returns
    Type Description
    ReadOnlyCollection<IWebElement>

    A readonly collection of .

    | Improve this Doc View Source

    GetBoundingRect(IWebElement)

    Determines the bounding rectangle for the specified element.

    Declaration
    public static Rectangle GetBoundingRect(this IWebElement element)
    Parameters
    Type Name Description
    IWebElement element

    The element to determine the rect for.

    Returns
    Type Description
    Rectangle

    The elements bounding rectangle.

    | Improve this Doc View Source

    TryWaitUntil(RemoteWebElement, Func<RemoteWebElement, Boolean>, Nullable<TimeSpan>, Int32, Action<Exception>)

    Attempts to wait until a specified element condition is met, with an optional timeout.

    Declaration
    public static bool TryWaitUntil(this RemoteWebElement element, Func<RemoteWebElement, bool> condition, TimeSpan? timeout = null, int retries = 0, Action<Exception> exceptionHandler = null)
    Parameters
    Type Name Description
    RemoteWebElement element

    The element to wait on.

    Func<RemoteWebElement, System.Boolean> 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.

    | Improve this Doc View Source

    WaitUntil<TResult>(RemoteWebElement, Func<RemoteWebElement, TResult>, Nullable<TimeSpan>, Int32)

    Waits until a specified element condition is met, with an optional timeout.

    Declaration
    public static TResult WaitUntil<TResult>(this RemoteWebElement element, Func<RemoteWebElement, TResult> condition, TimeSpan? timeout = null, int retries = 0)
    Parameters
    Type Name Description
    RemoteWebElement element

    The element to wait on.

    Func<RemoteWebElement, 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 TResult of the wait until operation.

    Type Parameters
    Name Description
    TResult

    The type of expected result from the wait condition.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright (c) MADE Apps