Class BrowserUtil


  • public class BrowserUtil
    extends java.lang.Object
    This class contains utility methods used to aid the FAST Framework with interacting with browsers
    Since:
    1.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      BrowserUtil()  
    • Method Summary

      Modifier and Type Method Description
      static java.lang.String closeAllBrowsers​(FastRunProperties fastRunProperties)
      Closes all browsers using the last used Framework
      static java.lang.String closeBrowserTab​(java.lang.String tab, FastRunProperties fastRunProperties)
      Closes the specified browser tab using the last used Framework
      static java.lang.String getCssString​(java.util.Properties properties)
      Converts attributes of an object into a string that will be used for cssSelectors
      static Framework getFrameworkToUse()
      Returns the current framework that BrowserUtil should use
      static void maximizeBrowser​(FastDriver fastDriver)
      Maximizes the browser window using the last used framework
      static void navigate​(java.lang.String url, FastRunProperties fastRunProperties)
      Navigates to the specified url using the designated framework
      static void rptStatus​(java.lang.String rptError, TestStep tStep)
      Updates the execution status of the teststep
      static void setFrameworkToUse​(Framework frameworkToUse)
      Sets the framework that BrowserUtil should use for its actions
      static java.lang.String switchFrame​(FastElement fastElement)
      Switches to the frame found using the passed in parameter
      static java.lang.String switchTab​(java.lang.String tab, FastRunProperties fastRunProperties)
      Switches to the specified tab using the last used framework
      static void takeScreenshot​(java.lang.String sshotPth, FastRunProperties fastRunProperties)
      Takes a screenshot and saves the image to the specified path
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • frameworkToUse

        public static Framework frameworkToUse
    • Constructor Detail

      • BrowserUtil

        public BrowserUtil()
    • Method Detail

      • rptStatus

        public static void rptStatus​(java.lang.String rptError,
                                     TestStep tStep)
                              throws FastException
        Updates the execution status of the teststep
        Parameters:
        rptError - The error message (if there is one)
        tStep - A TestStep
        Throws:
        FastException - - if error occurs during execution
        Since:
        1.0.0
      • takeScreenshot

        public static void takeScreenshot​(java.lang.String sshotPth,
                                          FastRunProperties fastRunProperties)
                                   throws FastException
        Takes a screenshot and saves the image to the specified path
        Parameters:
        sshotPth - The location and file name the screenshot is saved to.
        fastRunProperties - The properties Fast is running with
        Throws:
        FastException - If an error occurs during execution
        Since:
        1.0.0
      • getCssString

        public static java.lang.String getCssString​(java.util.Properties properties)
        Converts attributes of an object into a string that will be used for cssSelectors
        Parameters:
        properties - Properties that will be used to locate a webelement
        Returns:
        The cssSelector string
        Since:
        1.0.0
      • navigate

        public static void navigate​(java.lang.String url,
                                    FastRunProperties fastRunProperties)
                             throws FastException
        Navigates to the specified url using the designated framework
        Parameters:
        url - The url to navigate to
        fastRunProperties - The properties Fast is running with
        Throws:
        FastException - If an error occurs during execution
        Since:
        1.0.0
      • maximizeBrowser

        public static void maximizeBrowser​(FastDriver fastDriver)
                                    throws FastException
        Maximizes the browser window using the last used framework
        Parameters:
        fastDriver - The driver that will be maximized
        Throws:
        FastException - If an error occurs during execution
        Since:
        1.0.0
      • closeAllBrowsers

        public static java.lang.String closeAllBrowsers​(FastRunProperties fastRunProperties)
                                                 throws FastException
        Closes all browsers using the last used Framework
        Parameters:
        fastRunProperties - The properties that Fast is running with
        Returns:
        A status message
        Throws:
        FastException - If an error occurs during execution
        Since:
        1.0.0
      • closeBrowserTab

        public static java.lang.String closeBrowserTab​(java.lang.String tab,
                                                       FastRunProperties fastRunProperties)
                                                throws FastException
        Closes the specified browser tab using the last used Framework
        Parameters:
        tab - The title of the tab
        fastRunProperties - The properties that Fast is running with
        Returns:
        The status of the step
        Throws:
        FastException - If an error occurs during execution
        Since:
        1.0.0
      • switchTab

        public static java.lang.String switchTab​(java.lang.String tab,
                                                 FastRunProperties fastRunProperties)
                                          throws FastException
        Switches to the specified tab using the last used framework
        Parameters:
        tab - The tab being switched to
        fastRunProperties - The properties Fast is running with
        Returns:
        The status of the step
        Throws:
        FastException - If an error occurs during execution
        Since:
        1.0.0
      • switchFrame

        public static java.lang.String switchFrame​(FastElement fastElement)
                                            throws FastException
        Switches to the frame found using the passed in parameter
        Parameters:
        fastElement - The frame that is being switched to
        Returns:
        A status message
        Throws:
        FastException - If an error occurs during execution
        Since:
        1.0.0
      • getFrameworkToUse

        public static Framework getFrameworkToUse()
        Returns the current framework that BrowserUtil should use
        Returns:
        The framework that BrowserUtil should use
        Since:
        1.0.0
      • setFrameworkToUse

        public static void setFrameworkToUse​(Framework frameworkToUse)
        Sets the framework that BrowserUtil should use for its actions
        Parameters:
        frameworkToUse - The framework BrowserUtil should use
        Since:
        1.0.0