Share this page

com.hp.lft.sdk.web

## Class BrowserFactory

- java.lang.Object
- - com.hp.lft.sdk.web.BrowserFactory

-     public class BrowserFactory
      extends Object

  A class for creating a `Browser` instance.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BrowserFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Browser` | `attach(BrowserDescription description)` Attaches a new `Browser` instance to a previously opened browser tab.
    `static Browser[]` | `getAllOpenBrowsers(BrowserDescription description)` Returns an array of all open browsers that match the given `BrowserDescription`.
    `static Browser` | `launch(BrowserDescription browserDesc)` Launches a new browser tab returning an instance of `Browser` for the launched browser.
    `static Browser` | `launch(BrowserDescription browserDesc, Environment env)` Launches a new browser tab on the specified environment and returns an instance of `Browser` for the launched browser.
    `static Browser` | `launch(BrowserType browserType)` Launches a new browser tab returning an instance of `Browser` for the launched browser.
    `static Browser` | `launch(BrowserType browserType, Environment environment)` Launches a new browser tab on the specified environment and returns an instance of `Browser` for the launched browser.

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

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

- - ### Constructor Detail

    - #### BrowserFactory

          public BrowserFactory()

  - ### Method Detail

    - #### launch

          public static Browser launch(BrowserType browserType)
                                throws GeneralLeanFtException

      Launches a new browser tab returning an instance of `Browser` for the launched browser.
      When working in a grid configuration UFT Developer locks an environment that has this browser.
      The returned browser instance is valid until the tab is closed.
      Parameters:
        `browserType` - The type of browser to launch. Possible values: `BrowserType`
      Returns:
        The `Browser` for the launched browser.
      Throws:
        `GeneralLeanFtException` - if error occurs during execution

    - #### launch

          public static Browser launch(BrowserType browserType,
                       Environment environment)
                                throws GeneralLeanFtException

      Launches a new browser tab on the specified environment and returns an instance of `Browser` for the launched browser.
      The returned browser instance is valid until the tab is closed.
      Parameters:
        `browserType` - The type of browser to launch. Possible values: `BrowserType`
        `environment` - The environment on which to open the browser. When working in a grid configuration, this is an environment previously locked using EnvironmentFactory.get.
      Returns:
        The `Browser` for the launched browser.
      Throws:
        `GeneralLeanFtException` - if error occurs during execution.

    - #### launch

          public static Browser launch(BrowserDescription browserDesc)
                                throws GeneralLeanFtException

      Launches a new browser tab returning an instance of `Browser` for the launched browser.
      When working in a grid configuration, the browser description can also include capabilities that describe an environment. For details on how to describe the capabilities, see https://admhelp.microfocus.com/uftdev/en/latest/HelpCenter/Content/HowTo/LeanFT-grid-ready-tests.htm#Build.
      UFT Developer locks an environment that matches the browserDesc argument and launches the specified browser on that environment. The returned browser instance is valid until the tab is closed.
      Parameters:
        `browserDesc` - The description of the browser to launch. When working in a grid configuration you can add environment capabilities to this argument.
        For Chrome and Firefox, the browserDesc can include the following capability definitions:
        - A profile_proxy capability, which specifies the address of a web proxy for the browser to use. This results in the use of a separate browser profile, which does not share cookies an so on with the default browsers.
        - A profile capability, set to `true` instructing UFT Developer to open the browser with a temporary profile, or `false` to use the browser's default profile behavior. The default value for the profile capability is `false`.
      Returns:
        The `Browser` for the launched browser.
      Throws:
        `GeneralLeanFtException` - if error occurs during execution.

    - #### launch

          public static Browser launch(BrowserDescription browserDesc,
                       Environment env)
                                throws GeneralLeanFtException

      Launches a new browser tab on the specified environment and returns an instance of `Browser` for the launched browser. If the browser description includes capabilities to describe an environment, these are ignored.
      The returned browser instance is valid until the tab is closed.
      Parameters:
        `browserDesc` - The description of the browser to launch.
        `env` - The environment on which to open the browser. When working in a grid configuration, this is an environment previously locked using EnvironmentFactory.get.
      Returns:
        The `Browser` for the launched browser.
      Throws:
        `GeneralLeanFtException` - if error occurs during execution.

    - #### attach

          public static Browser attach(BrowserDescription description)
                                throws GeneralLeanFtException

      Attaches a new `Browser` instance to a previously opened browser tab.
      The BrowserDescription is used only when attaching to the browser, so transient values like `BrowserDescription.setUrl()` or `BrowserDescription.setTitle()` can be used.
      Parameters:
        `description` - `BrowserDescription` for filtering the open tabs.
      Returns:
        a Browser instance representing the matching browser.
      Throws:
        `GeneralLeanFtException` - if error occurs during execution

    - #### getAllOpenBrowsers

          public static Browser[] getAllOpenBrowsers(BrowserDescription description)
                                              throws GeneralLeanFtException

      Returns an array of all open browsers that match the given `BrowserDescription`.
      The `BrowserDescription` is used only when attaching to the browser, so transient values like BrowserDescription.setUrl() or BrowserDescription.setTitle() can be used.
      Parameters:
        `description` - the description to filter the open tabs against. If null, all open browsers will be returned.
      Returns:
        an array of all open browsers that match the given `BrowserDescription`.
      Throws:
        `GeneralLeanFtException` - if error occurs during execution

Tips to improve your search results... UFT Developer Java SDK Reference Version 15.0-15.0.2 UFT Developer SDK Reference All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: