Package org.fluentlenium.configuration
Class ReflectiveWebDriverFactory
- java.lang.Object
-
- org.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.PhantomJSWebDriverFactory,DefaultWebDriverFactories.RemoteWebDriverFactory,DefaultWebDriverFactories.SafariWebDriverFactory
public class ReflectiveWebDriverFactory extends java.lang.Object implements WebDriverFactory, ReflectiveFactory, FactoryNames
A simpleWebDriverFactorythat createWebDriverinstances using reflection.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Object[]argsprotected booleanavailableprotected java.lang.Stringnameprotected java.lang.Class<? extends org.openqa.selenium.WebDriver>webDriverClassprotected java.lang.StringwebDriverClassName
-
Constructor Summary
Constructors Constructor Description ReflectiveWebDriverFactory(java.lang.String name, java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriverClass, java.lang.Object... args)Creates a new reflective web driver factory.ReflectiveWebDriverFactory(java.lang.String name, java.lang.String webDriverClassName, java.lang.Object... args)Creates a new reflective web driver factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]getNames()Get the factory names.java.lang.Class<? extends org.openqa.selenium.WebDriver>getWebDriverClass()Get web driver class.booleanisAvailable()Check if the class instantiated by this factory is available.protected org.openqa.selenium.remote.DesiredCapabilitiesnewDefaultCapabilities()Creates new default capabilities.protected org.openqa.selenium.WebDrivernewInstance(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriverClass, ConfigurationProperties configuration, java.lang.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.
-
-
-
Constructor Detail
-
ReflectiveWebDriverFactory
public ReflectiveWebDriverFactory(java.lang.String name, java.lang.String webDriverClassName, java.lang.Object... args)Creates a new reflective web driver factory.- Parameters:
name- factory namewebDriverClassName- web driver class nameargs- web driver class constructor arguments
-
ReflectiveWebDriverFactory
public ReflectiveWebDriverFactory(java.lang.String name, java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriverClass, java.lang.Object... args)Creates a new reflective web driver factory.- Parameters:
name- factory namewebDriverClass- web driver classargs- web driver class constructor arguments
-
-
Method Detail
-
getWebDriverClass
public java.lang.Class<? extends org.openqa.selenium.WebDriver> 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(java.lang.Class<? extends org.openqa.selenium.WebDriver> webDriverClass, ConfigurationProperties configuration, java.lang.Object... args) throws java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessExceptionCreates a new instance of web driver.- Parameters:
webDriverClass- web driver classconfiguration- configurationargs- web driver class constructor arguments- Returns:
- new web driver instance
- Throws:
java.lang.NoSuchMethodException- if a matching method is not found.java.lang.IllegalAccessException- if thisConstructorobject is enforcing Java language access control and the underlying constructor is inaccessible.java.lang.InstantiationException- if the class that declares the underlying constructor represents an abstract class.java.lang.reflect.InvocationTargetException- if the underlying constructor throws an exception.
-
getNames
public java.lang.String[] getNames()
Description copied from interface:FactoryNamesGet the factory names.- Specified by:
getNamesin interfaceFactoryNames- Returns:
- array of factory names
-
-