Interface ConfigurationProperties
- All Known Subinterfaces:
Configuration
,FluentControl
,FluentPageControl
,IFluentAdapter
- All Known Implementing Classes:
AnnotationConfiguration
,BaseFluentHook
,BaseHook
,ComposedConfiguration
,ConfigurationDefaults
,ContainerFluentControl
,DefaultFluentContainer
,FluentAdapter
,FluentControlImpl
,FluentCucumberTest
,FluentDriver
,FluentPage
,FluentStandalone
,FluentStandaloneRunnable
,FluentTest
,FluentTest
,FluentTestNg
,FluentTestNgSpringTest
,FluentTestRunnerAdapter
,IsolatedTest
,ProgrammaticConfiguration
,PropertiesBackendConfiguration
,WaitHook
It's possible to define those properties using:
- Overrides of JavaBean property getters of the test class.
(ie. override
getWebDriver()
) - JavaBean property setters of the test class.
(ie. call
ConfigurationMutator.setWebDriver(String)
) - System properties of the Java Environment, passed using -D on the command line.
Property names must be prefixed with fluentlenium..
(ie. Launch test with
-Dfluentlenium.webDriver=chrome
) - Environment Variable of the Operating System. Property names must be prefixed with fluentlenium.. (ie: EXPORT fluentlenium.webDriver=chrome)
-
FluentConfiguration
annotation on test class to configure.{@literal @FluentConfiguration(webDriver="chrome")} public class SomeFluentTest extends FluentTest { .... }
-
Java Properties file located at
/fluentlenium.properties
in the classpathwebDriver=chrome ...
-
ConfigurationProperties
custom implementation specified byconfigurationDefaults
property.public class CustomConfigurationDefaults extends ConfigurationDefaults { {@literal @Override} public String getWebDriver() { return "chrome"; } } $ cat fluentlenium.properties configurationDefaults=org.your.package.CustomConfigurationDefaults
You may implement additionnal ways to read configuration property by implementing another
ConfigurationFactory
and set your configuration factory class in the
configurationFactoryproperty.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Driver lifecycle.static enum
Trigger mode for Screenshots and HtmlDump features -
Method Summary
Modifier and TypeMethodDescriptionawaitAtMostawaitPollingEverybaseUrlbrowserTimeoutbrowserTimeoutRetriesorg.openqa.selenium.Capabilities
capabilitiesClass<? extends ConfigurationProperties>
configurationDefaultsClass<? extends ConfigurationFactory>
configurationFactorygetCustomProperty
(String propertyName) Get custom property value.deleteCookiesdriverLifecycleeventsEnabledhtmlDumpModehtmlDumpPathimplicitlyWaitpageLoadTimeoutremoteUrlscreenshotModescreenshotPathscriptTimeoutwebDriver
-
Method Details
-
getWebDriver
String getWebDriver()webDriver
property.Sets the WebDriver type to use.
When FluentLenium needs to create a new
WebDriver
instance, it callsIFluentAdapter.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", "opera", "remote" or any class name implementing
WebDriver
or any name that is defined in the `@FactoryName` annotation of a `WebDriverFactory` implementation.Default value is "firefox".
- Returns:
- webDriver property value
- See Also:
-
getRemoteUrl
String getRemoteUrl()remoteUrl
property. Sets the remoteUrl for "remote" webDriver.- Returns:
- remoteUrl property value
- See Also:
-
RemoteWebDriver
-
getCapabilities
org.openqa.selenium.Capabilities getCapabilities()capabilities
property. Sets the Capabilities to use, as a JSON Object or a URL pointing to a JSON Object. Default value is "null".- Returns:
- Capabilities property value
- See Also:
-
Capabilities
- Selenium DesiredCapabilities Wiki Page
-
getBaseUrl
String getBaseUrl()baseUrl
property. Sets the base URL used to build absolute URL when relative URL is given toFluentControl.goTo(String)
. Default value is null.- Returns:
- baseUrl property value
-
getDriverLifecycle
ConfigurationProperties.DriverLifecycle getDriverLifecycle()driverLifecycle
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.- Returns:
- driverLifecycle property value
-
getBrowserTimeout
Long getBrowserTimeout()browserTimeout
property. Sets the maximum amount of time when the browser should start responding to the WebDriver. Default value is 60 seconds.- Returns:
- long
-
getBrowserTimeoutRetries
Integer getBrowserTimeoutRetries()browserTimeoutRetries
property. Sets the maximum number of retries for failed WebDriver because of browserTimeout issues. Default value is 2 times.- Returns:
- Integer
-
getDeleteCookies
Boolean getDeleteCookies()deleteCookies
property. When using CLASS or JVMdriverLifecycle
configuration property, allow to delete cookies between each test. Default value is false.- Returns:
- deleteCookies property value.
-
getPageLoadTimeout
Long getPageLoadTimeout()pageLoadTimeout
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.- Returns:
- pageLoadTimeout property value
- See Also:
-
WebDriver.Timeouts.pageLoadTimeout(long, java.util.concurrent.TimeUnit)
-
getImplicitlyWait
Long getImplicitlyWait()implicitlyWait
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.- Returns:
- implicitlyWait property value
- See Also:
-
WebDriver.Timeouts.implicitlyWait(long, java.util.concurrent.TimeUnit)
-
getScriptTimeout
Long getScriptTimeout()scriptTimeout
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.- Returns:
- scriptTimeout property value
- See Also:
-
WebDriver.Timeouts.setScriptTimeout(long, java.util.concurrent.TimeUnit)
-
getAwaitAtMost
Long getAwaitAtMost()awaitAtMost
property. Sets the default timeout in millisecond when usingFluentControl.await()
orWait
hook.- Returns:
- awaitTimeout property value
- See Also:
-
getAwaitPollingEvery
Long getAwaitPollingEvery()awaitPollingEvery
property. Sets the default polling frequency in millisecond when usingFluentControl.await()
orWait
hook.- Returns:
- awaitPollingEvery property value
- See Also:
-
getEventsEnabled
Boolean getEventsEnabled()eventsEnabled
property. EnablesFluentControl.events()
by wrapping theWebDriver
inEventFiringWebDriver
. Default value is true.- Returns:
- eventsEnabled property value.
-
getScreenshotPath
String getScreenshotPath()screenshotPath
property. Sets the filesystem path where screenshot will be saved when callingFluentControl.takeScreenshot()
orFluentControl.takeScreenshot(String)
. Default value is null.- Returns:
- screenshotPath property value
-
getScreenshotMode
ConfigurationProperties.TriggerMode getScreenshotMode()screenshotMode
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.- Returns:
- screenshotMode property value.
- See Also:
-
getHtmlDumpPath
String getHtmlDumpPath()htmlDumpPath
property. Sets the filesystem path where screenshot will be saved when callingFluentControl.takeHtmlDump()
orFluentControl.takeHtmlDump(String)
. Default value is null.- Returns:
- htmlDumpPath property value
-
getHtmlDumpMode
ConfigurationProperties.TriggerMode getHtmlDumpMode()htmlDumpMode
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.- Returns:
- htmlDumpMode property value.
- See Also:
-
getConfigurationDefaults
Class<? extends ConfigurationProperties> getConfigurationDefaults()configurationDefaults
property. Set this to a class implementingConfigurationProperties
to provide the default values of the configuration properties. Default value isConfigurationDefaults
- Returns:
- Custom
ConfigurationProperties
instance with default values.
-
getConfigurationFactory
Class<? extends ConfigurationFactory> getConfigurationFactory()configurationFactory
property. Set this to a class implementingConfigurationFactory
to customize the ways properties are read. This allow to configure properties from sources that are not supported by default FluentLenium. Default value isDefaultConfigurationFactory
class.- Returns:
- Custom
ConfigurationFactory
class.
-
getCustomProperty
Get custom property value.- Parameters:
propertyName
- name of the property- Returns:
- property value
-