Class RemoteWebDriverFromOptionsFactory
- Namespace
- CSF.Extensions.WebDriver.Factories
- Assembly
- CSF.Extensions.WebDriver.dll
Chain of responsibility implementation of ICreatesWebDriverFromOptions which creates instances of OpenQA.Selenium.Remote.RemoteWebDriver.
public class RemoteWebDriverFromOptionsFactory : ICreatesWebDriverFromOptions
- Inheritance
-
RemoteWebDriverFromOptionsFactory
- Implements
- Inherited Members
- Extension Methods
Constructors
RemoteWebDriverFromOptionsFactory(IGetsWebDriverAndOptionsTypes, ILogger<RemoteWebDriverFromOptionsFactory>, ICreatesWebDriverFromOptions)
Initialises a new instance of RemoteWebDriverFromOptionsFactory.
public RemoteWebDriverFromOptionsFactory(IGetsWebDriverAndOptionsTypes typeProvider, ILogger<RemoteWebDriverFromOptionsFactory> logger, ICreatesWebDriverFromOptions next)
Parameters
typeProvider
IGetsWebDriverAndOptionsTypesA type-providing service
logger
ILogger<RemoteWebDriverFromOptionsFactory>A logger
next
ICreatesWebDriverFromOptionsThe next service in the chain of responsibility.
Exceptions
- ArgumentNullException
If any parameters 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.