Editable Actions

An element with "type": "editable" has access to basic action APIs that can set and clear text.

  • clear—If the element is a text entry element, the method clears the value.
  • clearAndType—Combines clear and setText. Clears an element's value and replaces it with a provided string: clearAndType('Kevin').
  • press—Presses a key. Pass a key name: press('Enter').
  • setText—Simulates typing text inside an element, which may set its value. Pass the string to set: setText('Learn UTAM!').

This page object declares an editable method, which gets an input element by string. The UTAM compiler generates this method.

getInput(name: string): Promise<(_BaseUtamElement & _EditableUtamElement)>;

The test code gets the <input name="user_name"> element, and calls clearAndType to enter a string. It calls the getValue basic action to get the value of the input field and then asserts that the value was set correctly. The getValue action is available for all types of elements.

Click Run Test.