cdp-driver 0.5.0

Chrome DevTools Protocol (CDP) client for Rust: every command, event and type generated from the schema, with sessions, for browser automation and AI agents
Documentation
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.

//! Runtime domain exposes JavaScript runtime by means of remote evaluation
//! and mirror objects. Evaluation results are returned as mirror object that
//! expose object type, string representation and unique identifier that can
//! be used for further object reference. Original objects are maintained in
//! memory unless they are either explicitly released or are released along
//! with the other objects in their object group.
//!
//! Method names for the `Runtime` domain, for use with
//! [`CdpClient::call`](crate::CdpClient::call).

/// Add handler to promise with given promise object id.
///
/// Parameters:
/// - `promiseObjectId`: RemoteObjectId
/// - `returnByValue`: boolean (optional)
/// - `generatePreview`: boolean (optional)
///
/// Returns: `result`, `exceptionDetails`
pub const AWAIT_PROMISE: &str = "Runtime.awaitPromise";

/// Calls function with given declaration on the given object. Object group of
/// the result is inherited from the target object.
///
/// Parameters:
/// - `functionDeclaration`: string
/// - `objectId`: RemoteObjectId (optional)
/// - `arguments`: array (optional)
/// - `silent`: boolean (optional)
/// - `returnByValue`: boolean (optional)
/// - `generatePreview`: boolean (optional)
/// - `userGesture`: boolean (optional)
/// - `awaitPromise`: boolean (optional)
/// - `executionContextId`: ExecutionContextId (optional)
/// - `objectGroup`: string (optional)
/// - `throwOnSideEffect`: boolean (optional)
/// - `uniqueContextId`: string (optional)
/// - `serializationOptions`: SerializationOptions (optional)
///
/// Returns: `result`, `exceptionDetails`
pub const CALL_FUNCTION_ON: &str = "Runtime.callFunctionOn";

/// Compiles expression.
///
/// Parameters:
/// - `expression`: string
/// - `sourceURL`: string
/// - `persistScript`: boolean
/// - `executionContextId`: ExecutionContextId (optional)
///
/// Returns: `scriptId`, `exceptionDetails`
pub const COMPILE_SCRIPT: &str = "Runtime.compileScript";

/// Disables reporting of execution contexts creation.
pub const DISABLE: &str = "Runtime.disable";

/// Discards collected exceptions and console API calls.
pub const DISCARD_CONSOLE_ENTRIES: &str = "Runtime.discardConsoleEntries";

/// Enables reporting of execution contexts creation by means of
/// `executionContextCreated` event. When the reporting gets enabled the event
/// will be sent immediately for each existing execution context.
pub const ENABLE: &str = "Runtime.enable";

/// Evaluates expression on global object.
///
/// Parameters:
/// - `expression`: string
/// - `objectGroup`: string (optional)
/// - `includeCommandLineAPI`: boolean (optional)
/// - `silent`: boolean (optional)
/// - `contextId`: ExecutionContextId (optional)
/// - `returnByValue`: boolean (optional)
/// - `generatePreview`: boolean (optional)
/// - `userGesture`: boolean (optional)
/// - `awaitPromise`: boolean (optional)
/// - `throwOnSideEffect`: boolean (optional)
/// - `timeout`: TimeDelta (optional)
/// - `disableBreaks`: boolean (optional)
/// - `replMode`: boolean (optional)
/// - `allowUnsafeEvalBlockedByCSP`: boolean (optional)
/// - `uniqueContextId`: string (optional)
/// - `serializationOptions`: SerializationOptions (optional)
///
/// Returns: `result`, `exceptionDetails`
pub const EVALUATE: &str = "Runtime.evaluate";

/// Returns the isolate id.
///
/// Experimental: may change without notice.
///
/// Returns: `id`
pub const GET_ISOLATE_ID: &str = "Runtime.getIsolateId";

/// Returns the JavaScript heap usage. It is the total usage of the
/// corresponding isolate not scoped to a particular Runtime.
///
/// Experimental: may change without notice.
///
/// Returns: `usedSize`, `totalSize`, `embedderHeapUsedSize`, `backingStorageSize`
pub const GET_HEAP_USAGE: &str = "Runtime.getHeapUsage";

