# Basic Actions

[Basic elements](/docs/platform/utam/references/utam-grammar/page-object-elements.md#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.

| Action                | Summary                                                                                                                                                                                                                                                                                                                                           |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `containsElement`     | Returns `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.                                                                                                                                  |
| `getAttribute`        | Returns the string value of a given attribute.                                                                                                                                                                                                                                                                                                    |
| `getClassAttribute`   | Shortcut for `getAttribute("class")`, in Java actual method is called getClassAttribute().                                                                                                                                                                                                                                                        |
| `getCssPropertyValue` | Returns the string value of a given CSS property.                                                                                                                                                                                                                                                                                                 |
| `getRect`             | Returns 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.** |
| `getText`             | Returns a string with the `innerText` of an element.                                                                                                                                                                                                                                                                                              |
| `getTitle`            | Shortcut for `getAttribute("title")`.                                                                                                                                                                                                                                                                                                             |
| `getValue`            | Returns the value of an `input` element's `value` property.                                                                                                                                                                                                                                                                                       |
| `isEnabled`           | Returns `true` if the element is enabled.                                                                                                                                                                                                                                                                                                         |
| `isFocused`           | Returns `true` if the element has focus at the moment.                                                                                                                                                                                                                                                                                            |
| `isPresent`           | Returns `true` if the element is found in the DOM.                                                                                                                                                                                                                                                                                                |
| `isVisible`           | Returns `true` if the element is visible.                                                                                                                                                                                                                                                                                                         |
| `waitFor`             | Waits for a function that's provided as a parameter to return a truthy value. This method is the UTAM version of [Selenium `wait`](https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/lib/webdriver.js).                                                                                                        |
| `waitForAbsence`      | Polling wait action—waits for an element to be absent (not-attached to the DOM) within a timeout. Throws an exception after the timeout.                                                                                                                                                                                                          |
| `waitForInvisible`    | Polling wait action—waits for the element to become not displayed within the timeout. Expects the element to be present while checking its visibility.                                                                                                                                                                                            |
| `waitForVisible`      | Polling 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`.

| Action           | Summary                                                                                                                         |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `blur`           | Applies a blur action to the element.                                                                                           |
| `focus`          | Applies a focus action to the element. The focused element is the default element to receive keyboard or similar events.        |
| `moveTo`         | Moves the mouse to the middle of the element—also known as mouseover.                                                           |
| `scrollToCenter` | Scrolls the current element to the center of the screen by executing JavaScript `arguments[0].scrollIntoView({block:'center'})` |
| `scrollToTop`    | Scroll 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.

| Action         | Summary                                                                                 |
| -------------- | --------------------------------------------------------------------------------------- |
| `click`        | Applies click action to the element.                                                    |
| `doubleClick`  | Applies double click action to the element.                                             |
| `rightClick`   | Applies right click action to the element.                                              |
| `clickAndHold` | Click 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`.

| Action         | Summary                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `clear`        | If this element is a text entry element, the method clears the value. Otherwise it throws an exception.                                                                                                                                                                                                                                                                                                                                    |
| `clearAndType` | Combines `clear` and `setText`: clears an element's value and replaces it with a provided string.                                                                                                                                                                                                                                                                                                                                          |
| `press`        | Presses a key. Pass a [key name](https://w3c.github.io/webdriver/#keyboard-actions): `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.<br/>`await textarea.press('Meta', { text: 'A' });`<br/>`await textarea.press('Meta', { text: 'C' });` |
| `setText`      | Simulate 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`.

| Action                | Summary                                                                                                                                                                                                                                                                                              |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dragAndDrop`         | Clicks 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)`.                                                   |
| `dragAndDropByOffset` | Clicks 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

:::important
Touchable type actions are only supported for Mobile platform.
:::

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

| Action  | Summary                                                                                                                                                                                                                         |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `flick` | Flicks 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)`. |
