Class ProxyWrappingWebDriverFactoryDecorator
- Namespace
- CSF.Extensions.WebDriver.Factories
- Assembly
- CSF.Extensions.WebDriver.dll
Decorator for implementations of ICreatesWebDriverFromOptions which (if applicable) wraps the returned WebDriver in a proxy object, which adds further functionality.
public class ProxyWrappingWebDriverFactoryDecorator : ICreatesWebDriverFromOptions
- Inheritance
-
ProxyWrappingWebDriverFactoryDecorator
- Implements
- Inherited Members
- Extension Methods
Constructors
ProxyWrappingWebDriverFactoryDecorator(ICreatesWebDriverFromOptions, IGetsProxyWebDriver, ILogger<ProxyWrappingWebDriverFactoryDecorator>)
Initialises a new instance of ProxyWrappingWebDriverFactoryDecorator.
public ProxyWrappingWebDriverFactoryDecorator(ICreatesWebDriverFromOptions wrapped, IGetsProxyWebDriver proxyFactory, ILogger<ProxyWrappingWebDriverFactoryDecorator> logger)
Parameters
wrapped
ICreatesWebDriverFromOptionsThe wrapped factory
proxyFactory
IGetsProxyWebDriverA proxy factory implementation
logger
ILogger<ProxyWrappingWebDriverFactoryDecorator>A logger
Exceptions
- ArgumentNullException
If any parameter is null.
Methods
GetWebDriver(WebDriverCreationOptions, Action<DriverOptions>)
Gets a WebDriver using the settings from the specified WebDriver configuration object.
public WebDriverAndOptions GetWebDriver(WebDriverCreationOptions options, Action<DriverOptions> supplementaryConfiguration = null)
Parameters
options
WebDriverCreationOptionsAn object indicating which WebDriver implementation to use and how the WebDriver should be configured.
supplementaryConfiguration
Action<DriverOptions>An optional action which further-configures the WebDriver options before the driver is created.
Returns
- WebDriverAndOptions
An object containing both a WebDriver instance and the OpenQA.Selenium.DriverOptions which were used to create it.
Remarks
The WebDriver configuration object specifies both the OpenQA.Selenium.IWebDriver implementation type to use as well as any relevant options for that WebDriver.
Exceptions
- ArgumentNullException
If
options
is null.- ArgumentException
If any of:
- The DriverType of the
options
is null or empty - The OptionsFactory of the
options
is null - The DriverType of the
options
is set to an implementation of OpenQA.Selenium.IWebDriver which does not expose a public constructor which takes a single parameter of type OpenQA.Selenium.DriverOptions (or a more derived type). Such WebDriver implementations will require a custom factory, indicated by DriverFactoryType - The DriverFactoryType of the
options
is not null, but the implementation of ICreatesWebDriverFromOptions indicated by that type did not return an OpenQA.Selenium.IWebDriver instance
- The DriverType of the
- TypeLoadException
Either DriverType or DriverFactoryType of the
options
are non-null/non-empty but no type can be found matching the specifed values.