Block reference / UI Interaction

Type text

Type text into a field on the phone, found by its selector or the one that has the focus.

Only inWarpX Phone

Type text fills in a field: an email, a password, a search box, a message. With Element it finds the field and sets its text directly, in any language, without opening the keyboard. With Focused field it types into whatever field the cursor is in, which suits a field you have just tapped. To empty a field, use Clear text; to press Enter afterwards, Press key.

Type text finds the Email field and sets its text to the current account's email.
The Type text block's settings, filled in as in the example below.

Settings

Target

Element (where a new block starts) types into the field in Selector. Focused field types into the field that has the input focus.

ExampleElement
Text to type into the focused field

The box under Target, shown with this placeholder. The text to type, up to 5000 characters; it can hold references such as {{loopData.accounts.email}}.

Example{{loopData.accounts.email}}
Add to what the field holdswhen Target is Element

Off, the field's text is replaced. On, the text is added after what the field already holds.

ExampleUnchecked
Selectorwhen Target is Element

The element to act on. Inspect opens the Inspector for the phone picked in the editor's toolbar: pick the element, then Use in block for its locator, which still finds the element after the app changes, or Use XPath. You can also write an XPath such as //android.widget.Button[@text='Sign in'], or plain text, which means the element whose text is exactly that; Verify looks for it on the phone now and says whether it found one, several or none. The element can be the field itself or something around it: the first field inside it takes the text.

Example//android.widget.EditText[@resource-id='com.example.shop:id/email']
Wait up to (ms)when Target is Element

How long to keep looking for the element before the block fails, in milliseconds. The most is 120000.

Example10000
Scroll to find element (times)when Target is Element

When the element is not on screen, scroll the screen's main list and look again, up to this many times (at most 50). 0 does not scroll. It stops early when the list cannot move any further.

Example0
Delay (ms)

A pause after the block finishes, before the next block starts. Write one number such as 1000, or a range such as 1000,3000 for a random pause in that range on each run.

Example500

Every block also has the shared block settings — a description, Disable block and what to do on an error, and Finding elements on a phone explains selectors, Inspect and Verify in more depth. Fields that take text accept data from earlier blocks.

What it hands on

Hands on nothing. Leaves by its single output.

Example: Sign in to the shop app with each account in a list

  1. Start
  2. Loop data
  3. Start app
  4. Type text
  5. Type text
  6. Touch
  7. Loop breakpoint
Where Type text sits in the example workflow.
  1. Add a Loop data block with Loop ID accounts, looping through a table or sheet with email and password columns.
  2. Add a Start app block for the shop app, then a Type text block with Target on Element.
  3. Click Inspect, pick the Email field and press Use in block. Write {{loopData.accounts.email}} in the text box.
  4. Add a second Type text block for the Password field, with {{loopData.accounts.password}}.
  5. Add a Touch block on the Sign in button, close the loop with a Loop breakpoint, and press Run.

Good to know

  • Element needs the WarpX agent, and types any language. If the element holds no field that takes text, the block fails with It is not a field that takes text.
  • Focused field always adds to what the field holds. With the WarpX agent it sets the text in any language. Without it, plain ASCII is typed with Android's input command; other text, such as Vietnamese, goes through ADBKeyBoard when that is the phone's keyboard, and is otherwise pasted through the phone's clipboard, replacing what the clipboard held.
  • Focused field with an empty text does nothing. When no field has the focus, tap one first with Touch.
  • What Selector accepts: anything starting with / or (/ is an XPath, evaluated as full XPath 1.0 over the screen's elements with the attributes Appium uses (text, resource-id, content-desc, class, package, bounds and flags such as clickable), so contains() and starts-with() work. Text starting with { or [ is read as JSON: the locator Use in block writes, or a selector such as {"res": "com.example.shop:id/search_box"}. Anything else is the exact, case-sensitive text of an element. There is no text= or id= shorthand: text=Sign in looks for an element whose text is text=Sign in.
  • When the block fails, it leaves by its fallback output if one is connected: a phone block comes with On error set to Execute fallback. With nothing connected there, the workflow's On workflow error setting decides.

See also

  • Clear text — Empty a text field on the phone.
  • Touch — Tap, hold or double-tap an element on the phone's screen, or a point on it.
  • Press key — Press one of the phone's keys: Enter, Delete, Volume, Power and the rest.
  • Element action — Tap, click, long-press, type into, clear, scroll or focus an element.