Class: Store

element.Store()

Stores known/seen elements and their associated web element references.

Elements are added by calling #add() or addAll(), and may be queried by their web element reference using get().

Constructor

new Store()

Source:

Methods

add(el) → {WebElement}

Make an element seen.

Parameters:
Name Type Description
el Element | WindowProxy | XULElement

Element to add to set of seen elements.

Source:
Throws:

If el is not an Element or a XULElement.

Type
TypeError
Returns:

Web element reference associated with element.

Type
WebElement

addAll(els) → {Array.<WebElement>}

Make a collection of elements seen.

The oder of the returned web element references is guaranteed to match that of the collection passed in.

Parameters:
Name Type Description
els NodeList

Sequence of elements to add to set of seen elements.

Source:
Returns:

List of the web element references associated with each element from els.

Type
Array.<WebElement>

get(webEl, window) → {Element|XULElement}

Retrieve a DOM Element or a XULElement by its unique WebElement reference.

Parameters:
Name Type Description
webEl WebElement

Web element reference to find the associated Element of.

window WindowProxy

Current browsing context, which may differ from the associate browsing context of el.

Source:
Throws:
  • If webEl is not a WebElement.

    Type
    TypeError
  • If the web element reference uuid has not been seen before.

    Type
    NoSuchElementError
  • If the element has gone stale, indicating it is no longer attached to the DOM, or its node document is no longer the active document.

    Type
    StaleElementReferenceError
Returns:

Element associated with reference.

Type
Element | XULElement

has(webEl) → {boolean}

Determine if the provided web element reference has been seen before/is in the element store.

Unlike when getting the element, a staleness check is not performed.

Parameters:
Name Type Description
webEl WebElement

Element's associated web element reference.

Source:
Throws:

If webEl is not a WebElement.

Type
TypeError
Returns:

True if element is in the store, false otherwise.

Type
boolean