Table of Contents

Class BrowserAdapter

Namespace
OpenQA.Selenium.DevTools.V146.Browser
Assembly
Selenium.WebDriver.dll

Represents an adapter for the Browser domain to simplify the command interface.

public class BrowserAdapter
Inheritance
BrowserAdapter
Inherited Members

Constructors

BrowserAdapter(IDevToolsSession)

Initializes a new instance of the BrowserAdapter class.

public BrowserAdapter(IDevToolsSession session)

Parameters

session IDevToolsSession

The IDevToolsSession to be used with this adapter.

Exceptions

ArgumentNullException

If session is null.

Properties

Session

Gets the DevToolsSession associated with the adapter.

public IDevToolsSession Session { get; }

Property Value

IDevToolsSession

Methods

AddPrivacySandboxCoordinatorKeyConfig(AddPrivacySandboxCoordinatorKeyConfigCommandSettings, CancellationToken, int?, bool)

Configures encryption keys used with a given privacy sandbox API to talk to a trusted coordinator. Since this is intended for test automation only, coordinatorOrigin must be a .test domain. No existing coordinator configuration for the origin may exist.

public Task<AddPrivacySandboxCoordinatorKeyConfigCommandResponse?> AddPrivacySandboxCoordinatorKeyConfig(AddPrivacySandboxCoordinatorKeyConfigCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command AddPrivacySandboxCoordinatorKeyConfigCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<AddPrivacySandboxCoordinatorKeyConfigCommandResponse>

AddPrivacySandboxEnrollmentOverride(AddPrivacySandboxEnrollmentOverrideCommandSettings, CancellationToken, int?, bool)

Allows a site to use privacy sandbox features that require enrollment without the site actually being enrolled. Only supported on page targets.

public Task<AddPrivacySandboxEnrollmentOverrideCommandResponse?> AddPrivacySandboxEnrollmentOverride(AddPrivacySandboxEnrollmentOverrideCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command AddPrivacySandboxEnrollmentOverrideCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<AddPrivacySandboxEnrollmentOverrideCommandResponse>

CancelDownload(CancelDownloadCommandSettings, CancellationToken, int?, bool)

Cancel a download if in progress

public Task<CancelDownloadCommandResponse?> CancelDownload(CancelDownloadCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command CancelDownloadCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<CancelDownloadCommandResponse>

Close(CloseCommandSettings?, CancellationToken, int?, bool)

Close browser gracefully.

public Task<CloseCommandResponse?> Close(CloseCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command CloseCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<CloseCommandResponse>

Crash(CrashCommandSettings?, CancellationToken, int?, bool)

Crashes browser on the main thread.

public Task<CrashCommandResponse?> Crash(CrashCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command CrashCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<CrashCommandResponse>

CrashGpuProcess(CrashGpuProcessCommandSettings?, CancellationToken, int?, bool)

Crashes GPU process.

public Task<CrashGpuProcessCommandResponse?> CrashGpuProcess(CrashGpuProcessCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command CrashGpuProcessCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<CrashGpuProcessCommandResponse>

ExecuteBrowserCommand(ExecuteBrowserCommandCommandSettings, CancellationToken, int?, bool)

Invoke custom browser commands used by telemetry.

public Task<ExecuteBrowserCommandCommandResponse?> ExecuteBrowserCommand(ExecuteBrowserCommandCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command ExecuteBrowserCommandCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<ExecuteBrowserCommandCommandResponse>

GetBrowserCommandLine(GetBrowserCommandLineCommandSettings?, CancellationToken, int?, bool)

Returns the command line switches for the browser process if, and only if --enable-automation is on the commandline.

public Task<GetBrowserCommandLineCommandResponse> GetBrowserCommandLine(GetBrowserCommandLineCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetBrowserCommandLineCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetBrowserCommandLineCommandResponse>

GetHistogram(GetHistogramCommandSettings, CancellationToken, int?, bool)

Get a Chrome histogram by name.

public Task<GetHistogramCommandResponse> GetHistogram(GetHistogramCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetHistogramCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetHistogramCommandResponse>

GetHistograms(GetHistogramsCommandSettings, CancellationToken, int?, bool)

Get Chrome histograms.

public Task<GetHistogramsCommandResponse> GetHistograms(GetHistogramsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetHistogramsCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetHistogramsCommandResponse>

GetVersion(GetVersionCommandSettings?, CancellationToken, int?, bool)

Returns version information.

public Task<GetVersionCommandResponse> GetVersion(GetVersionCommandSettings? command = null, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetVersionCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetVersionCommandResponse>

GetWindowBounds(GetWindowBoundsCommandSettings, CancellationToken, int?, bool)

Get position and size of the browser window.

public Task<GetWindowBoundsCommandResponse> GetWindowBounds(GetWindowBoundsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetWindowBoundsCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetWindowBoundsCommandResponse>

GetWindowForTarget(GetWindowForTargetCommandSettings, CancellationToken, int?, bool)

Get the browser window that contains the devtools target.

public Task<GetWindowForTargetCommandResponse> GetWindowForTarget(GetWindowForTargetCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GetWindowForTargetCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GetWindowForTargetCommandResponse>

GrantPermissions(GrantPermissionsCommandSettings, CancellationToken, int?, bool)

Grant specific permissions to the given origin and reject all others. Deprecated. Use setPermission instead.

public Task<GrantPermissionsCommandResponse?> GrantPermissions(GrantPermissionsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command GrantPermissionsCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<GrantPermissionsCommandResponse>

ResetPermissions(ResetPermissionsCommandSettings, CancellationToken, int?, bool)

Reset all permission management for all origins.

public Task<ResetPermissionsCommandResponse?> ResetPermissions(ResetPermissionsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command ResetPermissionsCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<ResetPermissionsCommandResponse>

SetContentsSize(SetContentsSizeCommandSettings, CancellationToken, int?, bool)

Set size of the browser contents resizing browser window as necessary.

public Task<SetContentsSizeCommandResponse?> SetContentsSize(SetContentsSizeCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command SetContentsSizeCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<SetContentsSizeCommandResponse>

SetDockTile(SetDockTileCommandSettings, CancellationToken, int?, bool)

Set dock tile details, platform-specific.

public Task<SetDockTileCommandResponse?> SetDockTile(SetDockTileCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command SetDockTileCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<SetDockTileCommandResponse>

SetDownloadBehavior(SetDownloadBehaviorCommandSettings, CancellationToken, int?, bool)

Set the behavior when downloading a file.

public Task<SetDownloadBehaviorCommandResponse?> SetDownloadBehavior(SetDownloadBehaviorCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command SetDownloadBehaviorCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<SetDownloadBehaviorCommandResponse>

SetPermission(SetPermissionCommandSettings, CancellationToken, int?, bool)

Set permission settings for given embedding and embedded origins.

public Task<SetPermissionCommandResponse?> SetPermission(SetPermissionCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command SetPermissionCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<SetPermissionCommandResponse>

SetWindowBounds(SetWindowBoundsCommandSettings, CancellationToken, int?, bool)

Set position and/or size of the browser window.

public Task<SetWindowBoundsCommandResponse?> SetWindowBounds(SetWindowBoundsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)

Parameters

command SetWindowBoundsCommandSettings
cancellationToken CancellationToken
millisecondsTimeout int?
throwExceptionIfResponseNotReceived bool

Returns

Task<SetWindowBoundsCommandResponse>

Events

DownloadProgress

Fired when download makes progress. Last call has |done| == true.

public event EventHandler<DownloadProgressEventArgs>? DownloadProgress

Event Type

EventHandler<DownloadProgressEventArgs>

DownloadWillBegin

Fired when page is about to start a download.

public event EventHandler<DownloadWillBeginEventArgs>? DownloadWillBegin

Event Type

EventHandler<DownloadWillBeginEventArgs>