cdp-driver 0.3.0

Chrome DevTools Protocol client for AI agent browser control
Documentation
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.

//! The Browser domain defines methods and events for browser managing.
//!
//! Method names for the `Browser` domain, for use with
//! [`CdpClient::call`](crate::CdpClient::call).

/// Set permission settings for given embedding and embedded origins.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `permission`: PermissionDescriptor
/// - `setting`: PermissionSetting
/// - `origin`: string (optional)
/// - `embeddedOrigin`: string (optional)
/// - `browserContextId`: BrowserContextID (optional)
pub const SET_PERMISSION: &str = "Browser.setPermission";

/// Grant specific permissions to the given origin and reject all others.
/// Deprecated. Use setPermission instead.
///
/// Deprecated in the protocol.
/// Experimental: may change without notice.
///
/// Parameters:
/// - `permissions`: array
/// - `origin`: string (optional)
/// - `browserContextId`: BrowserContextID (optional)
pub const GRANT_PERMISSIONS: &str = "Browser.grantPermissions";

/// Reset all permission management for all origins.
///
/// Parameters:
/// - `browserContextId`: BrowserContextID (optional)
pub const RESET_PERMISSIONS: &str = "Browser.resetPermissions";

/// Set the behavior when downloading a file.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `behavior`: string
/// - `browserContextId`: BrowserContextID (optional)
/// - `downloadPath`: string (optional)
/// - `eventsEnabled`: boolean (optional)
pub const SET_DOWNLOAD_BEHAVIOR: &str = "Browser.setDownloadBehavior";

/// Cancel a download if in progress
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `guid`: string
/// - `browserContextId`: BrowserContextID (optional)
pub const CANCEL_DOWNLOAD: &str = "Browser.cancelDownload";

/// Close browser gracefully.
pub const CLOSE: &str = "Browser.close";

/// Crashes browser on the main thread.
///
/// Experimental: may change without notice.
pub const CRASH: &str = "Browser.crash";

/// Crashes GPU process.
///
/// Experimental: may change without notice.
pub const CRASH_GPU_PROCESS: &str = "Browser.crashGpuProcess";

/// Returns version information.
///
/// Returns: `protocolVersion`, `product`, `revision`, `userAgent`, `jsVersion`
pub const GET_VERSION: &str = "Browser.getVersion";

/// Returns the command line switches for the browser process if, and only if
/// --enable-automation is on the commandline.
///
/// Experimental: may change without notice.
///
/// Returns: `arguments`
pub const GET_BROWSER_COMMAND_LINE: &str = "Browser.getBrowserCommandLine";

/// Get Chrome histograms.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `query`: string (optional)
/// - `delta`: boolean (optional)
///
/// Returns: `histograms`
pub const GET_HISTOGRAMS: &str = "Browser.getHistograms";

/// Get a Chrome histogram by name.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `name`: string
/// - `delta`: boolean (optional)
///
/// Returns: `histogram`
pub const GET_HISTOGRAM: &str = "Browser.getHistogram";

/// Get position and size of the browser window.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `windowId`: WindowID
///
/// Returns: `bounds`
pub const GET_WINDOW_BOUNDS: &str = "Browser.getWindowBounds";

/// Get the browser window that contains the devtools target.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `targetId`: Target.TargetID (optional)
///
/// Returns: `windowId`, `bounds`
pub const GET_WINDOW_FOR_TARGET: &str = "Browser.getWindowForTarget";

/// Set position and/or size of the browser window.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `windowId`: WindowID
/// - `bounds`: Bounds
pub const SET_WINDOW_BOUNDS: &str = "Browser.setWindowBounds";

/// Set size of the browser contents resizing browser window as necessary.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `windowId`: WindowID
/// - `width`: integer (optional)
/// - `height`: integer (optional)
pub const SET_CONTENTS_SIZE: &str = "Browser.setContentsSize";

/// Set dock tile details, platform-specific.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `badgeLabel`: string (optional)
/// - `image`: string (optional)
pub const SET_DOCK_TILE: &str = "Browser.setDockTile";

/// Invoke custom browser commands used by telemetry.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `commandId`: BrowserCommandId
pub const EXECUTE_BROWSER_COMMAND: &str = "Browser.executeBrowserCommand";

/// Allows a site to use privacy sandbox features that require enrollment
/// without the site actually being enrolled. Only supported on page targets.
///
/// Parameters:
/// - `url`: string
pub const ADD_PRIVACY_SANDBOX_ENROLLMENT_OVERRIDE: &str =
    "Browser.addPrivacySandboxEnrollmentOverride";