Open topic with navigation

com.hp.lft.sdk.web

## Interface Browser

- All Superinterfaces:
    LocationInfoProvider, TestObject, TestObjectDescriber, WebTestObjectDescriber

      public interface Browser
      extends TestObject, WebTestObjectDescriber, LocationInfoProvider

  A tab in an open Web browser.
  --To open a new browser tab, use `BrowserFactory.Launch`.
  --To access a browser that is already open, use: `BrowserFactory.Attach`.

- - ### Method Summary

    Modifier and Type | Method and Description
    --- | ---
    `void` | `back()` Navigates to the previous page in the browser history list.
    `void` | `clearCache()` Clears the browser cache. Note: This method does not clear the browser's cookies.
    `void` | `close()` Closes the browser window (or tab) that this test object represents.
    `void` | `closeAllTabs()` Closes all tabs (if any) and closes the browser window.
    `void` | `deleteCookies()` Deletes all cookies from the browser.
    `void` | `deleteCookies(java.lang.String fromSource)` Deletes only cookies that originated from the browser source.
    `void` | `embedScript(java.lang.String script)` Runs this JavaScript each time a page or frame loads or refreshes in the browser. - The script remains embedded until you close the browser, or until the run session ends. - Using this method to perform alert operations may result in unexpected behavior. - To run this method, the security settings in your Web browser must be set to allow active scripting.
    `void` | `forward()` Navigates to the next page in the browser history list.
    `void` | `fullScreen()` Displays the browser in full-screen mode.
    `java.lang.String` | `getDialogText()` Returns the text displayed in a browser message box, such as an alert, confirmation, or prompt.
    `int` | `getNumberOfTabs()` Returns the number of currently open tabs in the browser.
    `java.lang.String` | `getOpenTitle()` Returns the browser's initial title when first opened.
    `java.lang.String` | `getOpenURL()` Returns the URL from which the browser is opened.
    `Page` | `getPage()` Returns a test object representing the top level document in the tab.
    `Browser[]` | `getSiblingTabs()` Returns a collection of tabs (Browser objects) that are siblings to the current tab (tabs located in the same window).
    `java.lang.String` | `getTitle()` Returns the browser title.
    `java.lang.String` | `getURL()` Returns current browser URL.
    `BrowserVersion` | `getVersion()` Returns data regarding the browser version and type.
    `void` | `handleDialog()` Clicks the OK button on the alert, confirmation, or prompt message box.
    `void` | `handleDialog(DialogButton button)` Clicks a button on the alert, confirmation, or prompt message box.
    `void` | `handleDialog(java.lang.String text)` Enters text in the browser's prompt message box and clicks the OK button.
    `boolean` | `hasDialog()` Indicates whether the browser message box is currently open.
    `void` | `navigate(java.lang.String url)` Opens the specified URL in the browser.
    `void` | `openNewTab()` Opens a new tab in the browser window.
    `void` | `refresh()` Refreshes the current page.
    `void` | `resizeTo(java.awt.Dimension newDimensions)` Resizes the browser window to a specific size.
    `void` | `resizeTo(int width, int height)` Resizes the browser window to specific dimensions.
    `void` | `sync()` Waits for the browser to complete the current navigation.

    - ### 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.web.WebTestObjectDescriber

      `describe, describe`

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

      `describe`

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

      `getAbsoluteLocation, getLocation, getSize`

