Chrome DevTools Protocol (original) (raw)
Methods
Runtime.addBinding#
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
If specified, the binding would only be exposed to the specified execution context. If omitted and executionContextName
is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive with executionContextName
. Deprecated in favor of executionContextName
due to an unclear use case and bugs in implementation (crbug.com/1169639). executionContextId
will be removed in the future.
ExperimentalDeprecated
executionContextName
string
If specified, the binding is exposed to the executionContext with matching name, even for contexts created after the binding is added. See also ExecutionContext.name
and worldName
parameter toPage.addScriptToEvaluateOnNewDocument
. This parameter is mutually exclusive with executionContextId
.
Runtime.awaitPromise#
Add handler to promise with given promise object id.
parameters
promiseObjectId
Identifier of the promise.
returnByValue
boolean
Whether the result is expected to be a JSON object that should be sent by value.
generatePreview
boolean
Whether preview should be generated for the result.
Return Object
result
Promise result. Will contain rejected value if promise was rejected.
exceptionDetails
Exception details if stack strace is available.
Runtime.callFunctionOn#
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
parameters
functionDeclaration
string
Declaration of the function to call.
objectId
Identifier of the object to call function on. Either objectId or executionContextId should be specified.
arguments
array[ CallArgument ]
Call arguments. All call arguments must belong to the same JavaScript world as the target object.
silent
boolean
In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException
state.
returnByValue
boolean
Whether the result is expected to be a JSON object which should be sent by value. Can be overriden by serializationOptions
.
generatePreview
boolean
Whether preview should be generated for the result.
Experimental
userGesture
boolean
Whether execution should be treated as initiated by user in the UI.
awaitPromise
boolean
Whether execution should await
for resulting value and return once awaited promise is resolved.
executionContextId
Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.
objectGroup
string
Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object.
throwOnSideEffect
boolean
Whether to throw an exception if side effect cannot be ruled out during evaluation.
Experimental
uniqueContextId
string
An alternative way to specify the execution context to call function on. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental function call in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive with executionContextId
.
Experimental
serializationOptions
Specifies the result serialization. If provided, overridesgeneratePreview
and returnByValue
.
Experimental
Return Object
result
Call result.
exceptionDetails
Exception details.
Runtime.compileScript#
Compiles expression.
parameters
expression
string
Expression to compile.
sourceURL
string
Source url to be set for the script.
persistScript
boolean
Specifies whether the compiled script should be persisted.
executionContextId
Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
Return Object
scriptId
Id of the script.
exceptionDetails
Exception details.
Runtime.disable#
Disables reporting of execution contexts creation.
Runtime.discardConsoleEntries#
Discards collected exceptions and console API calls.
Runtime.enable#
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.
Runtime.evaluate#
Evaluates expression on global object.
parameters
expression
string
Expression to evaluate.
objectGroup
string
Symbolic group name that can be used to release multiple objects.
includeCommandLineAPI
boolean
Determines whether Command Line API should be available during the evaluation.
silent
boolean
In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException
state.
contextId
Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. This is mutually exclusive with uniqueContextId
, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment.
returnByValue
boolean
Whether the result is expected to be a JSON object that should be sent by value.
generatePreview
boolean
Whether preview should be generated for the result.
Experimental
userGesture
boolean
Whether execution should be treated as initiated by user in the UI.
awaitPromise
boolean
Whether execution should await
for resulting value and return once awaited promise is resolved.
throwOnSideEffect
boolean
Whether to throw an exception if side effect cannot be ruled out during evaluation. This implies disableBreaks
below.
Experimental
timeout
Terminate execution after timing out (number of milliseconds).
Experimental
disableBreaks
boolean
Disable breakpoints during execution.
Experimental
replMode
boolean
Setting this flag to true enables let
re-declaration and top-level await
. Note that let
variables can only be re-declared if they originate fromreplMode
themselves.
Experimental
allowUnsafeEvalBlockedByCSP
boolean
The Content Security Policy (CSP) for the target might block 'unsafe-eval' which includes eval(), Function(), setTimeout() and setInterval() when called with non-callable arguments. This flag bypasses CSP for this evaluation and allows unsafe-eval. Defaults to true.
Experimental
uniqueContextId
string
An alternative way to specify the execution context to evaluate in. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental evaluation of the expression in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive with contextId
.
Experimental
serializationOptions
Specifies the result serialization. If provided, overridesgeneratePreview
and returnByValue
.
Experimental
Return Object
result
Evaluation result.
exceptionDetails
Exception details.
Runtime.getProperties#
Returns properties of a given object. Object group of the result is inherited from the target object.
parameters
objectId
Identifier of the object to return properties for.
ownProperties
boolean
If true, returns properties belonging only to the element itself, not to its prototype chain.
accessorPropertiesOnly
boolean
If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
Experimental
generatePreview
boolean
Whether preview should be generated for the results.
Experimental
nonIndexedPropertiesOnly
boolean
If true, returns non-indexed properties only.
Experimental
Return Object
result
array[ PropertyDescriptor ]
Object properties.
internalProperties
array[ InternalPropertyDescriptor ]
Internal object properties (only of the element itself).
privateProperties
array[ PrivatePropertyDescriptor ]
Object private properties.
Experimental
exceptionDetails
Exception details.
Runtime.globalLexicalScopeNames#
Returns all let, const and class variables from global scope.
parameters
executionContextId
Specifies in which execution context to lookup global scope variables.
Return Object
names
array[ string ]
Runtime.queryObjects#
parameters
prototypeObjectId
Identifier of the prototype to return objects for.
objectGroup
string
Symbolic group name that can be used to release the results.
Return Object
objects
Array with objects.
Runtime.releaseObject#
Releases remote object with given id.
parameters
objectId
Identifier of the object to release.
Runtime.releaseObjectGroup#
Releases all remote objects that belong to a given group.
parameters
objectGroup
string
Symbolic object group name.
Runtime.removeBinding#
This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.
parameters
name
string
Runtime.runIfWaitingForDebugger#
Tells inspected instance to run if it was waiting for debugger to attach.
Runtime.runScript#
Runs script with given id in a given context.
parameters
scriptId
Id of the script to run.
executionContextId
Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
objectGroup
string
Symbolic group name that can be used to release multiple objects.
silent
boolean
In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException
state.
includeCommandLineAPI
boolean
Determines whether Command Line API should be available during the evaluation.
returnByValue
boolean
Whether the result is expected to be a JSON object which should be sent by value.
generatePreview
boolean
Whether preview should be generated for the result.
awaitPromise
boolean
Whether execution should await
for resulting value and return once awaited promise is resolved.
Return Object
result
Run result.
exceptionDetails
Exception details.
Runtime.setAsyncCallStackDepth#
Enables or disables async call stacks tracking.
parameters
maxDepth
integer
Maximum depth of async call stacks. Setting to 0
will effectively disable collecting async call stacks (default).
Events
Runtime.consoleAPICalled#
Issued when console API was called.
parameters
type
string
Type of the call.
Allowed Values: log
, debug
, info
, error
, warning
, dir
, dirxml
, table
, trace
, clear
, startGroup
, startGroupCollapsed
, endGroup
, assert
, profile
, profileEnd
, count
, timeEnd
args
array[ RemoteObject ]
Call arguments.
executionContextId
Identifier of the context where the call was made.
timestamp
Call timestamp.
stackTrace
Stack trace captured when the call was made. The async stack chain is automatically reported for the following call types: assert
, error
, trace
, warning
. For other types the async call chain can be retrieved using Debugger.getStackTrace
and stackTrace.parentId
field.
context
string
Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context.
Experimental
Runtime.exceptionRevoked#
Issued when unhandled exception was revoked.
parameters
reason
string
Reason describing why exception was revoked.
exceptionId
integer
The id of revoked exception, as reported in exceptionThrown
.
Runtime.exceptionThrown#
Issued when exception was thrown and unhandled.
parameters
timestamp
Timestamp of the exception.
exceptionDetails
Runtime.executionContextCreated#
Issued when new execution context is created.
parameters
context
A newly created execution context.
Runtime.executionContextDestroyed#
Issued when execution context is destroyed.
parameters
executionContextId
Id of the destroyed context
Deprecated
executionContextUniqueId
string
Unique Id of the destroyed context
Experimental
Runtime.executionContextsCleared#
Issued when all executionContexts were cleared in browser
Runtime.inspectRequested#
Issued when object should be inspected (for example, as a result of inspect() command line API call).
parameters
object
hints
object
executionContextId
Identifier of the context where the call was made.
Experimental
Types
Runtime.CallArgument#
Represents function call argument. Either remote object id objectId
, primitive value
, unserializable primitive value or neither of (for undefined) them should be specified.
Type: object
properties
value
any
Primitive value or serializable javascript object.
unserializableValue
Primitive value which can not be JSON-stringified.
objectId
Remote object handle.
Runtime.CallFrame#
Stack entry for runtime errors and assertions.
Type: object
properties
functionName
string
JavaScript function name.
scriptId
JavaScript script id.
url
string
JavaScript script name or url.
lineNumber
integer
JavaScript script line number (0-based).
columnNumber
integer
JavaScript script column number (0-based).
Runtime.DeepSerializedValue#
Represents deep serialized value.
Type: object
properties
type
string
Allowed Values: undefined
, null
, string
, number
, boolean
, bigint
, regexp
, date
, symbol
, array
, object
, function
, map
, set
, weakmap
, weakset
, error
, proxy
, promise
, typedarray
, arraybuffer
, node
, window
, generator
value
any
objectId
string
weakLocalObjectReference
integer
Set if value reference met more then once during serialization. In such case, value is provided only to one of the serialized values. Unique per value in the scope of one CDP call.
Runtime.ExceptionDetails#
Detailed information about exception (or error) that was thrown during script compilation or execution.
Type: object
properties
exceptionId
integer
Exception id.
text
string
Exception text, which should be used together with exception object when available.
lineNumber
integer
Line number of the exception location (0-based).
columnNumber
integer
Column number of the exception location (0-based).
scriptId
Script ID of the exception location.
url
string
URL of the exception location, to be used when the script was not reported.
stackTrace
JavaScript stack trace if available.
exception
Exception object if available.
executionContextId
Identifier of the context where exception happened.
exceptionMetaData
object
Dictionary with entries of meta data that the client associated with this exception, such as information about associated network requests, etc.
Experimental
Runtime.ExecutionContextDescription#
Description of an isolated world.
Type: object
properties
id
Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed.
origin
string
Execution context origin.
name
string
Human readable name describing given context.
uniqueId
string
A system-unique execution context identifier. Unlike the id, this is unique across multiple processes, so can be reliably used to identify specific context while backend performs a cross-process navigation.
Experimental
auxData
object
Embedder-specific auxiliary data likely matching {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string}
Runtime.ExecutionContextId#
Id of an execution context.
Type: integer
Runtime.InternalPropertyDescriptor#
Object internal property descriptor. This property isn't normally visible in JavaScript code.
Type: object
properties
name
string
Conventional property name.
value
The value associated with the property.
Runtime.PropertyDescriptor#
Object property descriptor.
Type: object
properties
name
string
Property name or symbol description.
value
The value associated with the property.
writable
boolean
True if the value associated with the property may be changed (data descriptors only).
get
A function which serves as a getter for the property, or undefined
if there is no getter (accessor descriptors only).
set
A function which serves as a setter for the property, or undefined
if there is no setter (accessor descriptors only).
configurable
boolean
True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
enumerable
boolean
True if this property shows up during enumeration of the properties on the corresponding object.
wasThrown
boolean
True if the result was thrown during the evaluation.
isOwn
boolean
True if the property is owned for the object.
symbol
Property symbol object, if the property is of the symbol
type.
Runtime.RemoteObject#
Mirror object referencing original JavaScript object.
Type: object
properties
type
string
Object type.
Allowed Values: object
, function
, undefined
, string
, number
, boolean
, symbol
, bigint
subtype
string
Object subtype hint. Specified for object
type values only. NOTE: If you change anything here, make sure to also updatesubtype
in ObjectPreview
and PropertyPreview
below.
Allowed Values: array
, null
, node
, regexp
, date
, map
, set
, weakmap
, weakset
, iterator
, generator
, error
, proxy
, promise
, typedarray
, arraybuffer
, dataview
, webassemblymemory
, wasmvalue
className
string
Object class (constructor) name. Specified for object
type values only.
value
any
Remote object value in case of primitive values or JSON values (if it was requested).
unserializableValue
Primitive value which can not be JSON-stringified does not have value
, but gets this property.
description
string
String representation of the object.
deepSerializedValue
Deep serialized value.
Experimental
objectId
Unique object identifier (for non-primitive values).
preview
Preview containing abbreviated property values. Specified for object
type values only.
Experimental
customPreview
CustomPreview Experimental
Runtime.RemoteObjectId#
Unique object identifier.
Type: string
Runtime.ScriptId#
Unique script identifier.
Type: string
Runtime.SerializationOptions#
Represents options for serialization. Overrides generatePreview
and returnByValue
.
Type: object
properties
serialization
string
Allowed Values: deep
, json
, idOnly
maxDepth
integer
Deep serialization depth. Default is full depth. Respected only in deep
serialization mode.
additionalParameters
object
Embedder-specific parameters. For example if connected to V8 in Chrome these control DOM serialization via maxNodeDepth: integer
and includeShadowTree: "none" | "open" | "all"
. Values can be only of type string or integer.
Runtime.StackTrace#
Call frames for assertions or error messages.
Type: object
properties
description
string
String label of this stack trace. For async traces this may be a name of the function that initiated the async call.
callFrames
array[ CallFrame ]
JavaScript function name.
parent
Asynchronous JavaScript stack trace that preceded this stack, if available.
parentId
Asynchronous JavaScript stack trace that preceded this stack, if available.
Experimental
Runtime.TimeDelta#
Number of milliseconds.
Type: number
Runtime.Timestamp#
Number of milliseconds since epoch.
Type: number
Runtime.UnserializableValue#
Primitive value which cannot be JSON-stringified. Includes values -0
, NaN
, Infinity
,-Infinity
, and bigint literals.
Type: string