Namespace: interaction

interaction

Methods

(static) clickElement(el, strictopt, specCompatopt)

Interact with an element by clicking it.

The element is scrolled into view before visibility- or interactability checks are performed.

Selenium-style visibility checks will be performed if specCompat is false (default). Otherwise pointer-interactability checks will be performed. If either of these fail an ElementNotInteractableError is thrown.

If strict is enabled (defaults to disabled), further accessibility checks will be performed, and these may result in an ElementNotAccessibleError being returned.

When el is not enabled, an InvalidElementStateError is returned.

Parameters:
Name Type Attributes Default Description
el DOMElement | XULElement

Element to click.

strict boolean <optional>
false

strict Enforce strict accessibility tests.

specCompat boolean <optional>
false

specCompat Use WebDriver specification compatible interactability definition.

Source:
Throws:

(static) flushEventLoop(win) → {Promise}

Flushes the event loop by requesting an animation frame.

This will wait for the browser to repaint before returning, typically flushing any queued events.

If the document is unloaded during this request, the promise is rejected.

Parameters:
Name Type Description
win Window

Associated window.

Source:
Returns:

Promise is accepted once event queue is flushed, or rejected if win has closed or been unloaded before the queue can be flushed.

Type
Promise

(static) isElementDisplayed(el, strictopt) → {boolean}

Determine the element displayedness of an element.

Parameters:
Name Type Attributes Default Description
el DOMElement | XULElement

Element to determine displayedness of.

strict boolean <optional>
false

strict Enforce strict accessibility tests.

Source:
Returns:

True if element is displayed, false otherwise.

Type
boolean

(static) isElementEnabled(el) → {boolean}

Check if element is enabled.

Parameters:
Name Type Description
el DOMElement | XULElement

Element to test if is enabled.

Source:
Returns:

True if enabled, false otherwise.

Type
boolean

(static) isElementSelected(el, strictopt) → {boolean}

Determines if the referenced element is selected or not.

This operation only makes sense on input elements of the Checkbox- and Radio Button states, or option elements.

Parameters:
Name Type Attributes Default Description
el DOMElement | XULElement

Element to test if is selected.

strict boolean <optional>
false

strict Enforce strict accessibility tests.

Source:
Returns:

True if element is selected, false otherwise.

Type
boolean

(static) selectOption(option)

Select <option> element in a <select> list.

Because the dropdown list of select elements are implemented using native widget technology, our trusted synthesised events are not able to reach them. Dropdowns are instead handled mimicking DOM events, which for obvious reasons is not ideal, but at the current point in time considered to be good enough.

Parameters:
Name Type Description
option HTMLOptionElement

Option element to select.

Source:
Throws:
  • If el is a XUL element or not an <option> element.

    Type
    TypeError
  • If unable to find el's parent <select> element.

    Type
    Error

(static) sendKeysToElement(el, value, ignoreVisibility, strictopt)

Send keys to element.

Parameters:
Name Type Attributes Default Description
el DOMElement | XULElement

Element to send key events to.

value Array.<string>

Sequence of keystrokes to send to the element.

ignoreVisibility boolean

Flag to enable or disable element visibility tests.

strict boolean <optional>
false

strict Enforce strict accessibility tests.

Source:

(static) setFormControlValue(el, value)

Sets a form element's value.

Parameters:
Name Type Description
el DOMElement

An form element, e.g. input, textarea, etc.

value string

The value to be set.

Source:
Throws:

If el is not an supported form element.

Type
TypeError

(static) uploadFile(el, path)

Appends path to an <input type=file>'s file list.

Parameters:
Name Type Description
el HTMLInputElement

An <input type=file> element.

path string

Full path to file.

Source: