Package com.qcefast.util
Class BrowserUtil
- java.lang.Object
-
- com.qcefast.util.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
-
-
Field Summary
Fields Modifier and Type Field Description static Framework
frameworkToUse
-
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 Frameworkstatic java.lang.String
closeBrowserTab(java.lang.String tab, FastRunProperties fastRunProperties)
Closes the specified browser tab using the last used Frameworkstatic java.lang.String
getCssString(java.util.Properties properties)
Converts attributes of an object into a string that will be used for cssSelectorsstatic Framework
getFrameworkToUse()
Returns the current framework that BrowserUtil should usestatic void
maximizeBrowser(FastDriver fastDriver)
Maximizes the browser window using the last used frameworkstatic void
navigate(java.lang.String url, FastRunProperties fastRunProperties)
Navigates to the specified url using the designated frameworkstatic void
rptStatus(java.lang.String rptError, TestStep tStep)
Updates the execution status of the teststepstatic void
setFrameworkToUse(Framework frameworkToUse)
Sets the framework that BrowserUtil should use for its actionsstatic java.lang.String
switchFrame(FastElement fastElement)
Switches to the frame found using the passed in parameterstatic java.lang.String
switchTab(java.lang.String tab, FastRunProperties fastRunProperties)
Switches to the specified tab using the last used frameworkstatic void
takeScreenshot(java.lang.String sshotPth, FastRunProperties fastRunProperties)
Takes a screenshot and saves the image to the specified path
-
-
-
Field Detail
-
frameworkToUse
public static Framework frameworkToUse
-
-
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 tofastRunProperties
- 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 tabfastRunProperties
- 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 tofastRunProperties
- 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
-
-