Class ChromiumDriver
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
ChromiumDriverServiceThe ChromiumDriverService to use.
options
ChromiumOptionsThe ChromiumOptions to be used with the ChromiumDriver.
commandTimeout
TimeSpanThe maximum amount of time to wait for each command.
Fields
AcceptUntrustedCertificates
Accept untrusted SSL Certificates
public static readonly bool AcceptUntrustedCertificates
Field Value
DeleteNetworkConditionsCommand
Command for deleting the simulated network conditions in a driver for a Chromium-based browser.
public static readonly string DeleteNetworkConditionsCommand
Field Value
ExecuteCdp
Command for executing a Chrome DevTools Protocol command in a driver for a Chromium-based browser.
public static readonly string ExecuteCdp
Field Value
GetCastIssueMessageCommand
Command for getting a cast issued message in a driver for a Chromium-based browser.
public static readonly string GetCastIssueMessageCommand
Field Value
GetCastSinksCommand
Command for getting cast sinks in a driver for a Chromium-based browser.
public static readonly string GetCastSinksCommand
Field Value
GetNetworkConditionsCommand
Command for getting the simulated network conditions in a driver for a Chromium-based browser.
public static readonly string GetNetworkConditionsCommand
Field Value
LaunchAppCommand
Command for launching an app in a driver for a Chromium-based browser.
public static readonly string LaunchAppCommand
Field Value
SelectCastSinkCommand
Command for selecting a cast sink in a driver for a Chromium-based browser.
public static readonly string SelectCastSinkCommand
Field Value
SendChromeCommand
Command for executing a Chrome DevTools Protocol command in a driver for a Chromium-based browser.
public static readonly string SendChromeCommand
Field Value
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
SetNetworkConditionsCommand
Command for setting the simulated network conditions in a driver for a Chromium-based browser.
public static readonly string SetNetworkConditionsCommand
Field Value
SetPermissionCommand
Command for setting permissions in a driver for a Chromium-based browser.
public static readonly string SetPermissionCommand
Field Value
StartCastDesktopMirroringCommand
Command for starting cast desktop mirroring in a driver for a Chromium-based browser.
public static readonly string StartCastDesktopMirroringCommand
Field Value
StartCastTabMirroringCommand
Command for starting cast tab mirroring in a driver for a Chromium-based browser.
public static readonly string StartCastTabMirroringCommand
Field Value
StopCastingCommand
Command for stopping casting in a driver for a Chromium-based browser.
public static readonly string StopCastingCommand
Field Value
Properties
ChromiumCustomCommands
Gets the dictionary of custom Chromium commands registered with the driver.
protected static IReadOnlyDictionary<string, CommandInfo> ChromiumCustomCommands { get; }
Property Value
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
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
NetworkConditions
Gets or sets the network condition emulation for Chromium.
public ChromiumNetworkConditions NetworkConditions { get; set; }
Property Value
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
boolif 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
stringName 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
intThe 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
stringID 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
stringName of the target sink (device).
SetPermission(string, string)
Set supported permission on browser.
public void SetPermission(string permissionName, string permissionValue)
Parameters
permissionName
stringName of item to set the permission on.
permissionValue
stringValue to set the permission to.
StartDesktopMirroring(string)
Initiates mirroring of the desktop on the specified device.
public void StartDesktopMirroring(string deviceName)
Parameters
deviceName
stringName 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
stringName 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
stringName of the target sink (device).