BasicElements

.eq(index)

Reduce the set of matched elements to the one at the specified index.

Parameter Description
index An integer indicating the 0-based position of the element. If negative, it will be counting backwards from the last element in the set.

.first()

Reduce the set of matched elements to the first one. It's equivalent to this.eq(0).

.last()

Reduce the set of matched elements to the last one. It's equivalent to this.eq(-1).

.size()

Computes the size of the evaluated set.

BasicWebElements

.add(selector)

Add elements to the set of matched elements.

Parameter Description
selector A string representing a selector expression to find additional elements to add to the set of matched elements.

.addBack()

Add the previous set of elements on the stack to the current set, optionally filtered by a selector.

.attr(attributeName)

Get the value of an attribute for the first element in the set of matched elements.

Parameter Description
attributeName The name of the attribute to get.

.children()

Get the children of each element in the set of matched elements, optionally filtered by a selector.

.closest(selector)

For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.

Parameter Description
selector A string containing a selector expression to match elements against.

.contents()

Get the children of each element in the set of matched elements, including text and comment nodes.

.css(propertyName)

Get the value of style properties for the first element in the set of matched elements.

Parameter Description
propertyName A CSS property.

.data(key)

Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.

Parameter Description
key Name of the data stored.

.end()

End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.

.filter(selector)

Reduce the set of matched elements to those that match the selector or pass the function's test.

Parameter Description
selector A string containing a selector expression to match the current set of elements against.

.find(selector)

.has(selector)

Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.

Parameter Description
selector A string containing a selector expression to match elements against.

.hasClass(cssClass)

Determine whether any of the matched elements are assigned the given class.

Parameter Description
cssClass The class name to search for.

.html()

Get the HTML contents of the first element in the set of matched elements.

.is(selector)

Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.

Parameter Description
selector A string containing a selector expression to match elements against.

.next()

Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.

.nextAll()

Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.

.nextUntil(selector)

Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.

Parameter Description
selector A string containing a selector expression to indicate where to stop matching following sibling elements.

.not(selector)

Remove elements from the set of matched elements.

Parameter Description
selector A string containing a selector expression to match elements against.

.offsetParent()

Get the closest ancestor element that is positioned.

.parent()

Get the parent of each element in the current set of matched elements, optionally filtered by a selector.

.parents()

Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.

.parentsUntil(selector)

Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.

Parameter Description
selector A string containing a selector expression to indicate where to stop matching ancestor elements.

.prev()

Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.

.prevAll()

Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.

.prevUntil(selector)

Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.

Parameter Description
selector A string containing a selector expression to indicate where to stop matching preceding sibling elements.

.prop(propertyName)

Get the value of a property for the first element in the set of matched elements.

Parameter Description
propertyName The name of the property to get.

.siblings()

Get the siblings of each element in the set of matched elements, optionally filtered by a selector.

.slice(start)

Reduce the set of matched elements to a subset specified by a range of indices.

Parameter Description
start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set.

.text()

Get the combined text contents of each element in the set of matched elements, including their descendants.

.val()

Get the current value of the first element in the set of matched elements.

FreezableElements

Everytime an Elements expression is evaluated, the corresponding set of values needs to be computed. That means that the same Elements expression, when evaluated multiple times, can evaluate into different sets.

This is a very handful behaviour, specially when interacting with elements, but it has a computational cost. To avoid computing the same set of results multiple times, a FreezableElements expression memoizes evaluated results once they are not empty, so that next evaluations don't require computation.

.freeze()

Memoizes the result of an evaluation once it returns a non-empty set, so that next evaluations will return the exact same results instead of computing them again.

ConditionalWebElements

Extends ConditionalElements by adding methods that receive a CSS selector instead of Elements. First, CSS selector is evaluated using $(selector) and then the same logic applies as in ConditionalElements

.and(selector)

Intersects both evaluated sets. For instance, if this evaluates into { A, B, C } and selector evaluates into { B, C, D }, then this.and(selector) evaluates into { B, C }

Parameter Description
selector a CSS selector

.or(selector)

Represents the union both evaluated sets. For instance, if this evaluates into { A, B, C } and selector evaluates into { B, C, D }, then this.or(selector) evaluates into { A, B, C, D }

Parameter Description
selector a CSS selector

.then(selector)

Evaluates into the elements represented by selector if and only if this evaluates into a non-empty set, otherwise returns an empty set.

For instance, if this evaluates into { A, B } and selector evaluates into { B, C } then this.then(selector) evaluates into { B, C }.

If this evaluates into an empty set, then this.then(selector) evaluates into an empty set.

Parameter Description
selector a CSS selector

.unless(selector)

Evaluates into this if and only if elements represented by selector evaluates into a empty set, otherwise returns an empty set.

