Class WebDriverConfig
java.lang.Object
uk.co.evoco.webdriver.configuration.WebDriverConfig
public class WebDriverConfig
extends java.lang.Object
A simple representation object for the "./src/test/resources/config.json" file
-
Constructor Summary
Constructors Constructor Description WebDriverConfig() -
Method Summary
Modifier and Type Method Description java.lang.StringgetBaseUrl()com.fasterxml.jackson.databind.node.ObjectNodegetBrowserPreferences(BrowserType browserType)BrowserTypegetBrowserType()GridConfiggetGridConfig()MetricsConfiggetMetricsConfig()RunTypegetRunType()java.lang.StringgetTestConfigItem(java.lang.String item)TolerantActionExceptionsgetTolerantActionExceptions()intgetTolerantActionWaitTimeoutInSeconds()longgetWebDriverWaitTimeout()booleanisHeadless()voidsetBaseUrl(java.lang.String baseUrl)Aims to pull the baseUrl from the configuration file.voidsetBrowserPreferences(java.util.Map<java.lang.String,com.fasterxml.jackson.databind.node.ObjectNode> browserPreferences)voidsetBrowserType(java.lang.String browserType)voidsetBrowserType(BrowserType browserType)voidsetGridConfig(GridConfig gridConfig)voidsetHeadless(boolean headless)voidsetMetricsConfig(MetricsConfig metricsConfig)voidsetRunType(java.lang.String runType)voidsetTestConfig(com.fasterxml.jackson.databind.JsonNode testConfig)voidsetTolerantActionExceptions(TolerantActionExceptions tolerantActionExceptions)voidsetWebDriverWaitTimeout(java.lang.String webDriverWaitTimeout)
-
Constructor Details
-
WebDriverConfig
public WebDriverConfig()
-
-
Method Details
-
getBrowserType
- Returns:
- BrowserType for the run from the configuration file
-
setBrowserType
public void setBrowserType(java.lang.String browserType)- Parameters:
browserType- the browser for the run
-
setBrowserType
- Parameters:
browserType- the browser for the run
-
getBaseUrl
public java.lang.String getBaseUrl()- Returns:
- the base URL for the application under test
-
setBaseUrl
public void setBaseUrl(java.lang.String baseUrl) throws java.net.MalformedURLExceptionAims 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:
java.net.MalformedURLException- if the base URL is not a valid URL
-
getWebDriverWaitTimeout
public long getWebDriverWaitTimeout()- Returns:
- the timeout used in the framework for WebDriverWaits
-
setWebDriverWaitTimeout
public void setWebDriverWaitTimeout(java.lang.String webDriverWaitTimeout)- Parameters:
webDriverWaitTimeout- the timeout used in the framework for WebDriverWaits
-
getTestConfigItem
public java.lang.String getTestConfigItem(java.lang.String item)- 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
-
getBrowserPreferences
public com.fasterxml.jackson.databind.node.ObjectNode getBrowserPreferences(BrowserType browserType)- Returns:
- the BrowserPreferences configuration
-
setBrowserPreferences
public void setBrowserPreferences(java.util.Map<java.lang.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
public void setRunType(java.lang.String runType)- Parameters:
runType- the run type
-
getTolerantActionExceptions
- Returns:
- the tolerant action exceptions config
-
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
-