Class ChromiumOptions
Abstract class to manage options specific to Chromium-based browsers.
public abstract class ChromiumOptions : DriverOptions
- Inheritance
-
ChromiumOptions
- Derived
- Inherited Members
Constructors
ChromiumOptions()
Initializes a new instance of the ChromiumOptions class.
public ChromiumOptions()
Properties
AndroidOptions
Gets or sets the options for automating Chromium applications on Android.
public ChromiumAndroidOptions AndroidOptions { get; set; }
Property Value
Arguments
Gets the list of arguments appended to the Chromium command line as a string array.
public ReadOnlyCollection<string> Arguments { get; }
Property Value
BinaryLocation
Gets or sets the location of the Chromium browser's binary executable file.
public override string BinaryLocation { get; set; }
Property Value
CapabilityName
Gets the name of the capability used to store Chromium options in an ICapabilities object.
public abstract string CapabilityName { get; }
Property Value
DebuggerAddress
Gets or sets the address of a Chromium debugger server to connect to. Should be of the form "{hostname|IP address}:port".
public string DebuggerAddress { get; set; }
Property Value
Extensions
Gets the list of extensions to be installed as an array of base64-encoded strings.
public ReadOnlyCollection<string> Extensions { get; }
Property Value
LeaveBrowserRunning
Gets or sets a value indicating whether Chromium should be left running after the ChromeDriver instance is exited. Defaults to false.
public bool LeaveBrowserRunning { get; set; }
Property Value
MinidumpPath
Gets or sets the directory in which to store minidump files.
public string MinidumpPath { get; set; }
Property Value
PerformanceLoggingPreferences
Gets or sets the performance logging preferences for the driver.
public ChromiumPerformanceLoggingPreferences PerformanceLoggingPreferences { get; set; }
Property Value
VendorPrefix
Gets the vendor prefix to apply to Chromium-specific capability names.
protected abstract string VendorPrefix { get; }
Property Value
Methods
AddAdditionalChromiumOption(string, object)
Provides a means to add additional capabilities not yet added as type safe options for the Chromium driver.
protected void AddAdditionalChromiumOption(string optionName, object optionValue)
Parameters
optionName
stringThe name of the capability to add.
optionValue
objectThe value of the capability to add.
Remarks
Calling AddAdditionalChromiumOption(string, object)
where optionName
has already been added will overwrite the
existing value with the new value in optionValue
.
Calling this method adds capabilities to the Chromium-specific options object passed to
webdriver executable (e.g. property name 'goog:chromeOptions').
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.
AddArgument(string)
Adds a single argument to the list of arguments to be appended to the browser executable command line.
public void AddArgument(string argument)
Parameters
argument
stringThe argument to add.
AddArguments(IEnumerable<string>)
Adds arguments to be appended to the browser executable 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 browser executable 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 Chrome extension to the list of extensions to be installed in the instance of Chrome.
public void AddEncodedExtension(string extension)
Parameters
extension
stringA base64-encoded string representing the extension to add.
AddEncodedExtensions(IEnumerable<string>)
Adds a list of base64-encoded strings representing Chrome extensions to be installed in the instance of Chrome.
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 Chrome extensions to the list of extensions to be installed in the instance of Chrome.
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 browser executable command line by chromedriver.exe.
public void AddExcludedArgument(string argument)
Parameters
argument
stringThe argument to exclude.
AddExcludedArguments(IEnumerable<string>)
Adds arguments to be excluded from the list of arguments passed by default to the browser executable command line by chromedriver.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 browser executable command line by chromedriver.exe.
public void AddExcludedArguments(params string[] argumentsToExclude)
Parameters
argumentsToExclude
string[]An array of arguments to exclude.
AddExtension(string)
Adds a path to a packed Chrome extension (.crx file) to the list of extensions to be installed in the instance of Chrome.
public void AddExtension(string pathToExtension)
Parameters
pathToExtension
stringThe full path to the extension to add.
AddExtensions(IEnumerable<string>)
Adds a list of paths to packed Chrome extensions (.crx files) to be installed in the instance of Chrome.
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 Chrome extensions (.crx files) to be installed in the instance of Chrome.
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 Chromium. If the specified preference already exists, it will be overwritten.
public void AddLocalStatePreference(string preferenceName, object preferenceValue)
Parameters
preferenceName
stringThe name of the preference to set.
preferenceValue
objectThe 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
stringThe name of the preference to set.
preferenceValue
objectThe value of the preference to set.
AddVendorSpecificChromiumCapabilities(IWritableCapabilities)
Adds vendor-specific capabilities for Chromium-based browsers.
protected virtual void AddVendorSpecificChromiumCapabilities(IWritableCapabilities capabilities)
Parameters
capabilities
IWritableCapabilitiesThe capabilities to add.
AddWindowType(string)
Adds a type of window that will be listed in the list of window handles returned by the Chrome driver.
public void AddWindowType(string windowType)
Parameters
windowType
stringThe name of the window type to add.
Remarks
This method can be used to allow the driver to access {webview} elements by adding "webview" as a window type.
AddWindowTypes(IEnumerable<string>)
Adds a list of window types that will be listed in the list of window handles returned by the Chromium driver.
public void AddWindowTypes(IEnumerable<string> windowTypesToAdd)
Parameters
windowTypesToAdd
IEnumerable<string>An IEnumerable<T> of window types to add.
AddWindowTypes(params string[])
Adds a list of window types that will be listed in the list of window handles returned by the Chromium driver.
public void AddWindowTypes(params string[] windowTypesToAdd)
Parameters
windowTypesToAdd
string[]An array of window types to add.
EnableMobileEmulation(ChromiumMobileEmulationDeviceSettings)
Allows the Chromium browser to emulate a mobile device.
public void EnableMobileEmulation(ChromiumMobileEmulationDeviceSettings deviceSettings)
Parameters
deviceSettings
ChromiumMobileEmulationDeviceSettingsThe ChromiumMobileEmulationDeviceSettings object containing the settings of the device to emulate.
Remarks
Specifying an invalid device name will not throw an exeption, but will generate an error in Chrome when the driver starts. To unset mobile emulation, call this method with null as the argument.
Exceptions
- ArgumentException
Thrown if the device settings option does not have a user agent string set.
EnableMobileEmulation(string)
Allows the Chromium browser to emulate a mobile device.
public void EnableMobileEmulation(string deviceName)
Parameters
deviceName
stringThe name of the device to emulate. The device name must be a valid device name from the Chrome DevTools Emulation panel.
Remarks
Specifying an invalid device name will not throw an exeption, but will generate an error in Chrome when the driver starts. To unset mobile emulation, call this method with null as the argument.
ToCapabilities()
Returns DesiredCapabilities for Chromium with these options included as capabilities. This does not copy the options. Further changes will be reflected in the returned capabilities.
public override ICapabilities ToCapabilities()
Returns
- ICapabilities
The DesiredCapabilities for Chrome with these options.