Skip to main content

Typing Text on Mobile Devices

Text typed with TypeText can take a while to appear on a mobile device. Use the guidance below to keep your scripts from checking for the text too early.

Allow Enough Time for Longer Text​

The longer the text, the longer it takes to appear on the device, whether it is ASCII or Unicode. Text can appear noticeably after your script has run the TypeText command, so a check that runs immediately afterward can fail even though the text is typed correctly.

When you verify longer text, use a generous waitFor value on your assertion. For example:

typetext "§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§"
Assert ImageFound(Text:"§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§", waitFor: 10)
note

The values in this example are illustrative only. The wait time you need depends on the length of the text and the performance of your system under test (SUT).

Choosing a Wait Time​

To choose a suitable waitFor value for your own text and SUT:

  1. Run the TypeText command once with a long waitFor value, such as 60 seconds.
  2. Note how long the text takes to appear on the SUT.
  3. Set waitFor to that time plus extra time as a buffer, so the assertion still passes when the SUT is slower than usual.

Android: On-Screen Keyboard Is Hidden During Unicode Input​

On Android connections, when you type Unicode text — characters like §, or Chinese, Japanese, and Korean text (often abbreviated as CJK) — the on-screen keyboard disappears while the text is being typed. It stays hidden for as long as you keep typing Unicode, and comes back about half a second after you switch to typing something else.

This is expected. The device switches to a special typing mode behind the scenes to type Unicode characters correctly, and that mode doesn't show an on-screen keyboard. It is also why Unicode text takes longer to type than ASCII text on Android, so allow extra time as described above.

note

Don't expect the on-screen keyboard to be visible during, or right after, Unicode typing.

See Also​