Open topic with navigation

com.hp.lft.sdk.mobile

## Interface Device

- All Superinterfaces:
    Environment, TestObject, TestObjectDescriber

      public interface Device
      extends TestObject, Environment

  A mobile device.

- - ### Method Summary

    Modifier and Type | Method and Description
    --- | ---
    `void` | `back()` Presses the device's Back button (Android Only).
    `void` | `closeViewer()` Closes the RDP window for the device (if open).
    `java.lang.String` | `getId()` Returns the ID of the device in Mobile Center.
    `java.lang.String` | `getLogs()` Returns the device logs collected from the moment the device was locked.
    `java.lang.String` | `getManufacturer()` Returns the manufacturer of the device.
    `java.lang.String` | `getModel()` Returns the model name of the device.
    `java.lang.String` | `getName()` Returns name of the device as defined in Mobile Center.
    `java.lang.String` | `getOSType()` Returns the operating system currently running on the device.
    `java.lang.String` | `getOSVersion()` Returns the operating system version currently running on the device.
    `DeviceSource` | `getSource()` The source to take the device from
    `static SvInfo` | `getSvInfo()` Returns Service Virtualization Server info. Supported in LeanFT versions 14.53 and later.
    `java.lang.String` | `getVitals()` Returns an accumulation of the device vitals from the time the device was locked, in one second intervals.
    `void` | `home()` Presses the device's Home button (Android Only).
    `boolean` | `isViewerOpen()` Checks if the RDP window for the device is open.
    `void` | `menu()` Presses the device's Menu button (Android Only).
    `void` | `networkVirtualizationStart(java.lang.String profile)` Starts the Network Virtualization service using the specified network profile.
    `void` | `networkVirtualizationStop()` Stops the Network Virtualization service
    `void` | `openViewer()` Opens an RDP window for the device.
    `void` | `recentApps()` Opens the list of recent applications (Android Only).
    `void` | `sendKey(Keys key)` Simulates pressing a special key in the device keyboard.
    `void` | `sendKey(Keys key, int duration)` Simulates pressing a special key in the device keyboard, with the option to define the time to keep the key pressed.
    `void` | `sendKey(java.lang.String keyId)` Simulates pressing a custom device key.
    `void` | `sendKey(java.lang.String keyId, int duration)` Simulate pressing a custom device key, with the option to define the time to keep the key pressed.
    `void` | `sendString(java.lang.String text)` Simulates entering text (a string) using the device keyboard.
    `void` | `sendString(java.lang.String text, int interval)` Simulates entering text (a string) using the device keyboard, with the option to send each of the string characters in intervals of n milliseconds.
    `void` | `setOrientation(DeviceOrientation orientation)` Sets the device orientation.
    `void` | `shake()` Performs a Shake gesture on the device (iOS Only).
    `void` | `simulateGPSRelocate(double latitude, double longitude)` Simulates a change in the device's GPS location (Android Only).
    `void` | `simulateIncomingCall(java.lang.String from)` Simulates an incoming call.
    `void` | `simulateIncomingCall(java.lang.String from, EventResponseArgs eventResponseArgs)` Simulates an incoming call with an optional simulated user response.
    `void` | `simulateIncomingSMS(java.lang.String from, java.lang.String text)` Simulates an incoming SMS.
    `void` | `simulateIncomingSMS(java.lang.String from, java.lang.String text, EventResponseArgs eventResponseArgs)` Simulates an incoming SMS with an optional simulated user response.
    `java.lang.String` | `svUploadScenario(java.lang.String svServiceId, java.lang.String scenarioFilesFolder)` Uploads scenario definition files to the device and makes them available in the current session. Supported in LeanFT versions 14.51 and later.
    `java.lang.String` | `svUploadService(java.lang.String serviceFileContents)` Uploads a service definition file to the device and makes it available in the current session. Supported in LeanFT versions 14.51 and later.
    `void` | `svStartScenario(java.lang.String svScenarioId)` Starts a specific service virtualization scenario. Supported in LeanFT versions 14.51 and later.
    `void` | `svStopScenario(java.lang.String svScenarioId)` Stops a specific service virtualization scenario. Supported in LeanFT versions 14.51 and later.
    `void` | `swipe(SwipeDirection direction)` Swipes the device in the specified direction starting from the leading edge of the element or device.
    `void` | `swipe(SwipeDirection direction, Location startLocation)` Swipes the device in the specified direction starting from the specified location.
    `void` | `touch(int x, int y)` Touches the device at the specified coordinates (Android Only).
    `void` | `touch(java.awt.Point point)` Touches the device at the specified point (Android Only).
    `void` | `unlock()` Unlocks the device in Mobile Center if it is not locked by another device object.
    `void` | `uploadMedia(java.awt.image.RenderedImage image, ImageFormat imageFormat, java.lang.String mediaID)` Upload an image to the device for camera simulation.
    `void` | `uploadMedia(java.awt.image.RenderedImage image, ImageFormat imageFormat, java.lang.String mediaID, MediaUploadOptions options)` Upload an image to the device for camera simulation, with the option to save the file.
    `void` | `uploadMedia(java.lang.String mediaUrl, java.lang.String mediaID)` Upload a media file to the device for camera or video simulation.
    `void` | `uploadMedia(java.lang.String mediaUrl, java.lang.String mediaID, MediaUploadOptions options)` Upload a media file to the device for camera or video simulation, with the option to save the file.
    `void` | `uploadMedia(java.net.URL mediaUrl, java.lang.String mediaID)` Upload a media file to the device for camera or video simulation.
    `void` | `uploadMedia(java.net.URL mediaUrl, java.lang.String mediaID, MediaUploadOptions options)` Upload a media file to the device for camera or video simulation, with the option to save the file.
    `void` | `uploadMedia(VideoData videoData, java.lang.String mediaID)` Upload a video to the device for video simulation.
    `void` | `uploadMedia(VideoData videoData, java.lang.String mediaID, MediaUploadOptions options)` Upload a video to the device for video simulation, with the option to save the file.

    - ### Methods inherited from interface com.hp.lft.sdk.TestObject

      `exists, exists, findChildren, getDescription, getDisplayName, getParent, getSnapshot, getTextLocations, getTextLocations, getVisibleText, getVisibleText, highlight, highlightMatches, setDescription, setDisplayName, verifyImageExists, verifyImageExists, verifyImageMatch, verifyImageMatch, verifyImageMatch, verifyImageMatch, verifyImageMatch, verifyImageMatch, waitUntilExists, waitUntilExists`

    - ### Methods inherited from interface com.hp.lft.sdk.TestObjectDescriber

      `describe`