- - ### Method Detail

    - #### getNumberOfTabs

          int getNumberOfTabs()
                       throws GeneralLeanFtException

      Returns the number of currently open tabs in the browser.
      Returns:
        the number of currently open tabs in the browser.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getURL

          java.lang.String getURL()
                           throws GeneralLeanFtException

      Returns current browser URL.
      Returns:
        current browser URL.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getVersion

                                                      BrowserVersion getVersion()
                             throws GeneralLeanFtException

      Returns data regarding the browser version and type.
      Returns:
        data regarding the browser version and type.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getOpenTitle

          java.lang.String getOpenTitle()
                                 throws GeneralLeanFtException

      Returns the browser's initial title when first opened.
      Returns:
        the browser's initial title when first opened.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getOpenURL

          java.lang.String getOpenURL()
                               throws GeneralLeanFtException

      Returns the URL from which the browser is opened.
      Returns:
        the URL from which the browser is opened.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getTitle

          java.lang.String getTitle()
                             throws GeneralLeanFtException

      Returns the browser title.
      Returns:
        the browser title.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### navigate

          void navigate(java.lang.String url)
                 throws GeneralLeanFtException

      Opens the specified URL in the browser.
      Parameters:
        `url` - the URL to open.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### close

          void close()
              throws GeneralLeanFtException

      Closes the browser window (or tab) that this test object represents. Use the `closeAllTabs` method to close the currently open tab, all sibling tabs, and the parent browser window.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### sync

          void sync()
             throws GeneralLeanFtException

      Waits for the browser to complete the current navigation. You can use this method to instruct your test to wait until the browser is loaded.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### back

          void back()
             throws GeneralLeanFtException

      Navigates to the previous page in the browser history list. This method is identical to clicking the browser's Back button.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### forward

          void forward()
                throws GeneralLeanFtException

      Navigates to the next page in the browser history list. This method is identical to clicking the browser's Forward button.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getPage

                                                      Page getPage()
                throws GeneralLeanFtException

      Returns a test object representing the top level document in the tab.
      Returns:
        a test object representing the top level document in the tab.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### embedScript

          void embedScript(java.lang.String script)
                    throws GeneralLeanFtException

      Runs this JavaScript each time a page or frame loads or refreshes in the browser.
      - The script remains embedded until you close the browser, or until the run session ends.
      - Using this method to perform alert operations may result in unexpected behavior.
      - To run this method, the security settings in your Web browser must be set to allow active scripting. Otherwise, steps using this method will fail.
      Parameters:
        `script` - the full content of the JavaScript to embed..
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### refresh

          void refresh()
                throws GeneralLeanFtException

      Refreshes the current page. This method is identical to clicking the browser's Refresh button.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### clearCache

          void clearCache()
                   throws GeneralLeanFtException

      Clears the browser cache.
      Note: This method does not clear the browser's cookies. Use `deleteCookies` to delete the cookies.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### closeAllTabs

          void closeAllTabs()
                     throws GeneralLeanFtException

      Closes all tabs (if any) and closes the browser window.
      Use the `close` method to close only the currently open tab.
      Limitation: Your Internet Explorer (IE) browser must be configured to "Always close all tabs". To do this, open two or more tabs in IE. Then close IE. In the message box that pops up, select the "Always close all tabs" option.
      Note: This method is not supported on Chrome. Use the Close method instead.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### deleteCookies

          void deleteCookies()
                      throws GeneralLeanFtException

      Deletes all cookies from the browser. This method does not clear the browser's cache. Use `clearCache` to clear the cache.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### deleteCookies

          void deleteCookies(java.lang.String fromSource)
                      throws GeneralLeanFtException

      Deletes only cookies that originated from the browser source.
      Parameters:
        `fromSource` - the full or partial domain of the source. For example, entering MySite.com or MySite.net clears cookies only from the specified site, whereas entering MySite clears cookies from all related domains.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### fullScreen

          void fullScreen()
                   throws GeneralLeanFtException

      Displays the browser in full-screen mode.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getDialogText

          java.lang.String getDialogText()
                                  throws GeneralLeanFtException

      Returns the text displayed in a browser message box, such as an alert, confirmation, or prompt.
      Returns:
        the text displayed in a browser message box, such as an alert, confirmation, or prompt.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### handleDialog

          void handleDialog()
                     throws GeneralLeanFtException

      Clicks the OK button on the alert, confirmation, or prompt message box.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### handleDialog

          void handleDialog(DialogButton button)
                     throws GeneralLeanFtException

      Clicks a button on the alert, confirmation, or prompt message box.
      Parameters:
        `button` - the button to click. Possible values: `DialogButton`
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### handleDialog

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

      Enters text in the browser's prompt message box and clicks the OK button.
      Parameters:
        `text` - the text to enter in the edit field.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### hasDialog

          boolean hasDialog()
                     throws GeneralLeanFtException

      Indicates whether the browser message box is currently open.
      Returns:
        True if a message box is open.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### openNewTab

          void openNewTab()
                   throws GeneralLeanFtException

      Opens a new tab in the browser window.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### resizeTo

          void resizeTo(int width,
                        int height)
                 throws GeneralLeanFtException

      Resizes the browser window to specific dimensions.
      Parameters:
        `width` - width of the browser window.
        `height` - height of the browser window.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### resizeTo

          void resizeTo(java.awt.Dimension newDimensions)
                 throws GeneralLeanFtException

      Resizes the browser window to a specific size.
      Parameters:
        `newDimensions` - the browser window size in pixels.
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.

    - #### getSiblingTabs

                                                      Browser[] getSiblingTabs()
                            throws GeneralLeanFtException

      Returns a collection of tabs (Browser objects) that are siblings to the current tab (tabs located in the same window).
      Returns:
        The collection of sibling tabs as Browsers
      Throws:
        `GeneralLeanFtException` - if an error occurs during execution.