Class ChromeOptions
Class to manage options specific to ChromeDriver
public class ChromeOptions : ChromiumOptions
- Inheritance
-
ChromeOptions
- Inherited Members
Examples
ChromeOptions options = new ChromeOptions();
options.AddExtensions("\path\to\extension.crx");
options.BinaryLocation = "\path\to\chrome";
For use with ChromeDriver:
ChromeDriver driver = new ChromeDriver(options);
For use with RemoteWebDriver:
RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), options.ToCapabilities());
Remarks
Used with ChromeDriver.exe v17.0.963.0 and higher.
Constructors
ChromeOptions()
Initializes a new instance of the ChromeOptions class.
public ChromeOptions()
Properties
CapabilityName
Gets the name of the capability used to store Chromium options in an ICapabilities object.
public override string CapabilityName { get; }
Property Value
VendorPrefix
Gets the vendor prefix to apply to Chromium-specific capability names.
protected override string VendorPrefix { get; }
Property Value
Methods
AddAdditionalChromeOption(string, object)
Provides a means to add additional capabilities not yet added as type safe options for the Chrome driver.
public void AddAdditionalChromeOption(string optionName, object optionValue)
Parameters
optionName
stringThe name of the capability to add.
optionValue
objectThe value of the capability to add.
Remarks
Calling AddAdditionalChromeOption(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 Chrome-specific options object passed to
webdriver executable (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.