Function When_I_find_closest_element

  • When I find closest element:

    When I find closest element {string}
    

    Get the first DOM element that matches the selector (whether it be itself or one of its ancestors).

    The querying behavior matches exactly how .closest() works in jQuery.

    Parameters

    • selector: string

    Returns void

    Find the closest element with the class banner:

    When I find closest element ".banner"
    

    A preceding step like "When I find element by label text" is required. For example:

    When I find element by label text "Text"
    And I find closest element "form"
    And I submit