Class MobileCommand

java.lang.Object
io.appium.java_client.MobileCommand
Direct Known Subclasses:
AndroidMobileCommandHelper, IOSMobileCommandHelper

public class MobileCommand extends 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
  • Field Details

  • Constructor Details

    • MobileCommand

      public MobileCommand()
  • Method Details

    • getC

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

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

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

      @Deprecated public static Map.Entry<String,Map<String,?>> hideKeyboardCommand(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 Map.Entry<String,Map<String,?>> hideKeyboardCommand(String strategy, 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

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

      @Deprecated public static com.google.common.collect.ImmutableMap<String,Object> prepareArguments(String[] params, 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 Map.Entry<String,Map<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 Map.Entry<String,Map<String,?>> pressKeyCodeCommand(int key, 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 Map.Entry<String,Map<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 Map.Entry<String,Map<String,?>> longPressKeyCodeCommand(int key, 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 Map.Entry<String,Map<String,?>> lockDeviceCommand(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 Map.Entry<String,Map<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 Map.Entry<String,Map<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 Map.Entry<String,Map<String,?>> getSettingsCommand()
    • setSettingsCommand

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

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

      @Deprecated public static Map.Entry<String,Map<String,?>> pushFileCommand(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 Map.Entry<String,Map<String,?>> startRecordingScreenCommand(BaseStartScreenRecordingOptions opts)
    • stopRecordingScreenCommand

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

      public static Map.Entry<String,Map<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 Map.Entry<String,Map<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.