public class BasicBrowserConfiguration extends Object implements BrowserConfiguration, ChainedPropertiesSource, DataSource
BrowserContext.getConfiguration(Class).
It allows to load properties
from resource, path, file or Properties directly
and it has higher priority than default values. You can
obtain them later using BrowserContext.getProperty(String)
and similar property based methods.
Tries to get all possible values from chained
properties. Properties are prefixed with 'browser.':
baseUrlProperty = browser.baseUrlProperty
baseUrlRegexProperty = browser.baseUrlRegexProperty
urlVerificationProperty = browser.urlVerificationProperty
waitTimeoutProperty = browser.waitTimeoutProperty
waitRetryIntervalProperty = browser.waitRetryIntervalProperty
reportedProperty = browser.reportedProperty
reportDirProperty = browser.reportDirProperty
For now only getDriver(DesiredCapabilities),
getCapabilities()
and getListeners()
are not supported methods and calls default
methods directly.
In addition you can add any data using DataSource.addData(String, Object)
and obtain it using DataSource.getData(String, Class).ChainedPropertiesSource.PropertiesValue| Modifier and Type | Field and Description |
|---|---|
static String |
BASE_URL |
static String |
BASE_URL_REGEX |
protected Map<String,Object> |
dataHolder |
static String |
DEFAULT_PROPERTIES_KEY |
static String |
DEFAULT_PROPERTIES_RESOURCE_NAME |
static String |
PREFIX |
protected List<ChainedPropertiesSource.PropertiesValue> |
propertiesHolder |
static String |
REPORT_DIR |
static String |
REPORTED |
static String |
SYSTEM_PROPERTIES_KEY |
static String |
URL_VERIFICATION |
static String |
WAIT_RETRY_INTERVAL |
static String |
WAIT_TIMEOUT |
| Constructor and Description |
|---|
BasicBrowserConfiguration()
Constructs new instance with system and default properties.
|
| Modifier and Type | Method and Description |
|---|---|
BasicBrowserConfiguration |
addDefaultProperties()
Loads properties from resource
DEFAULT_PROPERTIES_RESOURCE_NAME
and adds them at the end of actual properties list. |
BasicBrowserConfiguration |
addDefaultPropertiesAfter(String afterKey)
Loads properties from resource
DEFAULT_PROPERTIES_RESOURCE_NAME
and adds them after specific key in actual properties list. |
BasicBrowserConfiguration |
addDefaultPropertiesBefore(String beforeKey)
Loads properties from resource
DEFAULT_PROPERTIES_RESOURCE_NAME
and adds them before specific key in actual properties list. |
BasicBrowserConfiguration |
addSystemProperties()
Adds
System.getProperties() at the end of actual properties list. |
BasicBrowserConfiguration |
addSystemPropertiesAfter(String afterKey)
Adds
System.getProperties() after specific key in actual properties list. |
BasicBrowserConfiguration |
addSystemPropertiesBefore(String beforeKey)
Adds
System.getProperties() before specific key in actual properties list. |
String |
getBaseUrl()
Base URL for pages.
|
String |
getBaseUrlRegex()
Base URL regex for pages.
|
org.openqa.selenium.remote.DesiredCapabilities |
getCapabilities()
Returns optional
DesiredCapabilities. |
Map<String,Object> |
getDataHolder()
Returns map which holds data.
|
protected String |
getDefaultBaseUrl()
Default base URL for pages.
|
protected String |
getDefaultBaseUrlRegex()
Default base URL regex for pages.
|
protected org.openqa.selenium.remote.DesiredCapabilities |
getDefaultCapabilities()
Returns optional default
DesiredCapabilities. |
protected org.openqa.selenium.WebDriver |
getDefaultDriver(org.openqa.selenium.remote.DesiredCapabilities caps)
Returns default
WebDriver instance. |
protected List<BrowserListener> |
getDefaultListeners()
Returns default list of browser event listeners.
|
protected File |
getDefaultReportDir()
Returns default directory for storing browser files.
|
protected double |
getDefaultWaitRetryInterval()
Returns default wait retry interval.
|
protected double |
getDefaultWaitTimeout()
Returns default wait timeout.
|
org.openqa.selenium.WebDriver |
getDriver(org.openqa.selenium.remote.DesiredCapabilities caps)
Returns
WebDriver instance. |
List<BrowserListener> |
getListeners()
Returns list of browser event listeners.
|
List<ChainedPropertiesSource.PropertiesValue> |
getPropertiesHolder() |
File |
getReportDir()
Returns directory for storing browser files.
|
double |
getWaitRetryInterval()
Returns wait retry interval.
|
double |
getWaitTimeout()
Returns wait timeout.
|
void |
init()
It is called after putting it into browser.
|
protected boolean |
isDefaultReported()
Is storing files using browser enabled as default?
Override this for different value.
|
protected boolean |
isDefaultUrlVerification()
Is URL on pages verified as default?
Override this for different value.
|
boolean |
isReported()
Is storing files using browser enabled?
|
boolean |
isUrlVerification()
Is URL on pages verified?
|
BasicBrowserConfiguration |
pushDefaultProperties()
Loads properties from resource
DEFAULT_PROPERTIES_RESOURCE_NAME
and pushes them at the start of actual properties list. |
BasicBrowserConfiguration |
pushSystemProperties()
Pushes
System.getProperties() at the start of actual properties list. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddFileProperties, addFilePropertiesAfter, addFilePropertiesBefore, addProperties, addPropertiesAfter, addPropertiesBefore, addResourceProperties, addResourcePropertiesAfter, addResourcePropertiesBefore, getMergedProperties, getProperties, getProperties, getPropertiesWithKeys, getProperty, pushFileProperties, pushProperties, pushResourceProperties, removePropertiescastString, getProperty, getProperty, getPropertyaddData, getData, removeDatapublic static final String SYSTEM_PROPERTIES_KEY
public static final String DEFAULT_PROPERTIES_KEY
public static final String DEFAULT_PROPERTIES_RESOURCE_NAME
public static final String PREFIX
public static final String BASE_URL
public static final String BASE_URL_REGEX
public static final String URL_VERIFICATION
public static final String WAIT_TIMEOUT
public static final String WAIT_RETRY_INTERVAL
public static final String REPORTED
public static final String REPORT_DIR
protected List<ChainedPropertiesSource.PropertiesValue> propertiesHolder
public BasicBrowserConfiguration()
protected String getDefaultBaseUrl()
protected String getDefaultBaseUrlRegex()
protected boolean isDefaultUrlVerification()
protected org.openqa.selenium.WebDriver getDefaultDriver(org.openqa.selenium.remote.DesiredCapabilities caps)
WebDriver instance.
Override this for different value.caps - The non null desired capabilities.protected org.openqa.selenium.remote.DesiredCapabilities getDefaultCapabilities()
DesiredCapabilities.
Override this for different value.protected double getDefaultWaitTimeout()
protected double getDefaultWaitRetryInterval()
protected boolean isDefaultReported()
protected File getDefaultReportDir()
protected List<BrowserListener> getDefaultListeners()
public void init()
BrowserConfigurationinit in interface BrowserConfigurationpublic String getBaseUrl()
BrowserConfigurationgetBaseUrl in interface BrowserConfigurationpublic String getBaseUrlRegex()
BrowserConfigurationgetBaseUrlRegex in interface BrowserConfigurationpublic boolean isUrlVerification()
BrowserConfigurationisUrlVerification in interface BrowserConfigurationpublic org.openqa.selenium.WebDriver getDriver(org.openqa.selenium.remote.DesiredCapabilities caps)
BrowserConfigurationWebDriver instance.getDriver in interface BrowserConfigurationcaps - The non null desired capabilities.public org.openqa.selenium.remote.DesiredCapabilities getCapabilities()
BrowserConfigurationDesiredCapabilities.getCapabilities in interface BrowserConfigurationpublic double getWaitTimeout()
BrowserConfigurationgetWaitTimeout in interface BrowserConfigurationpublic double getWaitRetryInterval()
BrowserConfigurationgetWaitRetryInterval in interface BrowserConfigurationpublic boolean isReported()
BrowserConfigurationisReported in interface BrowserConfigurationpublic File getReportDir()
BrowserConfigurationgetReportDir in interface BrowserConfigurationpublic List<BrowserListener> getListeners()
BrowserConfigurationgetListeners in interface BrowserConfigurationpublic List<ChainedPropertiesSource.PropertiesValue> getPropertiesHolder()
getPropertiesHolder in interface ChainedPropertiesSourcepublic Map<String,Object> getDataHolder()
DataSourcegetDataHolder in interface DataSourcepublic BasicBrowserConfiguration addDefaultProperties()
DEFAULT_PROPERTIES_RESOURCE_NAME
and adds them at the end of actual properties list.public BasicBrowserConfiguration addDefaultPropertiesBefore(String beforeKey)
DEFAULT_PROPERTIES_RESOURCE_NAME
and adds them before specific key in actual properties list.beforeKey - The before properties keypublic BasicBrowserConfiguration addDefaultPropertiesAfter(String afterKey)
DEFAULT_PROPERTIES_RESOURCE_NAME
and adds them after specific key in actual properties list.afterKey - The after properties keypublic BasicBrowserConfiguration addSystemProperties()
System.getProperties() at the end of actual properties list.public BasicBrowserConfiguration addSystemPropertiesBefore(String beforeKey)
System.getProperties() before specific key in actual properties list.beforeKey - The before properties keypublic BasicBrowserConfiguration addSystemPropertiesAfter(String afterKey)
System.getProperties() after specific key in actual properties list.afterKey - The after properties keypublic BasicBrowserConfiguration pushDefaultProperties()
DEFAULT_PROPERTIES_RESOURCE_NAME
and pushes them at the start of actual properties list.public BasicBrowserConfiguration pushSystemProperties()
System.getProperties() at the start of actual properties list.Copyright © 2016 Etnetera a.s.. All rights reserved.