com.hp.lft.sdk.web

Interface Browser

    • 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.
      • 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.
      • 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.
      • 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(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.
      • 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(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.
      • 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.