Table of Contents

Class OperaOptions

Namespace
OpenQA.Selenium.Opera
Assembly
WebDriver.dll

Class to manage options specific to OperaDriver

public class OperaOptions
Inheritance
OperaOptions
Inherited Members

Examples

OperaOptions options = new OperaOptions();
options.AddExtensions("\path\to\extension.crx");
options.BinaryLocation = "\path\to\opera";

For use with OperaDriver:

OperaDriver driver = new OperaDriver(options);

For use with RemoteWebDriver:

RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), options.ToCapabilities());

Remarks

Used with OperaDriver.exe for Chromium v0.1.0 and higher.

Constructors

OperaOptions()

public OperaOptions()

Fields

Capability

Gets the name of the capability used to store Opera options in a DesiredCapabilities object.

public static readonly string Capability

Field Value

string

Properties

Arguments

Gets the list of arguments appended to the Opera command line as a string array.

public ReadOnlyCollection<string> Arguments { get; }

Property Value

ReadOnlyCollection<string>

BinaryLocation

Gets or sets the location of the Opera browser's binary executable file.

public string BinaryLocation { get; set; }

Property Value

string

DebuggerAddress

Gets or sets the address of a Opera debugger server to connect to. Should be of the form "{hostname|IP address}:port".

public string DebuggerAddress { get; set; }

Property Value

string

Extensions

Gets the list of extensions to be installed as an array of base64-encoded strings.

public ReadOnlyCollection<string> Extensions { get; }

Property Value

ReadOnlyCollection<string>

LeaveBrowserRunning

Gets or sets a value indicating whether Opera should be left running after the OperaDriver instance is exited. Defaults to false.

public bool LeaveBrowserRunning { get; set; }

Property Value

bool

MinidumpPath

Gets or sets the directory in which to store minidump files.

public string MinidumpPath { get; set; }

Property Value

string

Proxy

Gets or sets the proxy to use with this instance of Opera.

public Proxy Proxy { get; set; }

Property Value

Proxy

Methods

AddAdditionalCapability(string, object)

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

public void AddAdditionalCapability(string capabilityName, object capabilityValue)

Parameters

capabilityName string

The name of the capability to add.

capabilityValue object

The value of the capability to add.

Remarks

Calling AddAdditionalCapability(string, object) where capabilityName has already been added will overwrite the existing value with the new value in capabilityValue. Also, by default, calling this method adds capabilities to the options object passed to operadriver.exe.

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.

AddAdditionalCapability(string, object, bool)

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

public void AddAdditionalCapability(string capabilityName, object capabilityValue, bool isGlobalCapability)

Parameters

capabilityName string

The name of the capability to add.

capabilityValue object

The value of the capability to add.

isGlobalCapability bool

Indicates whether the capability is to be set as a global capability for the driver instead of a Opera-specific option.

Remarks

Calling AddAdditionalCapability(string, object, bool) where capabilityName has already been added will overwrite the existing value with the new value in capabilityValue

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.

AddArgument(string)

Adds a single argument to the list of arguments to be appended to the Opera.exe command line.

public void AddArgument(string argument)

Parameters

argument string

The argument to add.

AddArguments(IEnumerable<string>)

Adds arguments to be appended to the Opera.exe command line.

public void AddArguments(IEnumerable<string> argumentsToAdd)

Parameters

argumentsToAdd IEnumerable<string>

An IEnumerable<T> object of arguments to add.

AddArguments(params string[])

Adds arguments to be appended to the Opera.exe command line.

public void AddArguments(params string[] argumentsToAdd)

Parameters

argumentsToAdd string[]

An array of arguments to add.

AddEncodedExtension(string)

Adds a base64-encoded string representing a Opera extension to the list of extensions to be installed in the instance of Opera.

public void AddEncodedExtension(string extension)

Parameters

extension string

A base64-encoded string representing the extension to add.

AddEncodedExtensions(IEnumerable<string>)

Adds a list of base64-encoded strings representing Opera extensions to be installed in the instance of Opera.

public void AddEncodedExtensions(IEnumerable<string> extensions)

Parameters

extensions IEnumerable<string>

An IEnumerable<T> of base64-encoded strings representing the extensions to add.

AddEncodedExtensions(params string[])

Adds a list of base64-encoded strings representing Opera extensions to the list of extensions to be installed in the instance of Opera.

public void AddEncodedExtensions(params string[] extensions)

Parameters

extensions string[]

An array of base64-encoded strings representing the extensions to add.

AddExcludedArgument(string)

Adds a single argument to be excluded from the list of arguments passed by default to the Opera.exe command line by operadriver.exe.

public void AddExcludedArgument(string argument)

Parameters

argument string

The argument to exclude.

AddExcludedArguments(IEnumerable<string>)

Adds arguments to be excluded from the list of arguments passed by default to the Opera.exe command line by operadriver.exe.

public void AddExcludedArguments(IEnumerable<string> argumentsToExclude)

Parameters

argumentsToExclude IEnumerable<string>

An IEnumerable<T> object of arguments to exclude.

AddExcludedArguments(params string[])

Adds arguments to be excluded from the list of arguments passed by default to the Opera.exe command line by operadriver.exe.

public void AddExcludedArguments(params string[] argumentsToExclude)

Parameters

argumentsToExclude string[]

An array of arguments to exclude.

AddExtension(string)

Adds a path to a packed Opera extension (.crx file) to the list of extensions to be installed in the instance of Opera.

public void AddExtension(string pathToExtension)

Parameters

pathToExtension string

The full path to the extension to add.

AddExtensions(IEnumerable<string>)

Adds a list of paths to packed Opera extensions (.crx files) to be installed in the instance of Opera.

public void AddExtensions(IEnumerable<string> extensions)

Parameters

extensions IEnumerable<string>

An IEnumerable<T> of full paths to the extensions to add.

AddExtensions(params string[])

Adds a list of paths to packed Opera extensions (.crx files) to be installed in the instance of Opera.

public void AddExtensions(params string[] extensions)

Parameters

extensions string[]

An array of full paths to the extensions to add.

AddLocalStatePreference(string, object)

Adds a preference for the local state file in the user's data directory for Opera. If the specified preference already exists, it will be overwritten.

public void AddLocalStatePreference(string preferenceName, object preferenceValue)

Parameters

preferenceName string

The name of the preference to set.

preferenceValue object

The value of the preference to set.

AddUserProfilePreference(string, object)

Adds a preference for the user-specific profile or "user data directory." If the specified preference already exists, it will be overwritten.

public void AddUserProfilePreference(string preferenceName, object preferenceValue)

Parameters

preferenceName string

The name of the preference to set.

preferenceValue object

The value of the preference to set.

ToCapabilities()

Returns DesiredCapabilities for Opera with these options included as capabilities. This does not copy the options. Further changes will be reflected in the returned capabilities.

public ICapabilities ToCapabilities()

Returns

ICapabilities

The DesiredCapabilities for Opera with these options.