Basic Actions

Basic elements support different public methods depending on the array of type options set for the element.

The following sections list the methods available for each type.

Base Element Actions

These methods are available by default for all elements.

ActionSummary
containsElementReturns true if the current element contains an element with the selector provided as a parameter. The second optional parameter is a boolean to expand the element's shadowRoot when looking for the element.
getAttributeReturns the string value of a given attribute.
getClassAttributeShortcut for getAttribute("class"), in Java actual method is called getClassAttribute().
getCssPropertyValueReturns the string value of a given CSS property.
getRectReturns an ElementRectangle object with coordinates (x and y properties in JavaScript, getX() and getY() public methods in Java) and the size of the element (width and height properties in JavaScript, getWidth() and getHeight() public methods in Java). This method returns void if you use it in a compose statement.
getTextReturns a string with the innerText of an element.
getTitleShortcut for getAttribute("title").
getValueReturns the value of an input element's value property.
isEnabledReturns true if the element is enabled.
isFocusedReturns true if the element has focus at the moment.
isPresentReturns true if the element is found in the DOM.
isVisibleReturns true if the element is visible.
waitForWaits for a function that's provided as a parameter to return a truthy value. This method is the UTAM version of Selenium wait.
waitForAbsencePolling wait action—waits for an element to be absent (not-attached to the DOM) within a timeout. Throws an exception after the timeout.
waitForInvisiblePolling wait action—waits for the element to become not displayed within the timeout. Expects the element to be present while checking its visibility.
waitForVisiblePolling wait action—waits for the element to be visible within a timeout. Throws an error if the element isn’t present.

Actionable Type Actions

These methods are available if the element's type array includes actionable.

ActionSummary
blurApplies a blur action to the element.
focusApplies a focus action to the element. The focused element is the default element to receive keyboard or similar events.
moveToMoves the mouse to the middle of the element—also known as mouseover.
scrollToCenterScrolls the current element to the center of the screen by executing JavaScript arguments[0].scrollIntoView({block:'center'})
scrollToTopScroll to the element by executing JavaScript return arguments[0].scrollIntoView(true);

Clickable Type Actions

These methods are available if the element's type array includes clickable type.

ActionSummary
clickApplies click action to the element.
doubleClickApplies double click action to the element.
rightClickApplies right click action to the element.
clickAndHoldClick on the element and holds holdDurationSec seconds before releasing mouse button.

Editable Type Actions

These methods are available if the element's type array includes editable.

ActionSummary
clearIf this element is a text entry element, the method clears the value. Otherwise it throws an exception.
clearAndTypeCombines clear and setText: clears an element's value and replaces it with a provided string.
pressPresses a key. Pass a key name: press('Enter'). This method has an optional second options object {text: string} parameter that allows you to specify key combinations. This example copies the text of the currently focused editable textarea element to the clipboard.
await textarea.press('Meta', { text: 'A' });
await textarea.press('Meta', { text: 'C' });
setTextSimulate typing text inside an element, which may set its value.

Draggable Type Actions

These methods are available if the element's type array includes draggable.

ActionSummary
dragAndDropClicks on an element, and holds and drops it at the target location. The target location is defined by another basic element. If the second optional durationSec parameter is set, pause during the hold. Example: dragAndDrop(myElement, 10).
dragAndDropByOffsetClicks on an element, and holds and drops it at the target location. The target location is determined by x and y offset coordinates relative to the current element. If the third optional durationSec parameter is set, pause during the hold. Example: dragAndDropByOffset(400, 300, 10).

Touchable Type Actions

Supported for Mobile platform only.

These methods are available if the element's type array includes touchable.

ActionSummary
flickFlicks on the touch screen using finger motion events. The start point is the middle of the element. The end point is determined by x and y offset coordinates relative to the current element. Example: flick(100, 100).