Class MobileCommand

  • Direct Known Subclasses:
    AndroidMobileCommandHelper, IOSMobileCommandHelper

    public class MobileCommand
    extends java.lang.Object
    The repository of mobile commands defined in the Mobile JSON wire protocol. Most of these commands are platform-specific obsolete things and should eventually be replaced with calls to corresponding `mobile:` extensions, so we don't abuse non-w3c APIs
    • Constructor Summary

      Constructors 
      Constructor Description
      MobileCommand()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> compareImagesCommand​(ComparisonMode mode, byte[] img1Data, byte[] img2Data, BaseComparisonOptions options)
      Forms a Map of parameters for images comparison.
      static AppiumCommandInfo deleteC​(java.lang.String url)
      This methods forms DELETE commands.
      static AppiumCommandInfo getC​(java.lang.String url)
      This methods forms GET commands.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> getIsDeviceLockedCommand()
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> getSettingsCommand()  
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> hideKeyboardCommand​(java.lang.String keyName)
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> hideKeyboardCommand​(java.lang.String strategy, java.lang.String keyName)
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> isKeyboardShownCommand()
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> lockDeviceCommand​(java.time.Duration duration)
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> longPressKeyCodeCommand​(int key)
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> longPressKeyCodeCommand​(int key, java.lang.Integer metastate)
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static AppiumCommandInfo postC​(java.lang.String url)
      This methods forms POST commands.
      static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> prepareArguments​(java.lang.String[] params, java.lang.Object[] values)
      Prepares collection of arguments.
      static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> prepareArguments​(java.lang.String param, java.lang.Object value)
      Prepares single argument.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> pressKeyCodeCommand​(int key)
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> pressKeyCodeCommand​(int key, java.lang.Integer metastate)
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> pushFileCommand​(java.lang.String remotePath, byte[] base64Data)
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> setSettingsCommand​(java.lang.String setting, java.lang.Object value)  
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> setSettingsCommand​(java.util.Map<java.lang.String,​java.lang.Object> settings)  
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> startRecordingScreenCommand​(BaseStartScreenRecordingOptions opts)  
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> stopRecordingScreenCommand​(BaseStopScreenRecordingOptions opts)  
      static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> unlockDeviceCommand()
      Deprecated.
      This helper is deprecated and will be removed in future versions.
      • Methods inherited from class java.lang.Object

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

      • RESET

        @Deprecated
        protected static final java.lang.String RESET
        Deprecated.
      • GET_STRINGS

        @Deprecated
        protected static final java.lang.String GET_STRINGS
        Deprecated.
      • SET_VALUE

        @Deprecated
        public static final java.lang.String SET_VALUE
        Deprecated.
      • PULL_FILE

        @Deprecated
        protected static final java.lang.String PULL_FILE
        Deprecated.
      • PULL_FOLDER

        @Deprecated
        protected static final java.lang.String PULL_FOLDER
        Deprecated.
      • RUN_APP_IN_BACKGROUND

        @Deprecated
        public static final java.lang.String RUN_APP_IN_BACKGROUND
        Deprecated.
      • PERFORM_TOUCH_ACTION

        @Deprecated
        protected static final java.lang.String PERFORM_TOUCH_ACTION
        Deprecated.
      • PERFORM_MULTI_TOUCH

        @Deprecated
        protected static final java.lang.String PERFORM_MULTI_TOUCH
        Deprecated.
      • LAUNCH_APP

        @Deprecated
        public static final java.lang.String LAUNCH_APP
        Deprecated.
      • CLOSE_APP

        @Deprecated
        public static final java.lang.String CLOSE_APP
        Deprecated.
      • GET_DEVICE_TIME

        @Deprecated
        protected static final java.lang.String GET_DEVICE_TIME
        Deprecated.
      • GET_SESSION

        @Deprecated
        protected static final java.lang.String GET_SESSION
        Deprecated.
      • LOG_EVENT

        protected static final java.lang.String LOG_EVENT
      • GET_EVENTS

        protected static final java.lang.String GET_EVENTS
      • IS_APP_INSTALLED

        @Deprecated
        protected static final java.lang.String IS_APP_INSTALLED
        Deprecated.
      • INSTALL_APP

        @Deprecated
        protected static final java.lang.String INSTALL_APP
        Deprecated.
      • ACTIVATE_APP

        @Deprecated
        protected static final java.lang.String ACTIVATE_APP
        Deprecated.
      • QUERY_APP_STATE

        @Deprecated
        protected static final java.lang.String QUERY_APP_STATE
        Deprecated.
      • TERMINATE_APP

        @Deprecated
        protected static final java.lang.String TERMINATE_APP
        Deprecated.
      • REMOVE_APP

        @Deprecated
        protected static final java.lang.String REMOVE_APP
        Deprecated.
      • GET_CLIPBOARD

        @Deprecated
        public static final java.lang.String GET_CLIPBOARD
        Deprecated.
      • SET_CLIPBOARD

        @Deprecated
        public static final java.lang.String SET_CLIPBOARD
        Deprecated.
      • GET_PERFORMANCE_DATA

        @Deprecated
        protected static final java.lang.String GET_PERFORMANCE_DATA
        Deprecated.
      • GET_SUPPORTED_PERFORMANCE_DATA_TYPES

        @Deprecated
        protected static final java.lang.String GET_SUPPORTED_PERFORMANCE_DATA_TYPES
        Deprecated.
      • START_RECORDING_SCREEN

        @Deprecated
        public static final java.lang.String START_RECORDING_SCREEN
        Deprecated.
      • STOP_RECORDING_SCREEN

        @Deprecated
        public static final java.lang.String STOP_RECORDING_SCREEN
        Deprecated.
      • HIDE_KEYBOARD

        @Deprecated
        protected static final java.lang.String HIDE_KEYBOARD
        Deprecated.
      • LOCK

        @Deprecated
        protected static final java.lang.String LOCK
        Deprecated.
      • SHAKE

        @Deprecated
        protected static final java.lang.String SHAKE
        Deprecated.
      • TOUCH_ID

        @Deprecated
        protected static final java.lang.String TOUCH_ID
        Deprecated.
      • TOUCH_ID_ENROLLMENT

        @Deprecated
        protected static final java.lang.String TOUCH_ID_ENROLLMENT
        Deprecated.
      • CURRENT_ACTIVITY

        @Deprecated
        public static final java.lang.String CURRENT_ACTIVITY
        Deprecated.
      • END_TEST_COVERAGE

        @Deprecated
        protected static final java.lang.String END_TEST_COVERAGE
        Deprecated.
      • GET_DISPLAY_DENSITY

        @Deprecated
        protected static final java.lang.String GET_DISPLAY_DENSITY
        Deprecated.
      • GET_NETWORK_CONNECTION

        @Deprecated
        protected static final java.lang.String GET_NETWORK_CONNECTION
        Deprecated.
      • GET_SYSTEM_BARS

        @Deprecated
        protected static final java.lang.String GET_SYSTEM_BARS
        Deprecated.
      • IS_KEYBOARD_SHOWN

        @Deprecated
        protected static final java.lang.String IS_KEYBOARD_SHOWN
        Deprecated.
      • IS_LOCKED

        @Deprecated
        protected static final java.lang.String IS_LOCKED
        Deprecated.
      • LONG_PRESS_KEY_CODE

        @Deprecated
        public static final java.lang.String LONG_PRESS_KEY_CODE
        Deprecated.
      • FINGER_PRINT

        @Deprecated
        protected static final java.lang.String FINGER_PRINT
        Deprecated.
      • OPEN_NOTIFICATIONS

        @Deprecated
        protected static final java.lang.String OPEN_NOTIFICATIONS
        Deprecated.
      • PRESS_KEY_CODE

        @Deprecated
        public static final java.lang.String PRESS_KEY_CODE
        Deprecated.
      • PUSH_FILE

        @Deprecated
        protected static final java.lang.String PUSH_FILE
        Deprecated.
      • SET_NETWORK_CONNECTION

        @Deprecated
        protected static final java.lang.String SET_NETWORK_CONNECTION
        Deprecated.
      • START_ACTIVITY

        @Deprecated
        protected static final java.lang.String START_ACTIVITY
        Deprecated.
      • TOGGLE_LOCATION_SERVICES

        @Deprecated
        protected static final java.lang.String TOGGLE_LOCATION_SERVICES
        Deprecated.
      • UNLOCK

        @Deprecated
        protected static final java.lang.String UNLOCK
        Deprecated.
      • REPLACE_VALUE

        @Deprecated
        public static final java.lang.String REPLACE_VALUE
        Deprecated.
      • GET_SETTINGS

        protected static final java.lang.String GET_SETTINGS
      • SET_SETTINGS

        @Deprecated
        protected static final java.lang.String SET_SETTINGS
        Deprecated.
      • GET_CURRENT_PACKAGE

        @Deprecated
        public static final java.lang.String GET_CURRENT_PACKAGE
        Deprecated.
      • SEND_SMS

        @Deprecated
        public static final java.lang.String SEND_SMS
        Deprecated.
      • GSM_CALL

        @Deprecated
        public static final java.lang.String GSM_CALL
        Deprecated.
      • GSM_SIGNAL

        @Deprecated
        public static final java.lang.String GSM_SIGNAL
        Deprecated.
      • GSM_VOICE

        @Deprecated
        public static final java.lang.String GSM_VOICE
        Deprecated.
      • NETWORK_SPEED

        @Deprecated
        public static final java.lang.String NETWORK_SPEED
        Deprecated.
      • POWER_CAPACITY

        @Deprecated
        public static final java.lang.String POWER_CAPACITY
        Deprecated.
      • POWER_AC_STATE

        @Deprecated
        public static final java.lang.String POWER_AC_STATE
        Deprecated.
      • TOGGLE_WIFI

        @Deprecated
        protected static final java.lang.String TOGGLE_WIFI
        Deprecated.
      • TOGGLE_AIRPLANE_MODE

        @Deprecated
        protected static final java.lang.String TOGGLE_AIRPLANE_MODE
        Deprecated.
      • TOGGLE_DATA

        @Deprecated
        protected static final java.lang.String TOGGLE_DATA
        Deprecated.
      • COMPARE_IMAGES

        protected static final java.lang.String COMPARE_IMAGES
      • EXECUTE_DRIVER_SCRIPT

        protected static final java.lang.String EXECUTE_DRIVER_SCRIPT
      • GET_ALLSESSION

        @Deprecated
        protected static final java.lang.String GET_ALLSESSION
        Deprecated.
      • EXECUTE_GOOGLE_CDP_COMMAND

        protected static final java.lang.String EXECUTE_GOOGLE_CDP_COMMAND
      • commandRepository

        public static final java.util.Map<java.lang.String,​org.openqa.selenium.remote.CommandInfo> commandRepository
    • Constructor Detail

      • MobileCommand

        public MobileCommand()
    • Method Detail

      • getC

        public static AppiumCommandInfo getC​(java.lang.String url)
        This methods forms GET commands.
        Parameters:
        url - is the command URL
        Returns:
        an instance of CommandInfo
      • postC

        public static AppiumCommandInfo postC​(java.lang.String url)
        This methods forms POST commands.
        Parameters:
        url - is the command URL
        Returns:
        an instance of CommandInfo
      • deleteC

        public static AppiumCommandInfo deleteC​(java.lang.String url)
        This methods forms DELETE commands.
        Parameters:
        url - is the command URL
        Returns:
        an instance of CommandInfo
      • hideKeyboardCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> hideKeyboardCommand​(java.lang.String keyName)
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the keyboard hiding.
        Parameters:
        keyName - The button pressed by the mobile driver to attempt hiding the keyboard.
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • hideKeyboardCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> hideKeyboardCommand​(java.lang.String strategy,
                                                                                                                              java.lang.String keyName)
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the keyboard hiding.
        Parameters:
        strategy - HideKeyboardStrategy.
        keyName - a String, representing the text displayed on the button of the keyboard you want to press. For example: "Done".
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • prepareArguments

        public static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> prepareArguments​(java.lang.String param,
                                                                                                                       java.lang.Object value)
        Prepares single argument.
        Parameters:
        param - is a parameter name.
        value - is the parameter value.
        Returns:
        built ImmutableMap.
      • prepareArguments

        public static com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.Object> prepareArguments​(java.lang.String[] params,
                                                                                                                       java.lang.Object[] values)
        Prepares collection of arguments.
        Parameters:
        params - is the array with parameter names.
        values - is the array with parameter values.
        Returns:
        built ImmutableMap.
      • pressKeyCodeCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> pressKeyCodeCommand​(int key)
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the key event invocation.
        Parameters:
        key - code for the key pressed on the device.
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • pressKeyCodeCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> pressKeyCodeCommand​(int key,
                                                                                                                              java.lang.Integer metastate)
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the key event invocation.
        Parameters:
        key - code for the key pressed on the Android device.
        metastate - metastate for the keypress.
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • longPressKeyCodeCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> longPressKeyCodeCommand​(int key)
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the long key event invocation.
        Parameters:
        key - code for the long key pressed on the device.
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • longPressKeyCodeCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> longPressKeyCodeCommand​(int key,
                                                                                                                                  java.lang.Integer metastate)
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the long key event invocation.
        Parameters:
        key - code for the long key pressed on the Android device.
        metastate - metastate for the long key press.
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • lockDeviceCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> lockDeviceCommand​(java.time.Duration duration)
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the device locking.
        Parameters:
        duration - for how long to lock the screen for. Minimum time resolution is one second
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • unlockDeviceCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> unlockDeviceCommand()
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the device unlocking.
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • getIsDeviceLockedCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> getIsDeviceLockedCommand()
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the device locked query.
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • getSettingsCommand

        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> getSettingsCommand()
      • setSettingsCommand

        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> setSettingsCommand​(java.lang.String setting,
                                                                                                                             java.lang.Object value)
      • setSettingsCommand

        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> setSettingsCommand​(java.util.Map<java.lang.String,​java.lang.Object> settings)
      • pushFileCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> pushFileCommand​(java.lang.String remotePath,
                                                                                                                          byte[] base64Data)
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the file pushing.
        Parameters:
        remotePath - Path to file to write data to on remote device
        base64Data - Base64 encoded byte array of data to write to remote device
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.
      • startRecordingScreenCommand

        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> startRecordingScreenCommand​(BaseStartScreenRecordingOptions opts)
      • stopRecordingScreenCommand

        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> stopRecordingScreenCommand​(BaseStopScreenRecordingOptions opts)
      • compareImagesCommand

        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> compareImagesCommand​(ComparisonMode mode,
                                                                                                                               byte[] img1Data,
                                                                                                                               byte[] img2Data,
                                                                                                                               @Nullable
                                                                                                                               BaseComparisonOptions options)
        Forms a Map of parameters for images comparison.
        Parameters:
        mode - one of possible comparison modes
        img1Data - base64-encoded data of the first image
        img2Data - base64-encoded data of the second image
        options - comparison options
        Returns:
        key-value pairs
      • isKeyboardShownCommand

        @Deprecated
        public static java.util.Map.Entry<java.lang.String,​java.util.Map<java.lang.String,​?>> isKeyboardShownCommand()
        Deprecated.
        This helper is deprecated and will be removed in future versions.
        This method forms a Map of parameters for the checking of the keyboard state (is it shown or not).
        Returns:
        a key-value pair. The key is the command name. The value is a Map command arguments.