Mobile Device Control
This section explains how mobile device controls correspond to Eggplant Functional’s mouse and keyboard events.
Controlling the Mobile Device Manually
When you are manually controlling your mobile device through Eggplant Functional, you can generate most keystrokes by pressing the corresponding computer key. For example, when you press the "m" key on your computer keyboard, an "m" keystroke is produced on the device.
Controlling the Mobile Device in a Script
Device-Specific Keys
For the controls that are not present on a computer keyboard, such as the trackball and Menu key, Eggplant Functional substitutes a computer key. (For example, Keypad +
represents the Volume up button. To engage the device’s Volume up button, you press the + key on your computer keypad.) There are SenseTalk keywords tied to these keys. Specific device key mappings are shown in TypeText Keywords for Mobile Control.
Touch-Screen Controls
In Eggplant Functional, you can produce a device’s touch-screen actions with mouse movements and clicks. When the mouse button is pressed, the device registers your finger on the screen at the same point as the mouse cursor. When the mouse button is up, mouse cursor movements have no effect on the device cursor.
Automating Device Keystrokes with TypeText
In Eggplant Functionalscripts, the TypeText command generates keystrokes. These keystrokes include character keystrokes, such as letters, and "functional" keystrokes, such as the Escape key.
Typing Characters
To produce text on the device, use the TypeText command with a quoted text string.
Example
TypeText "3140 Main Street" //Types this text on the device.
Pressing Functional Keys
Each functional key has an assigned keyword to use with the TypeText command. To produce functional keystrokes on the device, use the TypeText command with the corresponding keyword.
Example
TypeText DownArrow //Sends a down arrow keystroke, which corresponds to the device's "trackball down" action.
Example
TypeText AltKey, "d" //Holds the AltKey, and sends a d keystroke.
Recording TypeText Statements
In the Viewer window, you can create TypeText statements by recording your keystrokes and Mobile Button clicks.
Recording Keystrokes
In Capture mode, press the space bar or type any key to open the TypeText panel.
When the TypeText panel is open, your keystrokes are inserted into the text field. Non-character keys (and quotation marks) are inserted as TypeText keywords; character keys are inserted as literal text. As you are typing, you can select and edit your text in the text field.
To insert the TypeText statement into your script, click the Insert button.
Recording Mobile Buttons
In Capture mode, clicking a Mobile Button inserts a corresponding TypeText command into your script. For example, clicking the call button inserts TypeText CallButton
into your script. (The TypeText panel does not open.)
Automating Touch-Screen Actions
Each of the mouse events you use to operate a device’s touch screen has a corresponding script command (The commands are all standard mouse commands, which can be used in any Eggplant Functional script).
For information on the various mobile-related commands that can be used to automate against mobile devices, see Mobile Control and Touch Events.
TypeText Keywords for Mobile Control
Some hard keys on both Android and iOS devices require the use of TypeText Keywords for automation. For information on the various TypeText keywords used for mobile device control, see TypeText Keywords for Mobile Control.