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.RemoteWebDriverFactory,DefaultWebDriverFactories.SafariWebDriverFactory
public class ReflectiveWebDriverFactory
extends Object
implements WebDriverFactory, ReflectiveFactory, FactoryNames
A simple
WebDriverFactory that create WebDriver instances using reflection.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReflectiveWebDriverFactory(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.booleanCheck if the class instantiated by this factory is available.protected org.openqa.selenium.remote.DesiredCapabilitiesCreates new default capabilities.protected org.openqa.selenium.WebDrivernewInstance(Class<? extends org.openqa.selenium.WebDriver> webDriverClass, ConfigurationProperties configuration, Object... args) Creates a new instance of web driver.org.openqa.selenium.WebDrivernewWebDriver(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:ReflectiveFactoryCheck if the class instantiated by this factory is available.- Specified by:
isAvailablein 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:WebDriverFactoryCreates a new instance ofWebDriver.- Specified by:
newWebDriverin 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 thisConstructorobject 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:FactoryNamesGet the factory names.- Specified by:
getNamesin interfaceFactoryNames- Returns:
- array of factory names
-