For instance, if this evaluates into { A, B } and selector evaluates into { B, C } then this.unless(selector) evaluates into an empty set.

If selector evaluates into an empty set, then this.unless(selector) evaluates into { A, B }.

Parameter Description
selector a CSS selector

.when(selector)

Evaluates into this if and only if elements represented by selector evaluates into a non-empty set, otherwise returns an empty set. Basically, someElems.when(selector) is equivalent to $(selector).then(someElems).

Parameter Description
selector a CSS selector

ExtensionsWebElements

This interface provides useful jQuery extension methods for Minium WebElements, like contained text filtering or attribute value filtering.

.containingText(text)

Filters elements which have a specified text as a substring.

Example:

wd.find("span").containingText("Hello")
evaluates #sometext in the following scenario:
 <span id="sometext">Hello World</span>

Parameter Description
text the text to match

.containingVisibleText(text)

Filters elements which have a specified visible text as a substring.

Example:

wd.find("span").containingVisibleText("Hello")
evaluates #sometext in the following scenario:
 <span id="sometext">Hello World</span>

Parameter Description
text the text to match

.displayed()

.matchingText(regex)

Filters elements which have text that matches the specified regular expression.

Example:

wd.find("span").matchingText(".* World")
evaluates #sometext in the following scenario:
 <span id="sometext">Hello World</span>

Parameter Description
regex the regex

.matchingVisibleText(regex)

Filters elements which have visible text that matches the specified regular expression.

Example:

wd.find("span").matchingVisibleText(".* World")
evaluates #sometext in the following scenario:
 <span id="sometext">Hello World</span>

Parameter Description
regex the regex

.selected()

.visible()

Filters elements tht are visible. Visibility is computed using :visible jQuery CSS selector, as in `$(this).filter(":visible") `

Example:

wd.find("span").visible()
evaluates #span2 in the following scenario:
 <span id="span1" style="display: none">Hello World</span>
 <span id="span2">Hello World</span>

.visibleText()

.withAttr(name)

Filters elements that have an attribute.

Example:

wd.find("img").withAttr("alt")
evaluates #image2 in the following scenario:
 <img id="image1" src="image1.gif">
 <img id="image2" src="image2.gif" alt="Image 2">

Parameter Description
name the attribute name

.withCss(name)

Filters elements that have a style property.

Example:

wd.find("img").withCss("display")
evaluates #image2 in the following scenario:
 <img id="image1" src="image1.gif">
 <img id="image2" src="image2.gif" style="display: block">

Parameter Description
name the style property name

.withLabel(label)

Filters elements that have a label with the given text. That means that returned elements have the same id than the for attribute of the label tag.

Example:

wd.find(":text").withLabel("Username")
evaluates #username in the following scenario:
 <label for="username">Username</label>
 <input type="text" id="username">

Parameter Description
label the label text

.withName(name)

Filters elements that have a name attribute with a given value. This is very useful in form input elements.

Example:

wd.find(":password").withName("pass")
evaluates #password in the following scenario:
 <input id="password" type="password" name="pass">

Parameter Description
name the value for attribute
name

.withProp(name)

Filters elements that have a property.

Example:

wd.find("img").withProp("title")
evaluates #image2 in the following scenario:
 <img id="image1" src="image1.gif">
 <img id="image2" src="image2.gif" title="Image 2">

Parameter Description
name the property name

.withText(text)

Filters elements which have a specified text.

Example:

wd.find("span").withText("Hello")
evaluates #sometext in the following scenario:
 <span id="sometext">Hello</span>

Parameter Description
text the text to match

.withValue(value)

Filters elements that have a value attribute with a given value. This is very useful in input elements.

Example:

wd.find(":button").withValue("Proceed")
evaluates #button in the following scenario:
 <input id="button" type="button" value="Proceed">

Parameter Description
value the value for attribute
value

.withVisibleText(text)

Filters elements which have a specified visible text.

Example:

wd.find("span").withVisibleText("Hello")
evaluates #sometext in the following scenario:
 <span id="sometext">Hello</span>

Parameter Description
text the text to match

EvalWebElements

.eval(script)

.evalWebElements(script)

TargetLocatorWebElements

.documentRoots()

.frames()

.windows()

PositionWebElements

The Interface PositionWebElements.

.above(expr)

Returns elements above this element that match the expression.

Parameter Description
expr the expression to use for matching elements.

.below(expr)

Returns elements below this element that match the expression.

Parameter Description
expr the expression to use for matching elements.

.leftOf(expr)

Returns elements at the left this element that match the expression.

Parameter Description
expr the expression to use for matching elements.

.overlaps(expr)

Overlaps.

Parameter Description
expr the expr

.rightOf(expr)

Returns elements at the right of this element that match the expression.

Parameter Description
expr the expression to use for matching elements.