3.1.8 Type, Typeline
Type, Typeline - Type text on the desktop. The Typeline command is just a convenient one which types the text and then presses Enter. This has the same effect as a combination of '
Type <text>' and '
type <text> [wait=<time>] [count=<number>]
typeline <text> [wait=<time>] [count=<number>]
* Red colour indicates obligatory parameters
- The text to type. If the text contains spaces or equal signs '=', it must be enclosed in double-quotes, e.g. "This is a text containing spaces". If you need to include the double-quote character into your text, place a leading backslash before it, e.g. "This is double-quote - \"". If you need to display a backslash followed by a double quote, use '\\"', e.g. "This is a backslash followed by a double quote - \\"".
Supported text characters are subject to limitations applied by the desktop client (protocol). For example, the RFB (VNC) protocol cannot transfer characters outside of the Latin-1 (ISO 8859-1) character set. On the contrary, the native Java client can transfer only characters which can be generated on the local keyboard regardless of the character set they belong to. Read the particular client documentation for more information.
- Time to wait after the text gets typed. This parameter is useful if the server needs some time to react on the pressed key/keys. It has the same effect as if the following command was 'Wait <time>'. The value must be either a number of milliseconds or valid time value. The default value is 0 (don't wait). Scripts may set the default value through populating of the _TYPE_WAIT or _TYPELINE_WAIT variable with the desired delay, for example
- Key location. When specified the command makes an attempt to map the typed characters onto the specified keyboard location. Though supported location values are standard (default), numpad, left and right, this option makes sense only with the numeric pad which is the only keyboard part containing characters accepted by the command.
Support of this parameter is intended to make testing of mobile devices easier. Numeric keys on mobile devices (especially mobile phones) are often mapped to numpad keys and it is inconvenient to handle each keypress through the Press command. For example, to type and call a phone number +0123456789 on the mobile one can simply use "Typeline +0123456789 location=numpad".
- How many times the command should be repeated. The default value is 1 (type the text/type the line just once).
The command returns 0 (zero) on success or 1 when it fails, for example for an I/O error.
- Type 'hello'.
Typeline "mkdir /tmp/mydir" wait=2s
- If you run this in an active Linux/Unix terminal window, it will invoke the '
' OS command and wait for two seconds before proceeding to the next command.
Type "100*4" location=numpad
- Type the formula on the numeric keyboard.
Typeline "+111222333444" location=numpad
- Type the formula on the numeric keyboard and press Enter. When the system under test is a mobile device with keyboard mapped onto the num pad such as a Nokia phone with Symbian OS, it will place a call to the specified number.