/// Returns properties of a given object. Object group of the result is
/// inherited from the target object.
///
/// Parameters:
/// - `objectId`: RemoteObjectId
/// - `ownProperties`: boolean (optional)
/// - `accessorPropertiesOnly`: boolean (optional)
/// - `generatePreview`: boolean (optional)
/// - `nonIndexedPropertiesOnly`: boolean (optional)
///
/// Returns: `result`, `internalProperties`, `privateProperties`, `exceptionDetails`
pub const GET_PROPERTIES: &str = "Runtime.getProperties";

/// Returns all let, const and class variables from global scope.
///
/// Parameters:
/// - `executionContextId`: ExecutionContextId (optional)
///
/// Returns: `names`
pub const GLOBAL_LEXICAL_SCOPE_NAMES: &str = "Runtime.globalLexicalScopeNames";

/// `Runtime.queryObjects`
///
/// Parameters:
/// - `prototypeObjectId`: RemoteObjectId
/// - `objectGroup`: string (optional)
///
/// Returns: `objects`
pub const QUERY_OBJECTS: &str = "Runtime.queryObjects";

/// Releases remote object with given id.
///
/// Parameters:
/// - `objectId`: RemoteObjectId
pub const RELEASE_OBJECT: &str = "Runtime.releaseObject";

/// Releases all remote objects that belong to a given group.
///
/// Parameters:
/// - `objectGroup`: string
pub const RELEASE_OBJECT_GROUP: &str = "Runtime.releaseObjectGroup";

/// Tells inspected instance to run if it was waiting for debugger to attach.
pub const RUN_IF_WAITING_FOR_DEBUGGER: &str = "Runtime.runIfWaitingForDebugger";

/// Runs script with given id in a given context.
///
/// Parameters:
/// - `scriptId`: ScriptId
/// - `executionContextId`: ExecutionContextId (optional)
/// - `objectGroup`: string (optional)
/// - `silent`: boolean (optional)
/// - `includeCommandLineAPI`: boolean (optional)
/// - `returnByValue`: boolean (optional)
/// - `generatePreview`: boolean (optional)
/// - `awaitPromise`: boolean (optional)
///
/// Returns: `result`, `exceptionDetails`
pub const RUN_SCRIPT: &str = "Runtime.runScript";

/// Enables or disables async call stacks tracking.
///
/// Parameters:
/// - `maxDepth`: integer
pub const SET_ASYNC_CALL_STACK_DEPTH: &str = "Runtime.setAsyncCallStackDepth";

/// `Runtime.setCustomObjectFormatterEnabled`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `enabled`: boolean
pub const SET_CUSTOM_OBJECT_FORMATTER_ENABLED: &str = "Runtime.setCustomObjectFormatterEnabled";

/// `Runtime.setMaxCallStackSizeToCapture`
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `size`: integer
pub const SET_MAX_CALL_STACK_SIZE_TO_CAPTURE: &str = "Runtime.setMaxCallStackSizeToCapture";

/// Terminate current or next JavaScript execution. Will cancel the
/// termination when the outer-most script execution ends.
///
/// Experimental: may change without notice.
pub const TERMINATE_EXECUTION: &str = "Runtime.terminateExecution";

/// If executionContextId is empty, adds binding with the given name on the
/// global objects of all inspected contexts, including those created later,
/// bindings survive reloads. Binding function takes exactly one argument,
/// this argument should be string, in case of any other input, function
/// throws an exception. Each binding function call produces
/// Runtime.bindingCalled notification.
///
/// Parameters:
/// - `name`: string
/// - `executionContextId`: ExecutionContextId (optional)
/// - `executionContextName`: string (optional)
pub const ADD_BINDING: &str = "Runtime.addBinding";

/// This method does not remove binding function from global object but
/// unsubscribes current runtime agent from Runtime.bindingCalled
/// notifications.
///
/// Parameters:
/// - `name`: string
pub const REMOVE_BINDING: &str = "Runtime.removeBinding";

/// This method tries to lookup and populate exception details for a
/// JavaScript Error object. Note that the stackTrace portion of the resulting
/// exceptionDetails will only be populated if the Runtime domain was enabled
/// at the time when the Error was thrown.
///
/// Experimental: may change without notice.
///
/// Parameters:
/// - `errorObjectId`: RemoteObjectId
///
/// Returns: `exceptionDetails`
pub const GET_EXCEPTION_DETAILS: &str = "Runtime.getExceptionDetails";