Open topic with navigation

com.hp.lft.sdk

## Class SrfLab

- java.lang.Object
- - com.hp.lft.sdk.SrfLab

-     public class SrfLab
      extends java.lang.Object

  This class can be used to launch browsers or lock devices in the SRF lab.

- - ### Constructor Summary

    Constructor and Description
    `SrfLab()`

  - ### Method Summary

    Modifier and Type | Method and Description
    --- | ---
    `static Browser` | `launchBrowser(BrowserDescription description)` Launches a new browser tab returning an instance of `Browser` for the launched browser.
    `static Browser` | `launchBrowser(BrowserType browserType)` Launches a new browser tab returning an instance of `Browser` for the launched browser.
    `static Device` | `lockDevice(DeviceDescription description)` Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it.
    `static Device` | `lockDevice(DeviceDescription description, ApplicationDescription[] appsToInstall)` Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it.
    `static Device` | `lockDevice(DeviceDescription description, ApplicationDescription[] appsToInstall, DeviceSource deviceSource)` Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it.
    `static Device` | `lockDeviceById(java.lang.String deviceId)` Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it.
    `static Device` | `lockDevice(DeviceDescription description, DeviceSessionOptions sessionOptions)` Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it. Note: Supported in LeanFT 14.52 and later.
    `static void` | `releaseEnvironment(Browser browser)` Releases the allocated browser environment.
    `static void` | `releaseEnvironment(Device device)` Release the allocated device environment.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SrfLab

          public SrfLab()

  - ### Method Detail

    - #### launchBrowser

          public static Browser launchBrowser(BrowserType browserType)
                                       throws GeneralLeanFtException

      Launches a new browser tab returning an instance of `Browser` for the launched browser.
      The returned browser instance is valid until the tab is closed.
      Parameters:
        `browserType` - browserType of browser to launch. Possible values: `BrowserType`
      Returns:
        The `Browser` for the launched browser.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### launchBrowser

          public static Browser launchBrowser(BrowserDescription description)
                                       throws GeneralLeanFtException

      Launches a new browser tab returning an instance of `Browser` for the launched browser.
      The returned browser instance is valid until the tab is closed.
      Parameters:
        `description` - the description of the browser to launch.
      Returns:
        The `Browser` for the launched browser.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### lockDevice

          public static Device lockDevice(DeviceDescription description)
                                   throws GeneralLeanFtException

      Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it.
      Parameters:
        `description` - the description of the device to obtain.
      Returns:
        the requested device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution

    - #### lockDeviceById

          public static Device lockDeviceById(java.lang.String deviceId)
                                       throws GeneralLeanFtException

      Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it.
      Parameters:
        `deviceId` - the ID of the device in Mobile Center.
      Returns:
        the requested device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution

    - #### lockDevice

          public static Device lockDevice(DeviceDescription description,
                                          ApplicationDescription[] appsToInstall)
                                   throws GeneralLeanFtException

      Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it.
      Parameters:
        `description` - the description of the device to obtain.
        `appsToInstall` - an array of ApplicationDescription representing the applications to install.
      Returns:
        the requested device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution

    - #### lockDevice

          public static Device lockDevice(DeviceDescription description,
                                          ApplicationDescription[] appsToInstall,
                                          DeviceSource deviceSource)
                                   throws GeneralLeanFtException

      Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it.
      Parameters:
        `description` - the description of the device to obtain.
        `appsToInstall` - an array of ApplicationDescription representing the applications to install.
        `deviceSource` - the lab, platform, or service hosting the device.
      Returns:
        the requested device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution

    - #### lockDevice

      Supported in LeanFT versions 14.52 and later

          public static Device lockDevice(DeviceDescription description, DeviceSessionOptions sessionOptions)
          		throws GeneralLeanFtException

      Obtains a device from the Mobile Center lab and locks it so that only the current LeanFT test can perform actions on it.
      Parameters:
        `description` - the description of the device to obtain.
        `sessionOptions` - a DeviceSessionOptions object supplying session options.
      Returns:
        the requested device.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution

    - #### releaseEnvironment

          public static void releaseEnvironment(Browser browser)
                                         throws GeneralLeanFtException

      Releases the allocated browser environment.
      Parameters:
        `browser` - the browser environment to release.
      Throws:
        `GeneralLeanFtException`

    - #### releaseEnvironment

          public static void releaseEnvironment(Device device)
                                         throws GeneralLeanFtException

      Release the allocated device environment.
      Parameters:
        `device` - the device environment to release.
      Throws:
        `GeneralLeanFtException`