Package io.fluentlenium.configuration
Class ReflectiveWebDriverFactory
java.lang.Object
io.fluentlenium.configuration.ReflectiveWebDriverFactory
- All Implemented Interfaces:
Factory
,FactoryNames
,ReflectiveFactory
,WebDriverFactory
- Direct Known Subclasses:
DefaultWebDriverFactories.ChromeWebDriverFactory
,DefaultWebDriverFactories.EdgeWebDriverFactory
,DefaultWebDriverFactories.FirefoxWebDriverFactory
,DefaultWebDriverFactories.HtmlUnitWebDriverFactory
,DefaultWebDriverFactories.InternetExplorerWebDriverFactory
,DefaultWebDriverFactories.OperaWebDriverFactory
,DefaultWebDriverFactories.RemoteWebDriverFactory
,DefaultWebDriverFactories.SafariWebDriverFactory
public class ReflectiveWebDriverFactory
extends Object
implements WebDriverFactory, ReflectiveFactory, FactoryNames
A simple
WebDriverFactory
that create WebDriver
instances using reflection.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionReflectiveWebDriverFactory
(String name, Class<? extends org.openqa.selenium.WebDriver> webDriverClass, Object... args) Creates a new reflective web driver factory.ReflectiveWebDriverFactory
(String name, String webDriverClassName, Object... args) Creates a new reflective web driver factory. -
Method Summary
Modifier and TypeMethodDescriptionString[]
getNames()
Get the factory names.Class<? extends org.openqa.selenium.WebDriver>
Get web driver class.boolean
Check if the class instantiated by this factory is available.protected org.openqa.selenium.remote.DesiredCapabilities
Creates new default capabilities.protected org.openqa.selenium.WebDriver
newInstance
(Class<? extends org.openqa.selenium.WebDriver> webDriverClass, ConfigurationProperties configuration, Object... args) Creates a new instance of web driver.org.openqa.selenium.WebDriver
newWebDriver
(org.openqa.selenium.Capabilities capabilities, ConfigurationProperties configuration) Creates a new instance ofWebDriver
.
-
Field Details
-
name
-
args
-
webDriverClassName
-
webDriverClass
-
available
protected boolean available
-
-
Constructor Details
-
ReflectiveWebDriverFactory
Creates a new reflective web driver factory.- Parameters:
name
- factory namewebDriverClassName
- web driver class nameargs
- web driver class constructor arguments
-
ReflectiveWebDriverFactory
public ReflectiveWebDriverFactory(String name, Class<? extends org.openqa.selenium.WebDriver> webDriverClass, Object... args) Creates a new reflective web driver factory.- Parameters:
name
- factory namewebDriverClass
- web driver classargs
- web driver class constructor arguments
-
-
Method Details
-
getWebDriverClass
Get web driver class.- Returns:
- web driver class
-
isAvailable
public boolean isAvailable()Description copied from interface:ReflectiveFactory
Check if the class instantiated by this factory is available.- Specified by:
isAvailable
in interfaceReflectiveFactory
- Returns:
- true if the class is available.
-
newDefaultCapabilities
protected org.openqa.selenium.remote.DesiredCapabilities newDefaultCapabilities()Creates new default capabilities.- Returns:
- default capabilities
-
newWebDriver
public org.openqa.selenium.WebDriver newWebDriver(org.openqa.selenium.Capabilities capabilities, ConfigurationProperties configuration) Description copied from interface:WebDriverFactory
Creates a new instance ofWebDriver
.- Specified by:
newWebDriver
in interfaceWebDriverFactory
- Parameters:
capabilities
- Desired capabilities for the web driverconfiguration
- Configuration- Returns:
- new instance of web driver
-
newInstance
protected org.openqa.selenium.WebDriver newInstance(Class<? extends org.openqa.selenium.WebDriver> webDriverClass, ConfigurationProperties configuration, Object... args) throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException Creates a new instance of web driver.- Parameters:
webDriverClass
- web driver classconfiguration
- configurationargs
- web driver class constructor arguments- Returns:
- new web driver instance
- Throws:
NoSuchMethodException
- if a matching method is not found.IllegalAccessException
- if thisConstructor
object is enforcing Java language access control and the underlying constructor is inaccessible.InstantiationException
- if the class that declares the underlying constructor represents an abstract class.InvocationTargetException
- if the underlying constructor throws an exception.
-
getNames
Description copied from interface:FactoryNames
Get the factory names.- Specified by:
getNames
in interfaceFactoryNames
- Returns:
- array of factory names
-