Check if a parent element contains a child element.
Compares the .innerHTML
of an element with the given html string.
Both .innerHTML
and the snippet are unified using the html
function from common-tags library.
Checks if the displayed text of the element contains the given text. The text parameter is turned into an RegExp object before performing the check.
Resolves to true
/ false
when the element can be found in the DOM or not.
Executes the given query and returns a "native" WebElement
instance
when the query is successful.
Retrieves the value of an element attribute.
Alias for FetchApi._getText.
Finds all option
elements within the queried element and resolves to an array with all visible texts of the options.
If the parameter value
is set to "value"
it will resolve to an array with all option values.
Retrieves the text content of the selected option
within the select
element.
Retrieves the selection from a user in the current document as a string
.
This is most likely the text what will set to the clipboard if a user
copies the selection.
Gets the visible (i.e. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace. It uses WebElement.getText()
method internally.
Retrieves the actual value from the value attribute of an Element or Query.
Checks if the element has an attribute checked
. This is useful for checkboxes or radio inputs.
Checks if an element is enabled. An element is considered as enabled when it has no disabled
attribute set.
Tests if this element is currently displayed. Using a timeout of maximum one second. If a longer timeout is needed, ActionApi._wait can be used. It uses WebElement.isDisplayed internally.
Returns a tuple describing an element's location, in pixels relative to the document element.
Styles in HTML elements are calculated by the browser based on various CSS rules.
_style
returns the computed style that is finally applicable to the element.
If the element inherits the named style from
its parent, the parent will be queried for its value. Where possible,
color values will be converted to their hex representation (e.g. #00ff00
instead of rgb(0, 255, 0)
).
Accessing the style directly as an attribute will not return a computed style.
Always use _style
instead.
Warning: A proper assertion will be difficult as some browser may interpret it differently.
Retrieves the current text content of the documents title
element.
Checks if two queries resolves to the same element.
Assume this HTML-snippet:
<ul> <li>entry</li> <li>entry</li> </ul>
Test the equality of two elements:
// _listItem("entry") will fetch the first list item const equal = await _areEqual(_listItem(0), _listItem("entry")) // -> true const notEqual = await _areEqual(_listItem(1), _listItem("entry")) // -> false