Table of Contents

Class ChromiumDriver

Namespace
OpenQA.Selenium.Chromium
Assembly
WebDriver.dll

Provides an abstract way to access Chromium-based browsers to run tests.

public class ChromiumDriver : WebDriver, IWebDriver, IDisposable, ISearchContext, IJavaScriptExecutor, IFindsElement, ITakesScreenshot, ISupportsPrint, IActionExecutor, IAllowsFileDetection, IHasCapabilities, IHasCommandExecutor, IHasSessionId, ICustomDriverCommandExecutor, IHasVirtualAuthenticator, ISupportsLogs, IDevTools
Inheritance
ChromiumDriver
Implements
Derived
Inherited Members
Extension Methods

Constructors

ChromiumDriver(ChromiumDriverService, ChromiumOptions, TimeSpan)

Initializes a new instance of the ChromiumDriver class using the specified ChromiumDriverService.

protected ChromiumDriver(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)

Parameters

service ChromiumDriverService

The ChromiumDriverService to use.

options ChromiumOptions

The ChromiumOptions to be used with the ChromiumDriver.

commandTimeout TimeSpan

The maximum amount of time to wait for each command.

Fields

AcceptUntrustedCertificates

Accept untrusted SSL Certificates

public static readonly bool AcceptUntrustedCertificates

Field Value

bool

DeleteNetworkConditionsCommand

Command for deleting the simulated network conditions in a driver for a Chromium-based browser.

public static readonly string DeleteNetworkConditionsCommand

Field Value

string

ExecuteCdp

Command for executing a Chrome DevTools Protocol command in a driver for a Chromium-based browser.

public static readonly string ExecuteCdp

Field Value

string

GetCastIssueMessageCommand

Command for getting a cast issued message in a driver for a Chromium-based browser.

public static readonly string GetCastIssueMessageCommand

Field Value

string

GetCastSinksCommand

Command for getting cast sinks in a driver for a Chromium-based browser.

public static readonly string GetCastSinksCommand

Field Value

string

GetNetworkConditionsCommand

Command for getting the simulated network conditions in a driver for a Chromium-based browser.

public static readonly string GetNetworkConditionsCommand

Field Value

string

LaunchAppCommand

Command for launching an app in a driver for a Chromium-based browser.

public static readonly string LaunchAppCommand

Field Value

string

SelectCastSinkCommand

Command for selecting a cast sink in a driver for a Chromium-based browser.

public static readonly string SelectCastSinkCommand

Field Value

string

SendChromeCommand

Command for executing a Chrome DevTools Protocol command in a driver for a Chromium-based browser.

public static readonly string SendChromeCommand

Field Value

string

SendChromeCommandWithResult

Command for executing a Chrome DevTools Protocol command that returns a result in a driver for a Chromium-based browser.

public static readonly string SendChromeCommandWithResult

Field Value

string

SetNetworkConditionsCommand

Command for setting the simulated network conditions in a driver for a Chromium-based browser.

public static readonly string SetNetworkConditionsCommand

Field Value

string

SetPermissionCommand

Command for setting permissions in a driver for a Chromium-based browser.

public static readonly string SetPermissionCommand

Field Value

string

StartCastDesktopMirroringCommand

Command for starting cast desktop mirroring in a driver for a Chromium-based browser.

public static readonly string StartCastDesktopMirroringCommand

Field Value

string

StartCastTabMirroringCommand

Command for starting cast tab mirroring in a driver for a Chromium-based browser.

public static readonly string StartCastTabMirroringCommand

Field Value

string

StopCastingCommand

Command for stopping casting in a driver for a Chromium-based browser.

public static readonly string StopCastingCommand

Field Value

string

Properties

ChromiumCustomCommands

Gets the dictionary of custom Chromium commands registered with the driver.

protected static IReadOnlyDictionary<string, CommandInfo> ChromiumCustomCommands { get; }

Property Value

IReadOnlyDictionary<string, CommandInfo>

FileDetector

Gets or sets the IFileDetector responsible for detecting sequences of keystrokes representing file paths and names.