- - ### Method Detail

    - #### getId

          java.lang.String getId()
                          throws GeneralLeanFtException

      Returns the ID of the device in Mobile Center.
      Returns:
        the ID of the device in Mobile Center.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getModel

          java.lang.String getModel()
                             throws GeneralLeanFtException

      Returns the model name of the device.
      Returns:
        the model name of the device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getManufacturer

          java.lang.String getManufacturer()
                                    throws GeneralLeanFtException

      Returns the manufacturer of the device.
      Returns:
        the manufacturer of the device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getOSType

          java.lang.String getOSType()
                              throws GeneralLeanFtException

      Returns the operating system currently running on the device.
      Returns:
        the operating system currently running on the device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getOSVersion

          java.lang.String getOSVersion()
                                 throws GeneralLeanFtException

      Returns the operating system version currently running on the device.
      Returns:
        the operating system version currently running on the device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getName

          java.lang.String getName()
                            throws GeneralLeanFtException

      Returns name of the device as defined in Mobile Center.
      Returns:
        the name of the device as defined in Mobile Center.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getSource

                                                      DeviceSource getSource()
                          throws GeneralLeanFtException

      The source to take the device from
      Returns:
        the `DeviceSource` to take the device from
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### home

          void home()
             throws GeneralLeanFtException

      Presses the device's Home button (Android Only).
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### back

          void back()
             throws GeneralLeanFtException

      Presses the device's Back button (Android Only).
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### menu

          void menu()
             throws GeneralLeanFtException

      Presses the device's Menu button (Android Only).
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### recentApps

          void recentApps()
                   throws GeneralLeanFtException

      Opens the list of recent applications (Android Only).
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### setOrientation

          void setOrientation(DeviceOrientation orientation)
                       throws GeneralLeanFtException

      Sets the device orientation.
      Parameters:
        `orientation` - the `DeviceOrientation` to set on the device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### touch

          void touch(int x,
                     int y)
              throws GeneralLeanFtException

      Touches the device at the specified coordinates (Android Only).
      Parameters:
        `x` - the x coordinate to touch.
        `y` - the y coordinate to touch.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### touch

          void touch(java.awt.Point point)
              throws GeneralLeanFtException

      Touches the device at the specified point (Android Only).
      Parameters:
        `point` - the point to touch.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### swipe

          void swipe(SwipeDirection direction)
              throws GeneralLeanFtException

      Swipes the device in the specified direction starting from the leading edge of the element or device.
      Parameters:
        `direction` - the `SwipeDirection`.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### swipe

          void swipe(SwipeDirection direction,
                     Location startLocation)
              throws GeneralLeanFtException

      Swipes the device in the specified direction starting from the specified location.
      Parameters:
        `direction` - the `SwipeDirection`.
        `startLocation` - the `Location` coordinates at which to start the swipe.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### svStopScenario

          void svStopScenario(java.lang.String svScenarioId)
          	throws GeneralLeanFtException

      Stops a specific service virtualization scenario.
      Note: Supported in LeanFT versions 14.51 and later.
      Parameters:
        `svScenarioId` - the ID of the relevant scenario, as returned by svUploadScenario.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### svStartScenario

          void svStartScenario(java.lang.String svScenarioId)
          	throws GeneralLeanFtException

      Starts a specific service virtualization scenario.
      Note: Supported in LeanFT versions 14.51 and later.
      Parameters:
        `svScenarioId` - the ID of the relevant scenario, as returned by svUploadScenario.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### svUploadService

          java.lang.String svUploadService(java.lang.String serviceFileContents)
          	throws GeneralLeanFtException

      Uploads a service definition file to the device and makes it available in the current session.
      Note: Supported in LeanFT versions 14.51 and later.
      Parameters:
        `serviceFileContents` - the contents of the service definition text file as a string.
      Returns:
        A string representing the ID of the uploaded service.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### svUploadScenario

          java.lang.String svUploadScenario(java.lang.String svServiceId,
          				   java.lang.String scenarioFilesFolder)
                throws GeneralLeanFtException

      Uploads scenario definition files to the device and makes them available in the current session.
      Note: Supported in LeanFT versions 14.51 and later.
      Parameters:
        `svServiceId` - the ID of the relevant service, as returned by svUploadService.
        `scenarioFilesFolder` - the full path to the folder that contains the scenario definition files.
      Returns:
        A string representing the ID of the uploaded scenario.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### simulateGPSRelocate

          void simulateGPSRelocate(double latitude,
                                   double longitude)
                            throws GeneralLeanFtException

      Simulates a change in the device's GPS location (Android Only).
      Parameters:
        `latitude` - the latitude coordinate of the location.
        `longitude` - the longitude coordinate of the location.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### simulateIncomingCall

          void simulateIncomingCall(java.lang.String from)
                             throws GeneralLeanFtException

      Simulates an incoming call.
      Parameters:
        `from` - the caller ID of the incoming call.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### simulateIncomingCall

          void simulateIncomingCall(java.lang.String from,
                                    EventResponseArgs eventResponseArgs)
                             throws GeneralLeanFtException

      Simulates an incoming call with an optional simulated user response.
      Parameters:
        `from` - the caller ID of the incoming call.
        `eventResponseArgs` - the simulated user response `EventResponseArgs` to the incoming call that interrupts the flow of the application.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### simulateIncomingSMS

          void simulateIncomingSMS(java.lang.String from,
                                   java.lang.String text)
                            throws GeneralLeanFtException

      Simulates an incoming SMS.
      Parameters:
        `from` - the caller ID of the incoming SMS message.
        `text` - the text of the incoming SMS message.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### simulateIncomingSMS

          void simulateIncomingSMS(java.lang.String from,
                                   java.lang.String text,
                                   EventResponseArgs eventResponseArgs)
                            throws GeneralLeanFtException

      Simulates an incoming SMS with an optional simulated user response.
      Parameters:
        `from` - the caller ID of the incoming SMS message.
        `text` - the text of the incoming SMS message.
        `eventResponseArgs` - the simulated user response `EventResponseArgs` to the incoming SMS that interrupts the flow of the application.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### networkVirtualizationStart

          void networkVirtualizationStart(java.lang.String profile)
                                   throws GeneralLeanFtException

      Starts the Network Virtualization service using the specified network profile.
      Parameters:
        `profile` - the name of the profile containing the conditions that you want to apply to the virtualized network. The profile must be set up on the Network Virtualization product.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### networkVirtualizationStop

          void networkVirtualizationStop()
                                  throws GeneralLeanFtException

      Stops the Network Virtualization service
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### shake

          void shake()
              throws GeneralLeanFtException

      Performs a Shake gesture on the device (iOS Only).
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### openViewer

          void openViewer()
                   throws GeneralLeanFtException

      Opens an RDP window for the device. If a window for the device is open already, another window will not open.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### closeViewer

          void closeViewer()
                    throws GeneralLeanFtException

      Closes the RDP window for the device (if open). Calling this method does not release the device locking.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### isViewerOpen

          boolean isViewerOpen()
                        throws GeneralLeanFtException

      Checks if the RDP window for the device is open.
      Returns:
        true if the RDP window is open, false otherwise.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getLogs

          java.lang.String getLogs()
                            throws GeneralLeanFtException

      Returns the device logs collected from the moment the device was locked.
      Returns:
        the device logs collected from the moment the device was locked.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getSvInfo

      Supported in LeanFT versions 14.53 and later.

          public static SvInfo getSvInfo()
          	throws GeneralLeanFtException

      Returns Service Virtualization Server info

      Returns:
        Object of type SvInfo, containing Service Virtualization information
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getVitals

          java.lang.String getVitals()
                              throws GeneralLeanFtException

      Returns an accumulation of the device vitals from the time the device was locked, in one second intervals.
      Returns:
        the device vitals collected since the device was locked.
      Throws:
        `GeneralLeanFtException`

    - #### unlock

          void unlock()
               throws GeneralLeanFtException

      Unlocks the device in Mobile Center if it is not locked by another device object. This method also closes the RDP window.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### sendString

          void sendString(java.lang.String text)
                   throws GeneralLeanFtException

      Simulates entering text (a string) using the device keyboard.
      Parameters:
        `text` - The text to send to the device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### sendString

          void sendString(java.lang.String text,
                          int interval)
                   throws GeneralLeanFtException

      Simulates entering text (a string) using the device keyboard, with the option to send each of the string characters in intervals of n milliseconds.
      Parameters:
        `text` - The text to send to the device.
        `interval` - The time (in milliseconds) to wait before injecting each subsequent character. The value must be between 200 and 3000, or 0 (default), otherwise an exception is thrown.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### sendKey

          void sendKey(Keys key)
                throws GeneralLeanFtException

      Simulates pressing a special key in the device keyboard.
      Parameters:
        `key` - The key to be pressed.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### sendKey

          void sendKey(Keys key,
                       int duration)
                throws GeneralLeanFtException

      Simulates pressing a special key in the device keyboard, with the option to define the time to keep the key pressed.
      Parameters:
        `key` - The key to be pressed.
        `duration` - The time (in milliseconds) to keep the key pressed. The default is 0 (zero).
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### sendKey

          void sendKey(java.lang.String keyId)
                throws GeneralLeanFtException

      Simulates pressing a custom device key.
      Parameters:
        `keyId` - The ID of the key as defined by the device manufacturer.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### sendKey

          void sendKey(java.lang.String keyId,
                       int duration)
                throws GeneralLeanFtException

      Simulate pressing a custom device key, with the option to define the time to keep the key pressed.
      Parameters:
        `keyId` - the ID of the key as defined by the device manufacturer.
        `duration` - The time (in milliseconds) to keep the key pressed. The default is 0 (zero).
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### uploadMedia

          void uploadMedia(java.net.URL mediaUrl,
                           java.lang.String mediaID)
                    throws GeneralLeanFtException

      Upload a media file to the device for camera or video simulation. The files are deleted when the device is released.
      Parameters:
        `mediaUrl` - The URL, including the extention, of the media file (image or video). Supported formats: JPG, GIF, PNG, BMP, TIF (iOS only), MP4, 3GP (Android only), MKV (Android only), MOV (iOS only), M4V (iOS only).
        `mediaID` - The unique ID of the uploaded media. The ID is used to start the simulation using Application.StartCameraSimulationMode.
      Throws:
        `GeneralLeanFtException`

    - #### uploadMedia

          void uploadMedia(java.net.URL mediaUrl,
                           java.lang.String mediaID,
                           MediaUploadOptions options)
                    throws GeneralLeanFtException

      Upload a media file to the device for camera or video simulation, with the option to save the file. The files are deleted when the device is released.
      Parameters:
        `mediaUrl` - The URL, including the extention, of the media file (image or video). Supported formats: JPG, GIF, PNG, BMP, TIF (iOS only), MP4, 3GP (Android only), MKV (Android only), MOV (iOS only), M4V (iOS only).
        `mediaID` - The unique ID of the uploaded media. The ID is used to start the simulation using Application.StartCameraSimulationMode.
        `options` - Upload options.
      Throws:
        `GeneralLeanFtException`

    - #### uploadMedia

          void uploadMedia(java.lang.String mediaUrl,
                           java.lang.String mediaID)
                    throws GeneralLeanFtException

      Upload a media file to the device for camera or video simulation. The files are deleted when the device is released.
      Parameters:
        `mediaUrl` - The URL, including the extention, of the media file (image or video). Supported formats: JPG, GIF, PNG, BMP, TIF (iOS only), MP4, 3GP (Android only), MKV (Android only), MOV (iOS only), M4V (iOS only).
        `mediaID` - The unique ID of the uploaded media. The ID is used to start the simulation using Application.StartCameraSimulationMode.
      Throws:
        `GeneralLeanFtException`

    - #### uploadMedia

          void uploadMedia(java.lang.String mediaUrl,
                           java.lang.String mediaID,
                           MediaUploadOptions options)
                    throws GeneralLeanFtException

      Upload a media file to the device for camera or video simulation, with the option to save the file. The files are deleted when the device is released.
      Parameters:
        `mediaUrl` - The URL, including the extention, of the media file (image or video). Supported formats: JPG, GIF, PNG, BMP, TIF (iOS only), MP4, 3GP (Android only), MKV (Android only), MOV (iOS only), M4V (iOS only).
        `mediaID` - The unique ID of the uploaded media. The ID is used to start the simulation using Application.StartCameraSimulationMode.
        `options` - Upload options.
      Throws:
        `GeneralLeanFtException`

    - #### uploadMedia

          void uploadMedia(java.awt.image.RenderedImage image,
                           ImageFormat imageFormat,
                           java.lang.String mediaID)
                    throws GeneralLeanFtException

      Upload an image to the device for camera simulation. The file is deleted when the device is released.
      Parameters:
        `image` - The image file.
        `imageFormat` - The image format type. Supported formats: JPG, GIF, PNG, BMP, TIF (iOS only).
        `mediaID` - The unique ID of the uploaded media. The ID is used to start the simulation using Application.StartCameraSimulationMode.
      Throws:
        `GeneralLeanFtException`

    - #### uploadMedia

          void uploadMedia(java.awt.image.RenderedImage image,
                           ImageFormat imageFormat,
                           java.lang.String mediaID,
                           MediaUploadOptions options)
                    throws GeneralLeanFtException

      Upload an image to the device for camera simulation, with the option to save the file. The files are deleted when the device is released.
      Parameters:
        `image` - The image file.
        `imageFormat` - The image format type. Supported formats: JPG, GIF, PNG, BMP, TIF (iOS only).
        `mediaID` - The unique ID of the uploaded image. The ID is used to start the simulation using Application.StartCameraSimulationMode.
        `options` - Upload options.
      Throws:
        `GeneralLeanFtException`

    - #### uploadMedia

          void uploadMedia(VideoData videoData,
                           java.lang.String mediaID)
                    throws GeneralLeanFtException

      UUpload a video to the device for video simulation. The file is deleted when the device is released.
      Parameters:
        `videoData` - Video file data. Supported formats: MP4, 3GP (Android only), MKV (Android only), MOV (iOS only), M4V (iOS only).
        `mediaID` - The unique ID of the uploaded video. The ID is used to start the simulation using Application.StartCameraSimulationMode.
      Throws:
        `GeneralLeanFtException`

    - #### uploadMedia

          void uploadMedia(VideoData videoData,
                           java.lang.String mediaID,
                           MediaUploadOptions options)
                    throws GeneralLeanFtException

      Upload a video to the device for video simulation, with the option to save the file. The file is deleted when the device is released.
      Parameters:
        `videoData` - Video file data. Supported formats: MP4, 3GP (Android only), MKV (Android only), MOV (iOS only), M4V (iOS only).
        `mediaID` - The unique ID of the uploaded video. The ID is used to start the simulation using Application.StartCameraSimulationMode.
        `options` - Upload options.
      Throws:
        `GeneralLeanFtException`