Typings for lib/by.js Describes a mechanism for locating an element on the page.

Final

Hierarchy

  • By

Constructors

  • Parameters

    • using: string

      the name of the location strategy to use.

    • value: string

      the value to search for.

    Returns By

Properties

using: string
value: string

Methods

  • Returns Object

  • Returns string

  • Locates eleemnts by the ID attribute. This locator uses the CSS selector *[id='$ID'], not document.getElementById.

    Parameters

    • id: string

      The ID to search for.

    Returns By

    The new locator.

  • Locates an elements by evaluating a JavaScript expression. The result of this expression must be an element or list of elements.

    Parameters

    • script: string | Function

      The script to execute.

    • Rest ...var_args: any[]

      The arguments to pass to the script.

    Returns ((webdriver) => Promise<any>)

    A new JavaScript-based locator function.

      • (webdriver): Promise<any>
      • Locates an elements by evaluating a JavaScript expression. The result of this expression must be an element or list of elements.

        Parameters

        Returns Promise<any>

        A new JavaScript-based locator function.

  • Locates link elements whose visible text matches the given string.

    Parameters

    • text: string

      The link text to search for.

    Returns By

    The new locator.

  • Locates elements whose name attribute has the given value.

    Parameters

    • name: string

      The name attribute to search for.

    Returns By

    The new locator.

  • Locates link elements whose visible text contains the given substring.

    Parameters

    • text: string

      The substring to check for in a link's visible text.

    Returns By

    The new locator.

  • Locates elements with a given tag name.

    Parameters

    • name: string

      The tag name to search for.

    Returns By

    The new locator.

    Deprecated

    Use () By.css(tagName) instead.

  • Locates elements matching a XPath selector. Care should be taken when using an XPath selector with a WebElement as WebDriver will respect the context in the specified in the selector. For example, given the selector //div, WebDriver will search from the document root regardless of whether the locator was used with a WebElement.

    Parameters

    • xpath: string

      The XPath selector to use.

    Returns By

    The new locator.

Generated using TypeDoc