public override IFileDetector FileDetector { get; set; }

Property Value

IFileDetector

Remarks

The Chromium driver does not allow a file detector to be set, as the server component of the Chromium driver only allows uploads from the local computer environment. Attempting to set this property has no effect, but does not throw an exception. If you are attempting to run the Chromium driver remotely, use RemoteWebDriver in conjunction with a standalone WebDriver server.

HasActiveDevToolsSession

Gets a value indicating whether a DevTools session is active.

public bool HasActiveDevToolsSession { get; }

Property Value

bool

NetworkConditions

Gets or sets the network condition emulation for Chromium.

public ChromiumNetworkConditions NetworkConditions { get; set; }

Property Value

ChromiumNetworkConditions

Methods

ClearNetworkConditions()

Clears simulated network conditions.

public void ClearNetworkConditions()

CloseDevToolsSession()

Closes a DevTools session.

public void CloseDevToolsSession()

Dispose(bool)

Stops the driver from running

protected override void Dispose(bool disposing)

Parameters

disposing bool

if its in the process of disposing

ExecuteCdpCommand(string, Dictionary<string, object>)

Executes a custom Chrome Dev Tools Protocol Command.

public object ExecuteCdpCommand(string commandName, Dictionary<string, object> commandParameters)

Parameters

commandName string

Name of the command to execute.

commandParameters Dictionary<string, object>

Parameters of the command to execute.

Returns

object

An object representing the result of the command, if applicable.

GetCastIssueMessage()

Returns the error message if there is any issue in a Cast session.

public string GetCastIssueMessage()

Returns

string

An error message.

GetCastSinks()

Returns the list of cast sinks (Cast devices) available to the Chrome media router.

public List<Dictionary<string, string>> GetCastSinks()

Returns

List<Dictionary<string, string>>

The list of available sinks.

GetDevToolsSession()

Creates a session to communicate with a browser using the Chromium Developer Tools debugging protocol.

public DevToolsSession GetDevToolsSession()

Returns

DevToolsSession

The active session to use to communicate with the Chromium Developer Tools debugging protocol.

GetDevToolsSession(DevToolsOptions)

Creates a session to communicate with a browser using the Chromium Developer Tools debugging protocol.

public DevToolsSession GetDevToolsSession(DevToolsOptions options)

Parameters

options DevToolsOptions

Returns

DevToolsSession

The active session to use to communicate with the Chromium Developer Tools debugging protocol.

GetDevToolsSession(int)

Creates a session to communicate with a browser using the Chromium Developer Tools debugging protocol.

[Obsolete("Use GetDevToolsSession(DevToolsOptions options)")]
public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion)

Parameters

devToolsProtocolVersion int

The version of the Chromium Developer Tools protocol to use. Defaults to autodetect the protocol version.

Returns

DevToolsSession

The active session to use to communicate with the Chromium Developer Tools debugging protocol.

LaunchApp(string)

Launches a Chromium based application.

public void LaunchApp(string id)

Parameters

id string

ID of the chromium app to launch.

SelectCastSink(string)

Selects a cast sink (Cast device) as the recipient of media router intents (connect or play).

public void SelectCastSink(string deviceName)

Parameters

deviceName string

Name of the target sink (device).

SetPermission(string, string)

Set supported permission on browser.

public void SetPermission(string permissionName, string permissionValue)

Parameters

permissionName string

Name of item to set the permission on.

permissionValue string

Value to set the permission to.

StartDesktopMirroring(string)

Initiates mirroring of the desktop on the specified device.

public void StartDesktopMirroring(string deviceName)

Parameters

deviceName string

Name of the target sink (device).

StartTabMirroring(string)

Initiates tab mirroring for the current browser tab on the specified device.

public void StartTabMirroring(string deviceName)

Parameters

deviceName string

Name of the target sink (device).

StopCasting(string)

Stops casting from media router to the specified device, if connected.

public void StopCasting(string deviceName)

Parameters

deviceName string

Name of the target sink (device).