Table of Contents

Interface IGetsWebDriver

Namespace
CSF.Extensions.WebDriver
Assembly
CSF.Extensions.WebDriver.dll

An object which can get an OpenQA.Selenium.IWebDriver from the options available in the application.

public interface IGetsWebDriver

Remarks

This integrates with the Microsoft-recommended Options Pattern: https://learn.microsoft.com/en-us/dotnet/core/extensions/options. The default implementation of this interface will make use of IOptions<TOptions> of WebDriverCreationOptionsCollection which provides a 'universal configuration' mechanism for WebDriver creation options.

Methods

GetDefaultWebDriver(Action<DriverOptions>)

Gets an OpenQA.Selenium.IWebDriver using the driver configuration indicated by the SelectedConfiguration.

WebDriverAndOptions GetDefaultWebDriver(Action<DriverOptions> supplementaryConfiguration = null)

Parameters

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 and the options which were used to create it.

Remarks

The supplementaryConfiguration can be useful for customising the WebDriver options in a manner specific to a single WebDriver. For example some remote WebDriver providers offer a facility to 'tag' the WebDriver with a current test/scenario name. This is done by adding additional options to the DriverOptions, specific to that scenario.

GetWebDriver(string, Action<DriverOptions>)

Gets an OpenQA.Selenium.IWebDriver using the named driver configuration.

WebDriverAndOptions GetWebDriver(string configurationName, Action<DriverOptions> supplementaryConfiguration = null)

Parameters

configurationName string

The driver configuration name.

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 and the options which were used to create it.

Remarks

The configurationName must correspond to a key within the DriverConfigurations collection.

The supplementaryConfiguration can be useful for customising the WebDriver options in a manner specific to a single WebDriver. For example some remote WebDriver providers offer a facility to 'tag' the WebDriver with a current test/scenario name. This is done by adding additional options to the DriverOptions, specific to that scenario.