Class WebDriverFromThirdPartyFactory
- Namespace
- CSF.Extensions.WebDriver.Factories
- Assembly
- CSF.Extensions.WebDriver.dll
Chain of responsibility implementation of ICreatesWebDriverFromOptions which creates WebDriver instances using a third-party factory type, specified in DriverFactoryType.
public class WebDriverFromThirdPartyFactory : ICreatesWebDriverFromOptions
- Inheritance
-
WebDriverFromThirdPartyFactory
- Implements
- Inherited Members
- Extension Methods
Constructors
WebDriverFromThirdPartyFactory(ICreatesWebDriverFromOptions, IGetsWebDriverAndOptionsTypes, IServiceProvider, ILogger<WebDriverFromThirdPartyFactory>)
Initialises a new instance of WebDriverFromThirdPartyFactory.
public WebDriverFromThirdPartyFactory(ICreatesWebDriverFromOptions next, IGetsWebDriverAndOptionsTypes typeProvider, IServiceProvider services, ILogger<WebDriverFromThirdPartyFactory> logger)
Parameters
nextICreatesWebDriverFromOptionsThe next implementation in the chain of responsibility.
typeProviderIGetsWebDriverAndOptionsTypesA type-providing service.
servicesIServiceProviderThe DI service provider.
loggerILogger<WebDriverFromThirdPartyFactory>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
optionsWebDriverCreationOptionsAn object indicating which WebDriver implementation to use and how the WebDriver should be configured.
supplementaryConfigurationAction<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
optionsis null.- ArgumentException
If any of:
- The DriverType of the
optionsis null or empty - The OptionsFactory of the
optionsis null - The DriverType of the
optionsis 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
optionsis 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
optionsare non-null/non-empty but no type can be found matching the specifed values.