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.

//! Supports additional targets discovery and allows to attach to them.
//!
//! Method names for the `Target` domain, for use with
//! [`CdpClient::call`](crate::CdpClient::call).

/// Activates (focuses) the target.
///
/// Parameters:
/// - `targetId`: TargetID
pub const ACTIVATE_TARGET: &str = "Target.activateTarget";

/// Attaches to the target with given id.
///
/// Parameters:
/// - `targetId`: TargetID
/// - `flatten`: boolean (optional)
///
/// Returns: `sessionId`
pub const ATTACH_TO_TARGET: &str = "Target.attachToTarget";

/// Attaches to the browser target, only uses flat sessionId mode.
///
/// Experimental: may change without notice.
///
/// Returns: `sessionId`
pub const ATTACH_TO_BROWSER_TARGET: &str = "Target.attachToBrowserTarget";

/// Closes the target. If the target is a page that gets closed too.
///
/// Parameters:
/// - `targetId`: TargetID
///
/// Returns: `success`
pub const CLOSE_TARGET: &str = "Target.closeTarget";

/// Inject object to the target's main frame that provides a communication
/// channel with browser target. Injected object will be available as
/// `window\[bindingName\]`. The object has the following API: -
/// `binding.send(json)` - a method to send messages over the remote debugging
/// protocol - `binding.onmessage = json =\> handleMessage(json)` - a callback
/// that will be called for the protocol notifications and command responses.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `targetId`: TargetID
/// - `bindingName`: string (optional)
/// - `inheritPermissions`: boolean (optional)
pub const EXPOSE_DEV_TOOLS_PROTOCOL: &str = "Target.exposeDevToolsProtocol";

/// Creates a new empty BrowserContext. Similar to an incognito profile but
/// you can have more than one.
///
/// Parameters:
/// - `disposeOnDetach`: boolean (optional)
/// - `proxyServer`: string (optional)
/// - `proxyBypassList`: string (optional)
/// - `originsWithUniversalNetworkAccess`: array (optional)
///
/// Returns: `browserContextId`
pub const CREATE_BROWSER_CONTEXT: &str = "Target.createBrowserContext";

/// Returns all browser contexts created with `Target.createBrowserContext`
/// method.
///
/// Returns: `browserContextIds`, `defaultBrowserContextId`
pub const GET_BROWSER_CONTEXTS: &str = "Target.getBrowserContexts";

/// Creates a new page.
///
/// Parameters:
/// - `url`: string
/// - `left`: integer (optional)
/// - `top`: integer (optional)
/// - `width`: integer (optional)
/// - `height`: integer (optional)
/// - `windowState`: WindowState (optional)
/// - `browserContextId`: Browser.BrowserContextID (optional)
/// - `enableBeginFrameControl`: boolean (optional)
/// - `newWindow`: boolean (optional)
/// - `background`: boolean (optional)
/// - `forTab`: boolean (optional)
/// - `hidden`: boolean (optional)
/// - `focus`: boolean (optional)
///
/// Returns: `targetId`
pub const CREATE_TARGET: &str = "Target.createTarget";

/// Detaches session with given id.
///
/// Parameters:
/// - `sessionId`: SessionID (optional)
/// - `targetId`: TargetID (optional)
pub const DETACH_FROM_TARGET: &str = "Target.detachFromTarget";

/// Deletes a BrowserContext. All the belonging pages will be closed without
/// calling their beforeunload hooks.
///
/// Parameters:
/// - `browserContextId`: Browser.BrowserContextID
pub const DISPOSE_BROWSER_CONTEXT: &str = "Target.disposeBrowserContext";

/// Returns information about a target.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `targetId`: TargetID (optional)
///
/// Returns: `targetInfo`
pub const GET_TARGET_INFO: &str = "Target.getTargetInfo";

/// Retrieves a list of available targets.
///
/// Parameters:
/// - `filter`: TargetFilter (optional)
///
/// Returns: `targetInfos`
pub const GET_TARGETS: &str = "Target.getTargets";

/// Sends protocol message over session with given id. Consider using flat
/// mode instead; see commands attachToTarget, setAutoAttach, and
/// crbug.com/991325.
///
/// Deprecated in the protocol.
///
/// Parameters:
/// - `message`: string
/// - `sessionId`: SessionID (optional)
/// - `targetId`: TargetID (optional)
pub const SEND_MESSAGE_TO_TARGET: &str = "Target.sendMessageToTarget";

/// Controls whether to automatically attach to new targets which are
/// considered to be directly related to this one (for example, iframes or
/// workers). When turned on, attaches to all existing related targets as
/// well. When turned off, automatically detaches from all currently attached
/// targets. This also clears all targets added by `autoAttachRelated` from
/// the list of targets to watch for creation of related targets. You might
/// want to call this recursively for auto-attached targets to attach to all
/// available targets.
///
/// Parameters:
/// - `autoAttach`: boolean
/// - `waitForDebuggerOnStart`: boolean
/// - `flatten`: boolean (optional)
/// - `filter`: TargetFilter (optional)
pub const SET_AUTO_ATTACH: &str = "Target.setAutoAttach";

/// Adds the specified target to the list of targets that will be monitored
/// for any related target creation (such as child frames, child workers and
/// new versions of service worker) and reported through `attachedToTarget`.
/// The specified target is also auto-attached. This cancels the effect of any
/// previous `setAutoAttach` and is also cancelled by subsequent
/// `setAutoAttach`. Only available at the Browser target.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `targetId`: TargetID
/// - `waitForDebuggerOnStart`: boolean
/// - `filter`: TargetFilter (optional)
pub const AUTO_ATTACH_RELATED: &str = "Target.autoAttachRelated";

/// Controls whether to discover available targets and notify via
/// `targetCreated/targetInfoChanged/targetDestroyed` events.
///
/// Parameters:
/// - `discover`: boolean
/// - `filter`: TargetFilter (optional)
pub const SET_DISCOVER_TARGETS: &str = "Target.setDiscoverTargets";

/// Enables target discovery for the specified locations, when
/// `setDiscoverTargets` was set to `true`.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `locations`: array
pub const SET_REMOTE_LOCATIONS: &str = "Target.setRemoteLocations";

/// Gets the targetId of the DevTools page target opened for the given target
/// (if any).
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `targetId`: TargetID
///
/// Returns: `targetId`
pub const GET_DEV_TOOLS_TARGET: &str = "Target.getDevToolsTarget";

/// Opens a DevTools window for the target.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `targetId`: TargetID
/// - `panelId`: string (optional)
///
/// Returns: `targetId`
pub const OPEN_DEV_TOOLS: &str = "Target.openDevTools";