TestComplete Android Agent includes the TestComplete Android Agent keyboard. If this keyboard is active, a tested Android device does not show its onscreen keyboard when text boxes get focus. Instead, it uses the invisible onscreen Agent keyboard for the text input.
You can make the TestComplete Android Agent keyboard a default keyboard on your device, or activate it from your test before running the test commands that need it and deactivate it after this.
Installing the Agent Keyboard
The TestComplete Android Agent keyboard is installed when you install TestComplete Android Agent on your device. See About TestComplete Android Agent.
When to Use the Agent Keyboard
We recommend that you use the Agent keyboard:
-
To record and simulate user input in your tested applications. See Simulating Local Symbol Input.
-
To simulate user input in controls located on a WebView control. Otherwise, TestComplete may fail to correctly determine the coordinates of subsequent user actions. To learn more, see the Keyboard Input Issues section in the Possible Issues With Android Applications topic.
-
To record user input in Xamarin.Forms applications running on Android devices. Otherwise, TestComplete may fail to record the user input for some text edit controls. See the Known Issues section in the About Xamarin.Forms Application Testing topic.
Setting the Agent Keyboard as the Default Keyboard
To make the TestComplete Android Agent keyboard the default keyboard on your test device:
-
Install the TestComplete Android Agent application on the device, if it is not installed yet.
-
Open the Agent.
-
Select Enable the Android Agent Keyboard.
Note: Android 5.1.1 (and later) asks for your confirmation to use the new keyboard (the input method). Select OK to confirm. -
Select TestComplete Android Agent in the Keyboard & Input Methods section. Select OK in the subsequent window and press Back.
-
Select Make the Agent Keyboard Default.
-
Select the multilingual keyboard emulator. The dialog will close automatically.
-
Exit the Agent application by pressing Back or Home.
Activating and Deactivating the Agent Keyboard From Tests
To enable the Agent keyboard from your test:
JavaScript, JScript
// Enable the Agent keyboard
Mobile.Device().ShellExecute("ime enable com.smartbear.androidagent/.keyboard.KeyboardEmulator");
Mobile.Device().ShellExecute("ime set com.smartbear.androidagent/.keyboard.KeyboardEmulator");
Python
# Enable the Agent keyboard
Mobile.Device().ShellExecute("ime enable com.smartbear.androidagent/.keyboard.KeyboardEmulator");
Mobile.Device().ShellExecute("ime set com.smartbear.androidagent/.keyboard.KeyboardEmulator");
VBScript
' Enable the Agent keyboard
Call Mobile.Device().ShellExecute("ime enable com.smartbear.androidagent/.keyboard.KeyboardEmulator")
Call Mobile.Device().ShellExecute("ime set com.smartbear.androidagent/.keyboard.KeyboardEmulator")
DelphiScript
// Enable the Agent keyboard
Mobile.Device().ShellExecute('ime enable com.smartbear.androidagent/.keyboard.KeyboardEmulator');
Mobile.Device().ShellExecute('ime set com.smartbear.androidagent/.keyboard.KeyboardEmulator');
C++Script, C#Script
// Enable the Agent keyboard
Mobile["Device"]()["ShellExecute"]("ime enable com.smartbear.androidagent/.keyboard.KeyboardEmulator");
Mobile["Device"]()["ShellExecute"]("ime set com.smartbear.androidagent/.keyboard.KeyboardEmulator");
To disable the Agent keyboard, use this code:
JavaScript, JScript
// Disable the Agent keyboard
Mobile.Device().ShellExecute("ime disable com.smartbear.androidagent/.keyboard.KeyboardEmulator");
Python
# Disable the Agent keyboard
Mobile.Device().ShellExecute("ime disable com.smartbear.androidagent/.keyboard.KeyboardEmulator");
VBScript
' Disable the Agent keyboard
Call Mobile.Device().ShellExecute("ime disable com.smartbear.androidagent/.keyboard.KeyboardEmulator")
DelphiScript
// Disable the Agent keyboard
Mobile.Device().ShellExecute('ime disable com.smartbear.androidagent/.keyboard.KeyboardEmulator');
C++Script, C#Script
// Disable the Agent keyboard
Mobile["Device"]()["ShellExecute"]("ime disable com.smartbear.androidagent/.keyboard.KeyboardEmulator");
See Also
About TestComplete Android Agent
Simulating Text Input on Android Devices
Simulating Text Input in Android Open Applications