For security reasons, iOS does not allow direct access to the native keyboard. Ranorex provides a Virtual Keyboard that replicates the characteristics of the device keyboard so you can inspect and interact with keyboard keys in Ranorex Spy, and use them for testing and automation.
The Virtual Keyboard is supported only in native views. It does not work with web content or embedded webviews.
The Virtual Keyboard view is generated when one of these supported iOS controls becomes the active input field:
- TextField
- TextView
- SearchBar
Supported Keyboards
The Virtual Keyboard supports the following languages (currently supported locales):
en-USen-GBes-ESde-DEfr-FR
To use a specific language, ensure it is installed on your device or simulator:
Settings > General > Keyboard > Add New Keyboard
This feature supports these keyboard types (based on the active input field’s configuration):
KeyboardTypeDefaultKeyboardTypeNumbersAndPunctuationKeyboardTypeNumberPadKeyboardTypeEmailAddressKeyboardTypePhonePadKeyboardTypeDecimalPad
Refresh Ranorex Spy to Detect Changes
To see the Virtual Keyboard view and any changes you make to it, refresh Ranorex Spy as follows:
- Tap a supported input field (for example, a TextField) to bring up the system keyboard (this works on a simulator, device, or in Spy).
- In Ranorex Spy, click Refresh.
- Under the UIWindow container, a new Keyboard view appears. Select it to see the keyboard in the Spy render view.
Important Notes for Using the Virtual Keyboard
Here are some notes that are important to consider when using a Virtual Keyboard:
- When switching between alphabetic and numeric layouts, use the 123 button on the Virtual Keyboard. Switching layouts on the device keyboard is not reflected in Ranorex Spy.
- To use Shift, tap Shift on the Virtual Keyboard and then refresh Spy. This updates letters to uppercase/lowercase. Using Shift on the device keyboard is not reflected in Spy.
- To display special symbols, use #+= on the Virtual Keyboard. Special symbols entered using the device keyboard with this option will not appear in Ranorex Spy.
- The Return key dismisses the keyboard (and closes the device keyboard). After refreshing Spy, the Keyboard view is no longer visible.
- If a screen contains multiple input fields and you switch from one to another, refresh Spy to update the keyboard type for the active field so it is correctly identified in Spy.
- Virtual keyboard letters should be clicked on the selection of letter button, not the letter title.
Virtual Keyboard in Automation Testing
You can use Virtual Keyboard keys in automation by adding them to the repository and then using them like other mobile UI elements.
- In Ranorex Spy, locate the key under the Keyboard view (under UIWindow).
- Drag and drop the key into your repository to create a repository item for it.
- In your recording module, add a touch action for the repository item (as you would for any other component).
Result: The key exists as a repository item and can be used in your recording/module actions for mobile automation.