Class BrowserAdapter
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
sessionIDevToolsSessionThe IDevToolsSession to be used with this adapter.
Exceptions
- ArgumentNullException
If
sessionis null.
Properties
Session
Gets the DevToolsSession associated with the adapter.
public IDevToolsSession Session { get; }
Property Value
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
commandAddPrivacySandboxCoordinatorKeyConfigCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandAddPrivacySandboxEnrollmentOverrideCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandCancelDownloadCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandCloseCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandCrashCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandCrashGpuProcessCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandExecuteBrowserCommandCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandGetBrowserCommandLineCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandGetHistogramCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
GetHistograms(GetHistogramsCommandSettings, CancellationToken, int?, bool)
Get Chrome histograms.
public Task<GetHistogramsCommandResponse> GetHistograms(GetHistogramsCommandSettings command, CancellationToken cancellationToken = default, int? millisecondsTimeout = null, bool throwExceptionIfResponseNotReceived = true)
Parameters
commandGetHistogramsCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandGetVersionCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandGetWindowBoundsCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandGetWindowForTargetCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandGrantPermissionsCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandResetPermissionsCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandSetContentsSizeCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandSetDockTileCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandSetDownloadBehaviorCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandSetPermissionCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
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
commandSetWindowBoundsCommandSettingscancellationTokenCancellationTokenmillisecondsTimeoutint?throwExceptionIfResponseNotReceivedbool
Returns
Events
DownloadProgress
Fired when download makes progress. Last call has |done| == true.
public event EventHandler<DownloadProgressEventArgs>? DownloadProgress
Event Type
DownloadWillBegin
Fired when page is about to start a download.
public event EventHandler<DownloadWillBeginEventArgs>? DownloadWillBegin