com.hp.lft.sdk.web

Class BrowserFactory



  • public class BrowserFactory
    extends Object
    A class for creating a Browser instance.
    • 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 LeanFT 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,
                     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.
      • 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