Table of Contents

Class DriverOptions

Namespace
OpenQA.Selenium
Assembly
WebDriver.dll

Base class for managing options specific to a browser driver.

public abstract class DriverOptions
Inheritance
DriverOptions
Derived
Inherited Members

Constructors

DriverOptions()

Initializes a new instance of the DriverOptions class.

protected DriverOptions()

Properties

AcceptInsecureCertificates

Gets or sets a value indicating whether the browser should accept self-signed SSL certificates.

public bool? AcceptInsecureCertificates { get; set; }

Property Value

bool?

BinaryLocation

Set or Get the location of the browser Override in subclass

public virtual string BinaryLocation { get; set; }

Property Value

string

BrowserName

Gets or sets the name of the browser.

public string BrowserName { get; protected set; }

Property Value

string

BrowserVersion

Gets or sets the version of the browser.

public string BrowserVersion { get; set; }

Property Value

string

EnableDownloads

Gets or sets a value indicating whether files may be downloaded from remote node.

public bool? EnableDownloads { get; set; }

Property Value

bool?

ImplicitWaitTimeout

Gets or sets the implicit wait timeout, which is the amount of time the driver should wait when searching for an element if it is not immediately present.

public TimeSpan? ImplicitWaitTimeout { get; set; }

Property Value

TimeSpan?

Remarks

When searching for a single element, the driver should poll the page until the element has been found, or this timeout expires before throwing a NoSuchElementException. When searching for multiple elements, the driver should poll the page until at least one element has been found or this timeout has expired.

Increasing the implicit wait timeout should be used judiciously as it will have an adverse effect on test run time, especially when used with slower location strategies like XPath.

PageLoadStrategy

Gets or sets the value for describing how the browser is to wait for pages to load in the browser. Defaults to Default.

public PageLoadStrategy PageLoadStrategy { get; set; }

Property Value

PageLoadStrategy

PageLoadTimeout

Gets or sets the page load timeout, which is the amount of time the driver should wait for a page to load when setting the Url property.

public TimeSpan? PageLoadTimeout { get; set; }

Property Value

TimeSpan?

PlatformName

Gets or sets the name of the platform on which the browser is running.

public string PlatformName { get; set; }

Property Value

string

Proxy

Gets or sets the Proxy to be used with this browser.

public Proxy Proxy { get; set; }

Property Value

Proxy

ScriptTimeout

Gets or sets the asynchronous script timeout, which is the amount of time the driver should wait when executing JavaScript asynchronously. This timeout only affects the ExecuteAsyncScript(string, params object[]) method.

public TimeSpan? ScriptTimeout { get; set; }

Property Value

TimeSpan?

UnhandledPromptBehavior

Gets or sets the value for describing how unexpected alerts are to be handled in the browser. Defaults to Default.

public UnhandledPromptBehavior UnhandledPromptBehavior { get; set; }

Property Value

UnhandledPromptBehavior

UseStrictFileInteractability

Gets or sets a value indicating whether <input type='file'/> elements must be visible to allow uploading of files.

public bool UseStrictFileInteractability { get; set; }

Property Value

bool

UseWebSocketUrl

Gets or sets a value indicating whether the driver should request a URL to a WebSocket to be used for bidirectional communication.

public bool? UseWebSocketUrl { get; set; }

Property Value

bool?

Methods

AddAdditionalOption(string, object)

Provides a means to add additional capabilities not yet added as type safe options for the specific browser driver.

public virtual void AddAdditionalOption(string optionName, object optionValue)

Parameters

optionName string

The name of the capability to add.

optionValue object

The value of the capability to add.

Remarks

Calling AddAdditionalOption(string, object) where optionName has already been added will overwrite the existing value with the new value in optionValue.

Exceptions

ArgumentException

thrown when attempting to add a capability for which there is already a type safe option, or when optionName is null or the empty string.

AddKnownCapabilityName(string, string)

Adds a known capability to the list of known capabilities and associates it with the type-safe property name of the options class to be used instead.

protected void AddKnownCapabilityName(string capabilityName, string typeSafeOptionName)

Parameters

capabilityName string

The name of the capability.

typeSafeOptionName string

The name of the option property or method to be used instead.

GenerateDesiredCapabilities(bool)

Generates the current options as a capabilities object for further processing.

protected IWritableCapabilities GenerateDesiredCapabilities(bool isSpecificationCompliant)

Parameters

isSpecificationCompliant bool

A value indicating whether to generate capabilities compliant with the W3C WebDriver Specification.

Returns

IWritableCapabilities

A IWritableCapabilities object representing the current options for further processing.

GenerateLoggingPreferencesDictionary()

Generates the logging preferences dictionary for transmission as a desired capability.

protected Dictionary<string, object> GenerateLoggingPreferencesDictionary()

Returns

Dictionary<string, object>

The dictionary containing the logging preferences.

GetMergeResult(DriverOptions)

Compares this DriverOptions object with another to see if there are merge conflicts between them.

public virtual DriverOptionsMergeResult GetMergeResult(DriverOptions other)

Parameters

other DriverOptions

The DriverOptions object to compare with.

Returns

DriverOptionsMergeResult

A DriverOptionsMergeResult object containing the status of the attempted merge.

GetTypeSafeOptionName(string)

Gets the name of the type-safe option for a given capability name.

protected string GetTypeSafeOptionName(string capabilityName)

Parameters

capabilityName string

The name of the capability to check.

Returns

string

The name of the type-safe option for the given capability name.

IsKnownCapabilityName(string)

Gets a value indicating whether the specified capability name is a known capability name which has a type-safe option.

protected bool IsKnownCapabilityName(string capabilityName)

Parameters

capabilityName string

The name of the capability to check.

Returns

bool

true if the capability name is known; otherwise false.

RemoveKnownCapabilityName(string)

Remove a capability from the list of known capabilities

protected void RemoveKnownCapabilityName(string capabilityName)

Parameters

capabilityName string

The name of the capability to be removed.

SetLoggingPreference(string, LogLevel)

Sets the logging preferences for this driver.

public void SetLoggingPreference(string logType, LogLevel logLevel)

Parameters

logType string

The type of log for which to set the preference. Known log types can be found in the LogType class.

logLevel LogLevel

The LogLevel value to which to set the log level.

ToCapabilities()

Returns the ICapabilities for the specific browser driver with these options included as capabilities. This does not copy the options. Further changes will be reflected in the returned capabilities.

public abstract ICapabilities ToCapabilities()

Returns

ICapabilities

The ICapabilities for browser driver with these options.

ValidateCapabilityName(string)

Validates the name of the capability to verify it is not a capability for which a type-safe property or method already exists.

protected void ValidateCapabilityName(string capabilityName)

Parameters

capabilityName string

The name of the capability to validate.

Exceptions

ArgumentException

thrown when attempting to add a capability for which there is already a type safe option, or when capabilityName is null or the empty string.