Package org.fluentlenium.configuration
Class ProgrammaticConfiguration
- java.lang.Object
-
- org.fluentlenium.configuration.ProgrammaticConfiguration
-
- All Implemented Interfaces:
Configuration,ConfigurationMutator,ConfigurationProperties
public class ProgrammaticConfiguration extends java.lang.Object implements Configuration
Configurationbased on JavaBean properties.- See Also:
Configuration,ConfigurationProperties
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.fluentlenium.configuration.ConfigurationProperties
ConfigurationProperties.DriverLifecycle, ConfigurationProperties.TriggerMode
-
-
Constructor Summary
Constructors Constructor Description ProgrammaticConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.LonggetAwaitAtMost()awaitAtMostjava.lang.LonggetAwaitPollingEvery()awaitPollingEveryjava.lang.StringgetBaseUrl()baseUrljava.lang.LonggetBrowserTimeout()browserTimeoutjava.lang.IntegergetBrowserTimeoutRetries()browserTimeoutRetriesorg.openqa.selenium.CapabilitiesgetCapabilities()capabilitiesjava.lang.Class<? extends ConfigurationProperties>getConfigurationDefaults()configurationDefaultsjava.lang.Class<? extends ConfigurationFactory>getConfigurationFactory()configurationFactoryjava.lang.StringgetCustomProperty(java.lang.String propertyName)Get custom property value.java.lang.BooleangetDeleteCookies()deleteCookiesConfigurationProperties.DriverLifecyclegetDriverLifecycle()driverLifecyclejava.lang.BooleangetEventsEnabled()eventsEnabledConfigurationProperties.TriggerModegetHtmlDumpMode()htmlDumpModejava.lang.StringgetHtmlDumpPath()htmlDumpPathjava.lang.LonggetImplicitlyWait()implicitlyWaitjava.lang.LonggetPageLoadTimeout()pageLoadTimeoutjava.lang.StringgetRemoteUrl()remoteUrlConfigurationProperties.TriggerModegetScreenshotMode()screenshotModejava.lang.StringgetScreenshotPath()screenshotPathjava.lang.LonggetScriptTimeout()scriptTimeoutjava.lang.StringgetWebDriver()webDrivervoidsetAwaitAtMost(java.lang.Long awaitAtMost)Sets the value ofvoidsetAwaitPollingEvery(java.lang.Long awaitPollingEvery)Sets the value ofvoidsetBaseUrl(java.lang.String baseUrl)Sets the value ofvoidsetBrowserTimeout(java.lang.Long timeout)Sets the value ofvoidsetBrowserTimeoutRetries(java.lang.Integer retriesNumber)Sets the value ofvoidsetCapabilities(org.openqa.selenium.Capabilities capabilities)Sets the value ofvoidsetConfigurationDefaults(java.lang.Class<? extends ConfigurationProperties> configurationDefaults)Set the configuration defaults.voidsetConfigurationFactory(java.lang.Class<? extends ConfigurationFactory> configurationFactory)Sets the value ofvoidsetCustomProperty(java.lang.String key, java.lang.String value)Sets custom value for a custom property keyvoidsetDeleteCookies(java.lang.Boolean deleteCookies)Sets the value ofvoidsetDriverLifecycle(ConfigurationProperties.DriverLifecycle driverLifecycle)Sets the value ofvoidsetEventsEnabled(java.lang.Boolean eventsEnabled)Sets the value ofvoidsetHtmlDumpMode(ConfigurationProperties.TriggerMode htmlDumpMode)Sets the value ofvoidsetHtmlDumpPath(java.lang.String htmlDumpPath)Sets the value ofvoidsetImplicitlyWait(java.lang.Long implicitlyWait)Sets the value ofvoidsetPageLoadTimeout(java.lang.Long pageLoadTimeout)Sets the value ofvoidsetRemoteUrl(java.lang.String remoteUrl)Sets the value ofvoidsetScreenshotMode(ConfigurationProperties.TriggerMode mode)Sets the value ofvoidsetScreenshotPath(java.lang.String path)Sets the value ofvoidsetScriptTimeout(java.lang.Long scriptTimeout)Sets the value ofvoidsetWebDriver(java.lang.String webDriverName)Sets the value of
-
-
-
Method Detail
-
setConfigurationDefaults
public void setConfigurationDefaults(java.lang.Class<? extends ConfigurationProperties> configurationDefaults)
Set the configuration defaults.- Parameters:
configurationDefaults- configuration defaults
-
getWebDriver
public java.lang.String getWebDriver()
Description copied from interface:ConfigurationPropertieswebDriver
property.Sets the WebDriver type to use.
When FluentLenium needs to create a new
WebDriverinstance, it callsFluentAdapter.newWebDriver()which delegates toWebDriversRegistryImpl.newWebDriver(String, Capabilities, ConfigurationProperties)registry using the value stored in webDriver and capabilities property.Possible values are "firefox", "chrome", "ie", "edge", "htmlunit", "safari", "phantomjs", "opera", "remote" or any class name implementing
WebDriveror any name that is defined in the `@FactoryName` annotation of a `WebDriverFactory` implementation.Default value is "firefox".
- Specified by:
getWebDriverin interfaceConfigurationProperties- Returns:
- webDriver property value
- See Also:
FluentAdapter.newWebDriver(),DefaultWebDriverFactories
-
setWebDriver
public void setWebDriver(java.lang.String webDriverName)
Description copied from interface:ConfigurationMutatorSets the value ofwebDriver
property.- Specified by:
setWebDriverin interfaceConfigurationMutator- Parameters:
webDriverName- property value- See Also:
ConfigurationProperties.getWebDriver()
-
getRemoteUrl
public java.lang.String getRemoteUrl()
Description copied from interface:ConfigurationPropertiesremoteUrl
property. Sets the remoteUrl for "remote" webDriver.- Specified by:
getRemoteUrlin interfaceConfigurationProperties- Returns:
- remoteUrl property value
- See Also:
RemoteWebDriver
-
setRemoteUrl
public void setRemoteUrl(java.lang.String remoteUrl)
Description copied from interface:ConfigurationMutatorSets the value ofremoteUrl
property.- Specified by:
setRemoteUrlin interfaceConfigurationMutator- Parameters:
remoteUrl- property value- See Also:
ConfigurationProperties.getRemoteUrl()
-
getCapabilities
public org.openqa.selenium.Capabilities getCapabilities()
Description copied from interface:ConfigurationPropertiescapabilities
property. Sets the Capabilities to use, as a JSON Object or a URL pointing to a JSON Object. Default value is "null".- Specified by:
getCapabilitiesin interfaceConfigurationProperties- Returns:
- Capabilities property value
- See Also:
Capabilities, Selenium DesiredCapabilities Wiki Page
-
setCapabilities
public void setCapabilities(org.openqa.selenium.Capabilities capabilities)
Description copied from interface:ConfigurationMutatorSets the value ofcapabilities
property.- Specified by:
setCapabilitiesin interfaceConfigurationMutator- Parameters:
capabilities- property value- See Also:
ConfigurationProperties.getCapabilities()
-
getDriverLifecycle
public ConfigurationProperties.DriverLifecycle getDriverLifecycle()
Description copied from interface:ConfigurationPropertiesdriverLifecycle
property. Sets the lifecycle of the WebDriver. WebDriver is fully managed by FluentLenium, so you should never create or quit a WebDriver by yourself. Please keep in mind that this configures when drivers are created and exited at runtime, but it does not deal with concurrency of your tests. Default value is METHOD.- Specified by:
getDriverLifecyclein interfaceConfigurationProperties- Returns:
- driverLifecycle property value
-
getBrowserTimeout
public java.lang.Long getBrowserTimeout()
Description copied from interface:ConfigurationPropertiesbrowserTimeout
property. Sets the maximum amount of time when the browser should start responding to the WebDriver. Default value is 60 seconds.- Specified by:
getBrowserTimeoutin interfaceConfigurationProperties- Returns:
- long
-
getBrowserTimeoutRetries
public java.lang.Integer getBrowserTimeoutRetries()
Description copied from interface:ConfigurationPropertiesbrowserTimeoutRetries
property. Sets the maximum number of retries for failed WebDriver because of browserTimeout issues. Default value is 2 times.- Specified by:
getBrowserTimeoutRetriesin interfaceConfigurationProperties- Returns:
- Integer
-
setBrowserTimeout
public void setBrowserTimeout(java.lang.Long timeout)
Description copied from interface:ConfigurationMutatorSets the value ofbrowserTimeout
property.- Specified by:
setBrowserTimeoutin interfaceConfigurationMutator- Parameters:
timeout- property value- See Also:
ConfigurationProperties.getBrowserTimeout()
-
setBrowserTimeoutRetries
public void setBrowserTimeoutRetries(java.lang.Integer retriesNumber)
Description copied from interface:ConfigurationMutatorSets the value ofbrowserTimeoutRetries
property.- Specified by:
setBrowserTimeoutRetriesin interfaceConfigurationMutator- Parameters:
retriesNumber- property value- See Also:
ConfigurationProperties.getBrowserTimeoutRetries()
-
setDriverLifecycle
public void setDriverLifecycle(ConfigurationProperties.DriverLifecycle driverLifecycle)
Description copied from interface:ConfigurationMutatorSets the value ofdriverLifecycle
property.- Specified by:
setDriverLifecyclein interfaceConfigurationMutator- Parameters:
driverLifecycle- property value- See Also:
ConfigurationProperties.getDriverLifecycle()
-
getDeleteCookies
public java.lang.Boolean getDeleteCookies()
Description copied from interface:ConfigurationPropertiesdeleteCookies
property. When using CLASS or JVMdriverLifecycle
configuration property, allow to delete cookies between each test. Default value is false.- Specified by:
getDeleteCookiesin interfaceConfigurationProperties- Returns:
- deleteCookies property value.
-
setDeleteCookies
public void setDeleteCookies(java.lang.Boolean deleteCookies)
Description copied from interface:ConfigurationMutatorSets the value ofdeleteCookies
property.- Specified by:
setDeleteCookiesin interfaceConfigurationMutator- Parameters:
deleteCookies- property value- See Also:
ConfigurationProperties.getDeleteCookies()
-
getConfigurationFactory
public java.lang.Class<? extends ConfigurationFactory> getConfigurationFactory()
Description copied from interface:ConfigurationPropertiesconfigurationFactory
property. Set this to a class implementingConfigurationFactoryto customize the ways properties are read. This allow to configure properties from sources that are not supported by default FluentLenium. Default value isDefaultConfigurationFactoryclass.- Specified by:
getConfigurationFactoryin interfaceConfigurationProperties- Returns:
- Custom
ConfigurationFactoryclass.
-
setConfigurationFactory
public void setConfigurationFactory(java.lang.Class<? extends ConfigurationFactory> configurationFactory)
Description copied from interface:ConfigurationMutatorSets the value ofconfigurationFactory
property.- Specified by:
setConfigurationFactoryin interfaceConfigurationMutator- Parameters:
configurationFactory- property value- See Also:
ConfigurationProperties.getConfigurationFactory()
-
getConfigurationDefaults
public java.lang.Class<? extends ConfigurationProperties> getConfigurationDefaults()
Description copied from interface:ConfigurationPropertiesconfigurationDefaults
property. Set this to a class implementingConfigurationPropertiesto provide the default values of the configuration properties. Default value isConfigurationDefaults- Specified by:
getConfigurationDefaultsin interfaceConfigurationProperties- Returns:
- Custom
ConfigurationPropertiesinstance with default values.
-
getBaseUrl
public java.lang.String getBaseUrl()
Description copied from interface:ConfigurationPropertiesbaseUrl
property. Sets the base URL used to build absolute URL when relative URL is given toFluentControlImpl.goTo(String). Default value is null.- Specified by:
getBaseUrlin interfaceConfigurationProperties- Returns:
- baseUrl property value
-
setBaseUrl
public void setBaseUrl(java.lang.String baseUrl)
Description copied from interface:ConfigurationMutatorSets the value ofbaseUrl
property.- Specified by:
setBaseUrlin interfaceConfigurationMutator- Parameters:
baseUrl- property value- See Also:
()
-
getPageLoadTimeout
public java.lang.Long getPageLoadTimeout()
Description copied from interface:ConfigurationPropertiespageLoadTimeout
property. Sets the amount of time in millisecond to wait for a page load to complete before throwing an error. If the timeout is negative, page loads can be indefinite. Default value is null.- Specified by:
getPageLoadTimeoutin interfaceConfigurationProperties- Returns:
- pageLoadTimeout property value
- See Also:
WebDriver.Timeouts.pageLoadTimeout(long, java.util.concurrent.TimeUnit)
-
setPageLoadTimeout
public void setPageLoadTimeout(java.lang.Long pageLoadTimeout)
Description copied from interface:ConfigurationMutatorSets the value ofpageLoadTimeout
property.- Specified by:
setPageLoadTimeoutin interfaceConfigurationMutator- Parameters:
pageLoadTimeout- property value- See Also:
ConfigurationProperties.getPageLoadTimeout()
-
getImplicitlyWait
public java.lang.Long getImplicitlyWait()
Description copied from interface:ConfigurationPropertiesimplicitlyWait
property. Specifies the amount of time in millisecond the driver should wait when searching for an element if it is not immediately present. Default value is null.- Specified by:
getImplicitlyWaitin interfaceConfigurationProperties- Returns:
- implicitlyWait property value
- See Also:
WebDriver.Timeouts.implicitlyWait(long, java.util.concurrent.TimeUnit)
-
setImplicitlyWait
public void setImplicitlyWait(java.lang.Long implicitlyWait)
Description copied from interface:ConfigurationMutatorSets the value ofimplicitlyWait
property.- Specified by:
setImplicitlyWaitin interfaceConfigurationMutator- Parameters:
implicitlyWait- property value- See Also:
ConfigurationProperties.getImplicitlyWait()
-
getScriptTimeout
public java.lang.Long getScriptTimeout()
Description copied from interface:ConfigurationPropertiesscriptTimeout
property. Sets the amount of time in millisecond to wait for an asynchronous script to finish execution before throwing an error. If the timeout is negative, then the script will be allowed to run indefinitely. Default value is null.- Specified by:
getScriptTimeoutin interfaceConfigurationProperties- Returns:
- scriptTimeout property value
- See Also:
WebDriver.Timeouts.setScriptTimeout(long, java.util.concurrent.TimeUnit)
-
setScriptTimeout
public void setScriptTimeout(java.lang.Long scriptTimeout)
Description copied from interface:ConfigurationMutatorSets the value ofscriptTimeout
property.- Specified by:
setScriptTimeoutin interfaceConfigurationMutator- Parameters:
scriptTimeout- property value- See Also:
ConfigurationProperties.getScriptTimeout()
-
getAwaitAtMost
public java.lang.Long getAwaitAtMost()
Description copied from interface:ConfigurationPropertiesawaitAtMost
property. Sets the default timeout in millisecond when usingAwaitControl.await()orWaithook.- Specified by:
getAwaitAtMostin interfaceConfigurationProperties- Returns:
- awaitTimeout property value
- See Also:
FluentWaitConfiguration.atMost(long, java.util.concurrent.TimeUnit),FluentWaitConfiguration.atMost(long)
-
setAwaitAtMost
public void setAwaitAtMost(java.lang.Long awaitAtMost)
Description copied from interface:ConfigurationMutatorSets the value ofawaitAtMost
property- Specified by:
setAwaitAtMostin interfaceConfigurationMutator- Parameters:
awaitAtMost- property value- See Also:
ConfigurationProperties.getAwaitAtMost()
-
getAwaitPollingEvery
public java.lang.Long getAwaitPollingEvery()
Description copied from interface:ConfigurationPropertiesawaitPollingEvery
property. Sets the default polling frequency in millisecond when usingAwaitControl.await()orWaithook.- Specified by:
getAwaitPollingEveryin interfaceConfigurationProperties- Returns:
- awaitPollingEvery property value
- See Also:
FluentWaitConfiguration.pollingEvery(long, java.util.concurrent.TimeUnit),FluentWaitConfiguration.pollingEvery(long)
-
setAwaitPollingEvery
public void setAwaitPollingEvery(java.lang.Long awaitPollingEvery)
Description copied from interface:ConfigurationMutatorSets the value ofawaitPollingEvery
property- Specified by:
setAwaitPollingEveryin interfaceConfigurationMutator- Parameters:
awaitPollingEvery- property value- See Also:
ConfigurationProperties.getAwaitPollingEvery()
-
getEventsEnabled
public java.lang.Boolean getEventsEnabled()
Description copied from interface:ConfigurationPropertieseventsEnabled
property. EnablesFluentControlImpl.events()by wrapping theWebDriverinEventFiringWebDriver. Default value is true.- Specified by:
getEventsEnabledin interfaceConfigurationProperties- Returns:
- eventsEnabled property value.
-
setEventsEnabled
public void setEventsEnabled(java.lang.Boolean eventsEnabled)
Description copied from interface:ConfigurationMutatorSets the value ofeventsEnabled
property.- Specified by:
setEventsEnabledin interfaceConfigurationMutator- Parameters:
eventsEnabled- property value
-
setScreenshotPath
public void setScreenshotPath(java.lang.String path)
Description copied from interface:ConfigurationMutatorSets the value ofscreenshotPath
property.- Specified by:
setScreenshotPathin interfaceConfigurationMutator- Parameters:
path- property value- See Also:
ConfigurationProperties.getScreenshotPath()
-
setHtmlDumpPath
public void setHtmlDumpPath(java.lang.String htmlDumpPath)
Description copied from interface:ConfigurationMutatorSets the value ofhtmlDumpPath
property.- Specified by:
setHtmlDumpPathin interfaceConfigurationMutator- Parameters:
htmlDumpPath- property value- See Also:
ConfigurationProperties.getHtmlDumpPath()
-
setScreenshotMode
public void setScreenshotMode(ConfigurationProperties.TriggerMode mode)
Description copied from interface:ConfigurationMutatorSets the value ofscreenshotMode
property.- Specified by:
setScreenshotModein interfaceConfigurationMutator- Parameters:
mode- property value- See Also:
ConfigurationProperties.getScreenshotMode()
-
getScreenshotMode
public ConfigurationProperties.TriggerMode getScreenshotMode()
Description copied from interface:ConfigurationPropertiesscreenshotMode
property. Sets the trigger mode of screenshots. Can be {AUTOMATIC_ON_FAIL} to take screenshot when the test fail or {MANUAL}. Default value is null.- Specified by:
getScreenshotModein interfaceConfigurationProperties- Returns:
- screenshotMode property value.
- See Also:
ConfigurationProperties.TriggerMode
-
getScreenshotPath
public java.lang.String getScreenshotPath()
Description copied from interface:ConfigurationPropertiesscreenshotPath
property. Sets the filesystem path where screenshot will be saved when callingFluentControlImpl.takeScreenshot()orFluentControlImpl.takeScreenshot(String). Default value is null.- Specified by:
getScreenshotPathin interfaceConfigurationProperties- Returns:
- screenshotPath property value
-
getHtmlDumpPath
public java.lang.String getHtmlDumpPath()
Description copied from interface:ConfigurationPropertieshtmlDumpPath
property. Sets the filesystem path where screenshot will be saved when callingFluentControlImpl.takeHtmlDump()orFluentControlImpl.takeHtmlDump(String). Default value is null.- Specified by:
getHtmlDumpPathin interfaceConfigurationProperties- Returns:
- htmlDumpPath property value
-
setHtmlDumpMode
public void setHtmlDumpMode(ConfigurationProperties.TriggerMode htmlDumpMode)
Description copied from interface:ConfigurationMutatorSets the value ofhtmlDumpMode
property.- Specified by:
setHtmlDumpModein interfaceConfigurationMutator- Parameters:
htmlDumpMode- property value- See Also:
ConfigurationProperties.getHtmlDumpMode()
-
getHtmlDumpMode
public ConfigurationProperties.TriggerMode getHtmlDumpMode()
Description copied from interface:ConfigurationPropertieshtmlDumpMode
property. Sets the trigger mode of htmlDump. Can be {AUTOMATIC_ON_FAIL} to take html dump when the test fail or {MANUAL}. Default value is null.- Specified by:
getHtmlDumpModein interfaceConfigurationProperties- Returns:
- htmlDumpMode property value.
- See Also:
ConfigurationProperties.TriggerMode
-
getCustomProperty
public java.lang.String getCustomProperty(java.lang.String propertyName)
Description copied from interface:ConfigurationPropertiesGet custom property value.- Specified by:
getCustomPropertyin interfaceConfigurationProperties- Parameters:
propertyName- name of the property- Returns:
- property value
-
setCustomProperty
public void setCustomProperty(java.lang.String key, java.lang.String value)Description copied from interface:ConfigurationMutatorSets custom value for a custom property key- Specified by:
setCustomPropertyin interfaceConfigurationMutator- Parameters:
key- custom property keyvalue- custom property value
-
-