Class WebDriverConfig
java.lang.Object
com.version1.webdriver.configuration.WebDriverConfig
A simple representation object for the "./src/test/resources/config.json" file
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.node.ObjectNodegetBrowserPreferences(BrowserType browserType) com.fasterxml.jackson.databind.node.ObjectNodegetTemplateConfigs(String template) getTestConfigItem(String item) intlongbooleanbooleanvoidvoidsetBaseUrl(String baseUrl) Aims to pull the baseUrl from the configuration file.voidsetBrowserPreferences(Map<String, com.fasterxml.jackson.databind.node.ObjectNode> browserPreferences) voidsetBrowserType(BrowserType browserType) voidsetBrowserType(String browserType) voidsetGridConfig(GridConfig gridConfig) voidsetHeadless(boolean headless) voidsetMetricsConfig(MetricsConfig metricsConfig) voidsetRunType(String runType) voidsetTakeScreenshotOnError(boolean takeScreenshotOnError) voidsetTemplateConfigs(Map<String, com.fasterxml.jackson.databind.node.ObjectNode> templateConfigs) voidsetTestConfig(com.fasterxml.jackson.databind.JsonNode testConfig) voidsetTolerantActionExceptions(TolerantActionExceptions tolerantActionExceptions) voidsetWebDriverWaitTimeout(String webDriverWaitTimeout)
-
Constructor Details
-
WebDriverConfig
public WebDriverConfig()
-
-
Method Details
-
getBrowserType
- Returns:
- BrowserType for the run from the configuration file
-
setBrowserType
- Parameters:
browserType- the browser for the run
-
setBrowserType
- Parameters:
browserType- the browser for the run
-
getBaseUrl
- Returns:
- the base URL for the application under test
-
setBaseUrl
Aims to pull the baseUrl from the configuration file. If, however, a system property has been set via the command line, then this will be overridden and we will use the baseUrl that comes from the CLI. This is important to ensure there is support for non-configuration dynamic configuration for CI systems like Jenkins etc.- Parameters:
baseUrl- the base URL for the application under test- Throws:
MalformedURLException- if the base URL is not a valid URL
-
getWebDriverWaitTimeout
public long getWebDriverWaitTimeout()- Returns:
- the timeout used in the framework for WebDriverWaits
-
setWebDriverWaitTimeout
- Parameters:
webDriverWaitTimeout- the timeout used in the framework for WebDriverWaits
-
getTestConfigItem
- Parameters:
item- the name of the key for which the value you want to retrieve- Returns:
- String returns the target item that exists in the list of open options that can be passed in the config file
-
setTestConfig
public void setTestConfig(com.fasterxml.jackson.databind.JsonNode testConfig) - Parameters:
testConfig- the list of key/value pairs for the non-specific configuration items in the config file
-
isHeadless
public boolean isHeadless()- Returns:
- boolean configuring headless running
-
setHeadless
public void setHeadless(boolean headless) - Parameters:
headless- boolean configuring headless running
-
getGridConfig
- Returns:
- the GridConfig configuration
-
setGridConfig
- Parameters:
gridConfig- the GridConfig configuration
-
getTemplateConfigs
- Returns:
- the BrowserPreferences configuration
-
setTemplateConfigs
public void setTemplateConfigs(Map<String, com.fasterxml.jackson.databind.node.ObjectNode> templateConfigs) - Parameters:
templateConfigs- the configuration properties for the templates
-
getBrowserPreferences
public com.fasterxml.jackson.databind.node.ObjectNode getBrowserPreferences(BrowserType browserType) - Returns:
- the BrowserPreferences configuration
-
setBrowserPreferences
public void setBrowserPreferences(Map<String, com.fasterxml.jackson.databind.node.ObjectNode> browserPreferences) - Parameters:
browserPreferences- the configuration properties for the various browsers supported by the webdriver
-
getRunType
- Returns:
- the run type
-
setRunType
- Parameters:
runType- the run type
-
getTolerantActionExceptions
- Returns:
- the tolerant action exceptions config
-
printToleratedExceptions
public void printToleratedExceptions() -
setTolerantActionExceptions
- Parameters:
tolerantActionExceptions- set the tolerant action exceptions and tolerant action wait time in Seconds
-
getTolerantActionWaitTimeoutInSeconds
public int getTolerantActionWaitTimeoutInSeconds()- Returns:
- tolerant action wait time in seconds if user specify the time in config file other wise return default webdriver time out
-
setMetricsConfig
-
getMetricsConfig
-
isTakeScreenshotOnError
public boolean isTakeScreenshotOnError()- Returns:
- takeScreenshotOnErrors boolean configuring for taking screenshots on Errors
-
setTakeScreenshotOnError
public void setTakeScreenshotOnError(boolean takeScreenshotOnError)
-