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 Details

    • 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 error occurs during execution
    • getURL

      Returns current browser URL.
      Returns:
      current browser URL.
      Throws:
      GeneralLeanFtException - if error occurs during execution
    • getVersion

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

      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 error occurs during execution
    • getOpenURL

      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 error occurs during execution
    • getTitle

      String getTitle() throws GeneralLeanFtException
      Returns the browser title.
      Returns:
      the browser title.
      Throws:
      GeneralLeanFtException - if error occurs during execution
    • activate

      void activate() throws GeneralLeanFtException
      Activates the tab of the browser in the window group and clicks on it by default (windows only)
      Throws:
      GeneralLeanFtException - if error occurs during execution
    • activate

      void activate(boolean setFocus) throws GeneralLeanFtException
      Activates the tab of the browser in the window group and if the 'setFocus' parameter is true it clicks on it (windows only). If the 'setFocus' parameter is set on an unsupported OS, an error of type 'unexpectedParameterException' is returned.
      Parameters:
      setFocus - decides to click or not the browser after it is activated.
      Throws:
      GeneralLeanFtException - if 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 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 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 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 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 error occurs during execution
    • embedScript

      void embedScript(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 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 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 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 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 error occurs during execution
    • deleteCookies

      void deleteCookies(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 error occurs during execution
    • fullScreen

      void fullScreen() throws GeneralLeanFtException
      Toggles the browser between full-screen mode and normal mode.
      Throws:
      GeneralLeanFtException - if error occurs during execution
    • fullScreen

      void fullScreen(FullScreenMode mode) throws GeneralLeanFtException
      Controls the browser's full screen mode.
      Parameters:
      mode - Indicates whether to set the browser to full screen or normal mode. Possible values: FullScreenMode
      Throws:
      GeneralLeanFtException - if error occurs during execution
    • getDialogText

      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 error occurs during execution
    • handleDialog

      void handleDialog() throws GeneralLeanFtException
      Clicks the OK button on the alert, confirmation, or prompt message box.
      Throws:
      GeneralLeanFtException - if 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 error occurs during execution
    • handleDialog

      void handleDialog(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 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 error occurs during execution
    • openNewTab

      void openNewTab() throws GeneralLeanFtException
      Opens a new tab in the browser window.
      Throws:
      GeneralLeanFtException - if 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 error occurs during execution
    • resizeTo

      void resizeTo(Dimension newDimensions) throws GeneralLeanFtException
      Resizes the browser window to a specific size.
      Parameters:
      newDimensions - the browser window size in pixels.
      Throws:
      GeneralLeanFtException - if 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 error occurs during execution