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 Details

    • name

      protected String name
    • args

      protected Object[] args
    • webDriverClassName

      protected String webDriverClassName
    • webDriverClass

      protected Class<? extends org.openqa.selenium.WebDriver> webDriverClass
    • available

      protected boolean available
  • Constructor Details

    • ReflectiveWebDriverFactory

      public ReflectiveWebDriverFactory (String name, String webDriverClassName, Object... args)
      Creates a new reflective web driver factory.
      Parameters:
      name - factory name
      webDriverClassName - web driver class name
      args - 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 name
      webDriverClass - web driver class
      args - web driver class constructor arguments
  • Method Details

    • getWebDriverClass

      public Class<? extends org.openqa.selenium.WebDriver> 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 interface ReflectiveFactory
      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 of WebDriver.
      Specified by:
      newWebDriver in interface WebDriverFactory
      Parameters:
      capabilities - Desired capabilities for the web driver
      configuration - 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 class
      configuration - configuration
      args - web driver class constructor arguments
      Returns:
      new web driver instance
      Throws:
      NoSuchMethodException - if a matching method is not found.
      IllegalAccessException - if this Constructor 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

      public String[] getNames()
      Description copied from interface: FactoryNames
      Get the factory names.
      Specified by:
      getNames in interface FactoryNames
      Returns:
      array of factory names