Package 

Interface Keyboard


  • 
    public interface Keyboard
    
                        

    Use this API only if neither Espresso, nor UiAutomator work for some reasons. E.g. because of animations.

    Using this API is highly discouraged. Consider to use the built-in API whenever it's possible as it described in the documentation for methods.

    Required: Started AdbServer 1. Download a file "kaspresso/artifacts/adbserver-desktop.jar" 2. Start AdbServer => input in cmd "java jar path_to_file/adbserver-desktop.jar" Methods demanding to use AdbServer in the default implementation of this interface are marked. But nobody can't deprecate you to write implementation that doesn't require AdbServer.

    • Method Summary

      Modifier and Type Method Description
      abstract Unit typeText(String text) Types text char by char in the focused text field.
      abstract Unit sendEvent(Integer keyEvent) Sends a key event.
      • Methods inherited from class com.kaspersky.kaspresso.device.keyboard.Keyboard

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • typeText

         abstract Unit typeText(String text)

        Types text char by char in the focused text field. Use it only when Espresso or UiAutomator are not appropriate (e.g. when you are on the lock screen).

        Consider to use ViewActions.typeText. Also, consider to use UiObject.setText.

        Required Permissions: INTERNET

      • sendEvent

         abstract Unit sendEvent(Integer keyEvent)

        Sends a key event. Use constants from KeyEvent to get the code.

        Consider to use ViewActions.pressKey. Also, consider to use UiDevice.pressKeyCode, or more semantic methods like UiDevice.pressMenu, UiDevice.pressDPadLeft and so on.

        Required Permissions: INTERNET

        Parameters:
        keyEvent - the code from a KeyEvent constant to send on device.