CSS
This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) have an associated id
used in subsequent operations on the related object. Each object type has a specific id
structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the get*ForNode()
calls (which accept a DOM node id). A client can also discover all the existing stylesheets with the getAllStyleSheets()
method (or keeping track of the styleSheetAdded
/styleSheetRemoved
events) and subsequently load the required stylesheet contents using the getStyleSheet[Text]()
methods.
Type
Command
- CSS.enable: Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been enabled until the result of this command is received.
- CSS.disable: Disables the CSS agent for the given page.
- CSS.getMatchedStylesForNode: Returns requested styles for a DOM node identified by nodeId.
- CSS.getInlineStylesForNode: Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by nodeId.
- CSS.getComputedStyleForNode: Returns the computed style for a DOM node identified by nodeId.
- CSS.getPlatformFontsForNode: Requests information about platform fonts which we used to render child TextNodes in the given node.
- CSS.getAllStyleSheets: Returns metainfo entries for all known stylesheets.
- CSS.getStyleSheet: Returns stylesheet data for the specified styleSheetId.
- CSS.getStyleSheetText: Returns the current textual content and the URL for a stylesheet.
- CSS.setStyleSheetText: Sets the new stylesheet text, thereby invalidating all existing CSSStyleId's and CSSRuleId's contained by this stylesheet.
- CSS.setStyleText: Updates the CSSStyleDeclaration text.
- CSS.setPropertyText: Sets the new text for a property in the respective style, at offset propertyIndex. If overwrite is true, a property at the given offset is overwritten, otherwise inserted. text entirely replaces the property name: value.
- CSS.toggleProperty: Toggles the property in the respective style, at offset propertyIndex. The disable parameter denotes whether the property should be disabled (i.e. removed from the style declaration). If disable == false, the property gets put back into its original place in the style declaration.
- CSS.setRuleSelector: Modifies the rule selector.
- CSS.addRule: Creates a new empty rule with the given selector in a special "inspector" stylesheet in the owner document of the context node.
- CSS.getSupportedCSSProperties: Returns all supported CSS property names.
- CSS.forcePseudoState: Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
- CSS.getNamedFlowCollection: Returns the Named Flows from the document.
Event
CSS.StyleSheetId Type
- String
CSS.CSSStyleId Type
This object identifies a CSS style in a unique way.
- styleSheetId
- CSS.StyleSheetId Enclosing stylesheet identifier.
- ordinal
- Integer The style ordinal within the stylesheet.
CSS.StyleSheetOrigin Type
Stylesheet type: "user" for user stylesheets, "user-agent" for user-agent stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via inspector" rules), "regular" for regular stylesheets.
- ( user | user-agent | inspector | regular )
CSS.CSSRuleId Type
This object identifies a CSS rule in a unique way.
- styleSheetId
- CSS.StyleSheetId Enclosing stylesheet identifier.
- ordinal
- Integer The rule ordinal within the stylesheet.
CSS.PseudoIdMatches Type
CSS rule collection for a single pseudo style.
- pseudoId
- Integer Pseudo style identifier (see
enum PseudoId
in RenderStyleConstants.h
).
- matches
- [CSS.RuleMatch] Matches of CSS rules applicable to the pseudo style.
CSS.InheritedStyleEntry Type
CSS rule collection for a single pseudo style.
- inlineStyle (optional)
- CSS.CSSStyle The ancestor node's inline style, if any, in the style inheritance chain.
- matchedCSSRules
- [CSS.RuleMatch] Matches of CSS rules matching the ancestor node in the style inheritance chain.
CSS.RuleMatch Type
Match data for a CSS rule.
- rule
- CSS.CSSRule CSS rule in the match.
- matchingSelectors
- [Integer] Matching selector indices in the rule's selectorList selectors (0-based).
CSS.SelectorList Type
Selector list data.
- selectors
- [String] Selectors in the list.
- text
- String Rule selector text.
- range (optional)
- CSS.SourceRange Rule selector range in the underlying resource (if available).
CSS.CSSStyleAttribute Type
CSS style information for a DOM style attribute.
- name
- String DOM attribute name (e.g. "width").
- style
- CSS.CSSStyle CSS style generated by the respective DOM attribute.
CSS.CSSStyleSheetBody Type
CSS stylesheet contents.
- styleSheetId
- CSS.StyleSheetId The stylesheet identifier.
- rules
- [CSS.CSSRule] Stylesheet resource URL.
- text (optional)
- String Stylesheet resource contents (if available).
CSS.CSSRule Type
CSS rule representation.
- ruleId (optional)
- CSS.CSSRuleId The CSS rule identifier (absent for user agent stylesheet and user-specified stylesheet rules).
- selectorList
- CSS.SelectorList Rule selector data.
- sourceURL (optional)
- String Parent stylesheet resource URL (for regular rules).
- origin
- CSS.StyleSheetOrigin Parent stylesheet's origin.
- style
- CSS.CSSStyle Associated style declaration.
- media (optional)
- [CSS.CSSMedia] Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards.
CSS.SourceRange Type
Text range within a resource. All numbers are zero-based.
- startLine
- Integer Start line of range.
- startColumn
- Integer Start column of range (inclusive).
- endLine
- Integer End line of range
- endColumn
- Integer End column of range (exclusive).
CSS.ShorthandEntry Type
- name
- String Shorthand name.
- value
- String Shorthand value.
CSS.CSSPropertyInfo Type
- name
- String Property name.
- longhands (optional)
- [String] Longhand property names.
CSS.CSSComputedStyleProperty Type
- name
- String Computed style property name.
- value
- String Computed style property value.
CSS.CSSStyle Type
CSS style representation.
- styleId (optional)
- CSS.CSSStyleId The CSS style identifier (absent for attribute styles).
- cssProperties
- [CSS.CSSProperty] CSS properties in the style.
- shorthandEntries
- [CSS.ShorthandEntry] Computed values for all shorthands found in the style.
- cssText (optional)
- String Style declaration text (if available).
- range (optional)
- CSS.SourceRange Style declaration range in the enclosing stylesheet (if available).
- width (optional)
- String The effective "width" property value from this style.
- height (optional)
- String The effective "height" property value from this style.
CSS.CSSProperty Type
CSS property declaration data.
- name
- String The property name.
- value
- String The property value.
- priority (optional)
- String The property priority (implies "" if absent).
- implicit (optional)
- Boolean Whether the property is implicit (implies
false
if absent).
- text (optional)
- String The full property text as specified in the style.
- parsedOk (optional)
- Boolean Whether the property is understood by the browser (implies
true
if absent).
- status (optional)
- ( active | inactive | disabled | style ) The property status: "active" if the property is effective in the style, "inactive" if the property is overridden by a same-named property in this style later on, "disabled" if the property is disabled by the user, "style" (implied if absent) if the property is reported by the browser rather than by the CSS source parser.
- range (optional)
- CSS.SourceRange The entire property range in the enclosing style declaration (if available).
CSS.SelectorProfileEntry Type
CSS selector profile entry.
- selector
- String CSS selector of the corresponding rule.
- url
- String URL of the resource containing the corresponding rule.
- lineNumber
- Integer Selector line number in the resource for the corresponding rule.
- time
- Number Total time this rule handling contributed to the browser running time during profiling (in milliseconds).
- hitCount
- Integer Number of times this rule was considered a candidate for matching against DOM elements.
- matchCount
- Integer Number of times this rule actually matched a DOM element.
CSS.SelectorProfile Type
- totalTime
- Number Total processing time for all selectors in the profile (in milliseconds).
- data
- [CSS.SelectorProfileEntry] CSS selector profile entries.
CSS.Region Type
This object represents a region that flows from a Named Flow.
- regionOverset
- ( overset | fit | empty ) The "overset" attribute of a Named Flow.
- nodeId
- DOM.NodeId The corresponding DOM node id.
CSS.NamedFlow Type
This object represents a Named Flow.
- documentNodeId
- DOM.NodeId The document node id.
- name
- String Named Flow identifier.
- overset
- Boolean The "overset" attribute of a Named Flow.
- content
- [DOM.NodeId] An array of nodes that flow into the Named Flow.
- regions
- [CSS.Region] An array of regions associated with the Named Flow.
CSS.enable Command
Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been enabled until the result of this command is received.
Code Example:
// WebInspector Command: CSS.enable
CSS.enable();
CSS.disable Command
Disables the CSS agent for the given page.
Code Example:
// WebInspector Command: CSS.disable
CSS.disable();
CSS.getMatchedStylesForNode Command
Returns requested styles for a DOM node identified by nodeId
.
- nodeId
- DOM.NodeId
- includePseudo (optional)
- Boolean Whether to include pseudo styles (default: true).
- includeInherited (optional)
- Boolean Whether to include inherited styles (default: true).
Callback Parameters:
- matchedCSSRules (optional)
- [CSS.RuleMatch] CSS rules matching this node, from all applicable stylesheets.
- pseudoElements (optional)
- [CSS.PseudoIdMatches] Pseudo style matches for this node.
- inherited (optional)
- [CSS.InheritedStyleEntry] A chain of inherited styles (from the immediate node parent up to the DOM tree root).
Code Example:
// WebInspector Command: CSS.getMatchedStylesForNode
CSS.getMatchedStylesForNode(nodeId, includePseudo, includeInherited, function callback(res) {
// res = {matchedCSSRules, pseudoElements, inherited}
});
CSS.getInlineStylesForNode Command
Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by nodeId
.
- nodeId
- DOM.NodeId
Callback Parameters:
- inlineStyle (optional)
- CSS.CSSStyle Inline style for the specified DOM node.
- attributesStyle (optional)
- CSS.CSSStyle Attribute-defined element style (e.g. resulting from "width=20 height=100%").
Code Example:
// WebInspector Command: CSS.getInlineStylesForNode
CSS.getInlineStylesForNode(nodeId, function callback(res) {
// res = {inlineStyle, attributesStyle}
});
CSS.getComputedStyleForNode Command
Returns the computed style for a DOM node identified by nodeId
.
- nodeId
- DOM.NodeId
Callback Parameters:
- computedStyle
- [CSS.CSSComputedStyleProperty] Computed style for the specified DOM node.
Code Example:
// WebInspector Command: CSS.getComputedStyleForNode
CSS.getComputedStyleForNode(nodeId, function callback(res) {
// res = {computedStyle}
});
CSS.getAllStyleSheets Command
Returns metainfo entries for all known stylesheets.
Callback Parameters:
- headers
- [CSS.CSSStyleSheetHeader] Descriptor entries for all available stylesheets.
Code Example:
// WebInspector Command: CSS.getAllStyleSheets
CSS.getAllStyleSheets(function callback(res) {
// res = {headers}
});
CSS.getStyleSheet Command
Returns stylesheet data for the specified styleSheetId
.
- styleSheetId
- CSS.StyleSheetId
Callback Parameters:
- styleSheet
- CSS.CSSStyleSheetBody Stylesheet contents for the specified
styleSheetId
.
Code Example:
// WebInspector Command: CSS.getStyleSheet
CSS.getStyleSheet(styleSheetId, function callback(res) {
// res = {styleSheet}
});
CSS.getStyleSheetText Command
Returns the current textual content and the URL for a stylesheet.
- styleSheetId
- CSS.StyleSheetId
Callback Parameters:
- text
- String The stylesheet text.
Code Example:
// WebInspector Command: CSS.getStyleSheetText
CSS.getStyleSheetText(styleSheetId, function callback(res) {
// res = {text}
});
CSS.setStyleSheetText Command
Sets the new stylesheet text, thereby invalidating all existing CSSStyleId
's and CSSRuleId
's contained by this stylesheet.
- styleSheetId
- CSS.StyleSheetId
- text
- String
Code Example:
// WebInspector Command: CSS.setStyleSheetText
CSS.setStyleSheetText(styleSheetId, text);
CSS.setStyleText Command
Updates the CSSStyleDeclaration text.
- styleId
- CSS.CSSStyleId
- text
- String
Callback Parameters:
- style
- CSS.CSSStyle The resulting style after the text modification.
Code Example:
// WebInspector Command: CSS.setStyleText
CSS.setStyleText(styleId, text, function callback(res) {
// res = {style}
});
CSS.setPropertyText Command
Sets the new text
for a property in the respective style, at offset propertyIndex
. If overwrite
is true
, a property at the given offset is overwritten, otherwise inserted. text
entirely replaces the property name: value
.
- styleId
- CSS.CSSStyleId
- propertyIndex
- Integer
- text
- String
- overwrite
- Boolean
Callback Parameters:
- style
- CSS.CSSStyle The resulting style after the property text modification.
Code Example:
// WebInspector Command: CSS.setPropertyText
CSS.setPropertyText(styleId, propertyIndex, text, overwrite, function callback(res) {
// res = {style}
});
CSS.toggleProperty Command
Toggles the property in the respective style, at offset propertyIndex
. The disable
parameter denotes whether the property should be disabled (i.e. removed from the style declaration). If disable == false
, the property gets put back into its original place in the style declaration.
- styleId
- CSS.CSSStyleId
- propertyIndex
- Integer
- disable
- Boolean
Callback Parameters:
- style
- CSS.CSSStyle The resulting style after the property toggling.
Code Example:
// WebInspector Command: CSS.toggleProperty
CSS.toggleProperty(styleId, propertyIndex, disable, function callback(res) {
// res = {style}
});
CSS.setRuleSelector Command
Modifies the rule selector.
- ruleId
- CSS.CSSRuleId
- selector
- String
Callback Parameters:
- rule
- CSS.CSSRule The resulting rule after the selector modification.
Code Example:
// WebInspector Command: CSS.setRuleSelector
CSS.setRuleSelector(ruleId, selector, function callback(res) {
// res = {rule}
});
CSS.addRule Command
Creates a new empty rule with the given selector
in a special "inspector" stylesheet in the owner document of the context node.
- contextNodeId
- DOM.NodeId
- selector
- String
Callback Parameters:
- rule
- CSS.CSSRule The newly created rule.
Code Example:
// WebInspector Command: CSS.addRule
CSS.addRule(contextNodeId, selector, function callback(res) {
// res = {rule}
});
CSS.getSupportedCSSProperties Command
Returns all supported CSS property names.
Callback Parameters:
- cssProperties
- [CSS.CSSPropertyInfo] Supported property metainfo.
Code Example:
// WebInspector Command: CSS.getSupportedCSSProperties
CSS.getSupportedCSSProperties(function callback(res) {
// res = {cssProperties}
});
CSS.forcePseudoState Command
Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
- nodeId
- DOM.NodeId The element id for which to force the pseudo state.
- forcedPseudoClasses
- [( active | focus | hover | visited )] Element pseudo classes to force when computing the element's style.
Code Example:
// WebInspector Command: CSS.forcePseudoState
CSS.forcePseudoState(nodeId, forcedPseudoClasses);
CSS.getNamedFlowCollection Command
Returns the Named Flows from the document.
- documentNodeId
- DOM.NodeId The document node id for which to get the Named Flow Collection.
Callback Parameters:
- namedFlows
- [CSS.NamedFlow] An array containing the Named Flows in the document.
Code Example:
// WebInspector Command: CSS.getNamedFlowCollection
CSS.getNamedFlowCollection(documentNodeId, function callback(res) {
// res = {namedFlows}
});
CSS.styleSheetChanged Event
Fired whenever a stylesheet is changed as a result of the client operation.
- styleSheetId
- CSS.StyleSheetId
Code Example:
// WebInspector Event: CSS.styleSheetChanged
function onStyleSheetChanged(res) {
// res = {styleSheetId}
}
CSS.styleSheetAdded Event
Fired whenever an active document stylesheet is added.
- header
- CSS.CSSStyleSheetHeader Added stylesheet metainfo.
Code Example:
// WebInspector Event: CSS.styleSheetAdded
function onStyleSheetAdded(res) {
// res = {header}
}
CSS.styleSheetRemoved Event
Fired whenever an active document stylesheet is removed.
- styleSheetId
- CSS.StyleSheetId Identifier of the removed stylesheet.
Code Example:
// WebInspector Event: CSS.styleSheetRemoved
function onStyleSheetRemoved(res) {
// res = {styleSheetId}
}
CSS.namedFlowCreated Event
Fires when a Named Flow is created.
- namedFlow
- CSS.NamedFlow The new Named Flow.
Code Example:
// WebInspector Event: CSS.namedFlowCreated
function onNamedFlowCreated(res) {
// res = {namedFlow}
}
CSS.namedFlowRemoved Event
Fires when a Named Flow is removed: has no associated content nodes and regions.
- documentNodeId
- DOM.NodeId The document node id.
- flowName
- String Identifier of the removed Named Flow.
Code Example:
// WebInspector Event: CSS.namedFlowRemoved
function onNamedFlowRemoved(res) {
// res = {documentNodeId, flowName}
}
CSS.regionLayoutUpdated Event
Fires when a Named Flow's layout may have changed.
- namedFlow
- CSS.NamedFlow The Named Flow whose layout may have changed.
Code Example:
// WebInspector Event: CSS.regionLayoutUpdated
function onRegionLayoutUpdated(res) {
// res = {namedFlow}
}
CSS.regionOversetChanged Event
Fires if any of the regionOverset values changed in a Named Flow's region chain.
- namedFlow
- CSS.NamedFlow The Named Flow containing the regions whose regionOverset values changed.
Code Example:
// WebInspector Event: CSS.regionOversetChanged
function onRegionOversetChanged(res) {
// res = {namedFlow}
}
Canvas
Type
Command
Event
- Canvas.contextCreated: Fired when a canvas context has been created in the given frame. The context may not be instrumented (see hasUninstrumentedCanvases command).
- Canvas.traceLogsRemoved: Fired when a set of trace logs were removed from the backend. If no parameters are given, all trace logs were removed.
Canvas.ResourceId Type
Unique resource identifier.
- String
Canvas.ResourceStateDescriptor Type
Resource state descriptor.
- name
- String State name.
- enumValueForName (optional)
- String String representation of the enum value, if
name
stands for an enum.
- value (optional)
- Canvas.CallArgument The value associated with the particular state.
- values (optional)
- [Canvas.ResourceStateDescriptor] Array of values associated with the particular state. Either
value
or values
will be specified.
- isArray (optional)
- Boolean True iff the given
values
items stand for an array rather than a list of grouped states.
Canvas.CallArgument Type
- description
- String String representation of the object.
- enumName (optional)
- String Enum name, if any, that stands for the value (for example, a WebGL enum name).
- resourceId (optional)
- Canvas.ResourceId Resource identifier. Specified for
Resource
objects only.
- type (optional)
- ( object | function | undefined | string | number | boolean ) Object type. Specified for non
Resource
objects only.
- subtype (optional)
- ( array | null | node | regexp | date ) Object subtype hint. Specified for
object
type values only.
- remoteObject (optional)
- Runtime.RemoteObject The
RemoteObject
, if requested.
Canvas.Call Type
- contextId
- Canvas.ResourceId
- functionName (optional)
- String
- arguments (optional)
- [Canvas.CallArgument]
- result (optional)
- Canvas.CallArgument
- isDrawingCall (optional)
- Boolean
- isFrameEndCall (optional)
- Boolean
- property (optional)
- String
- value (optional)
- Canvas.CallArgument
- sourceURL (optional)
- String
- lineNumber (optional)
- Integer
- columnNumber (optional)
- Integer
Canvas.TraceLogId Type
Unique trace log identifier.
- String
Canvas.enable Command
Enables Canvas inspection.
Code Example:
// WebInspector Command: Canvas.enable
Canvas.enable();
Canvas.disable Command
Disables Canvas inspection.
Code Example:
// WebInspector Command: Canvas.disable
Canvas.disable();
Canvas.dropTraceLog Command
- traceLogId
- Canvas.TraceLogId
Code Example:
// WebInspector Command: Canvas.dropTraceLog
Canvas.dropTraceLog(traceLogId);
Canvas.hasUninstrumentedCanvases Command
Checks if there is any uninstrumented canvas in the inspected page.
Callback Parameters:
- result
- Boolean
Code Example:
// WebInspector Command: Canvas.hasUninstrumentedCanvases
Canvas.hasUninstrumentedCanvases(function callback(res) {
// res = {result}
});
Canvas.captureFrame Command
Starts (or continues) a canvas frame capturing which will be stopped automatically after the next frame is prepared.
- frameId (optional)
- Page.FrameId Identifier of the frame containing document whose canvases are to be captured. If omitted, main frame is assumed.
Callback Parameters:
- traceLogId
- Canvas.TraceLogId Identifier of the trace log containing captured canvas calls.
Code Example:
// WebInspector Command: Canvas.captureFrame
Canvas.captureFrame(frameId, function callback(res) {
// res = {traceLogId}
});
Canvas.startCapturing Command
Starts (or continues) consecutive canvas frames capturing. The capturing is stopped by the corresponding stopCapturing command.
- frameId (optional)
- Page.FrameId Identifier of the frame containing document whose canvases are to be captured. If omitted, main frame is assumed.
Callback Parameters:
- traceLogId
- Canvas.TraceLogId Identifier of the trace log containing captured canvas calls.
Code Example:
// WebInspector Command: Canvas.startCapturing
Canvas.startCapturing(frameId, function callback(res) {
// res = {traceLogId}
});
Canvas.stopCapturing Command
- traceLogId
- Canvas.TraceLogId
Code Example:
// WebInspector Command: Canvas.stopCapturing
Canvas.stopCapturing(traceLogId);
Canvas.getTraceLog Command
- traceLogId
- Canvas.TraceLogId
- startOffset (optional)
- Integer
- maxLength (optional)
- Integer
Callback Parameters:
- traceLog
- Canvas.TraceLog
Code Example:
// WebInspector Command: Canvas.getTraceLog
Canvas.getTraceLog(traceLogId, startOffset, maxLength, function callback(res) {
// res = {traceLog}
});
Canvas.replayTraceLog Command
- traceLogId
- Canvas.TraceLogId
- stepNo
- Integer Last call index in the trace log to replay (zero based).
Callback Parameters:
- resourceState
- Canvas.ResourceState
- replayTime
- Number Replay time (in milliseconds).
Code Example:
// WebInspector Command: Canvas.replayTraceLog
Canvas.replayTraceLog(traceLogId, stepNo, function callback(res) {
// res = {resourceState, replayTime}
});
Canvas.getResourceState Command
- traceLogId
- Canvas.TraceLogId
- resourceId
- Canvas.ResourceId
Callback Parameters:
- resourceState
- Canvas.ResourceState
Code Example:
// WebInspector Command: Canvas.getResourceState
Canvas.getResourceState(traceLogId, resourceId, function callback(res) {
// res = {resourceState}
});
Canvas.evaluateTraceLogCallArgument Command
Evaluates a given trace call argument or its result.
- traceLogId
- Canvas.TraceLogId
- callIndex
- Integer Index of the call to evaluate on (zero based).
- argumentIndex
- Integer Index of the argument to evaluate (zero based). Provide
-1
to evaluate call result.
- objectGroup (optional)
- String String object group name to put result into (allows rapid releasing resulting object handles using
Runtime.releaseObjectGroup
).
Callback Parameters:
- result (optional)
- Runtime.RemoteObject Object wrapper for the evaluation result.
- resourceState (optional)
- Canvas.ResourceState State of the
Resource
object.
Code Example:
// WebInspector Command: Canvas.evaluateTraceLogCallArgument
Canvas.evaluateTraceLogCallArgument(traceLogId, callIndex, argumentIndex, objectGroup, function callback(res) {
// res = {result, resourceState}
});
Canvas.contextCreated Event
Fired when a canvas context has been created in the given frame. The context may not be instrumented (see hasUninstrumentedCanvases command).
- frameId
- Page.FrameId Identifier of the frame containing a canvas with a context.
Code Example:
// WebInspector Event: Canvas.contextCreated
function onContextCreated(res) {
// res = {frameId}
}
Canvas.traceLogsRemoved Event
Fired when a set of trace logs were removed from the backend. If no parameters are given, all trace logs were removed.
- frameId (optional)
- Page.FrameId If given, trace logs from the given frame were removed.
- traceLogId (optional)
- Canvas.TraceLogId If given, trace log with the given ID was removed.
Code Example:
// WebInspector Event: Canvas.traceLogsRemoved
function onTraceLogsRemoved(res) {
// res = {frameId, traceLogId}
}
Console
Console domain defines methods and events for interaction with the JavaScript console. Console collects messages created by means of the JavaScript Console API. One needs to enable this domain using enable
command in order to start receiving the console messages. Browser collects messages issued while console domain is not enabled as well and reports them using messageAdded
notification upon enabling.
Type
Command
Event
Console.Timestamp Type
Number of seconds since epoch.
- Number
Console.ConsoleMessage Type
Console message.
- source
- ( xml | javascript | network | console-api | storage | appcache | rendering | css | security | other | deprecation ) Message source.
- level
- ( log | warning | error | debug ) Message severity.
- text
- String Message text.
- type (optional)
- ( log | dir | dirxml | table | trace | clear | startGroup | startGroupCollapsed | endGroup | assert | profile | profileEnd ) Console message type.
- url (optional)
- String URL of the message origin.
- line (optional)
- Integer Line number in the resource that generated this message.
- column (optional)
- Integer Column number in the resource that generated this message.
- repeatCount (optional)
- Integer Repeat count for repeated messages.
- parameters (optional)
- [Runtime.RemoteObject] Message parameters in case of the formatted message.
- stackTrace (optional)
- Console.StackTrace JavaScript stack trace for assertions and error messages.
- networkRequestId (optional)
- Network.RequestId Identifier of the network request associated with this message.
- timestamp
- Console.Timestamp Timestamp, when this message was fired.
Console.CallFrame Type
Stack entry for console errors and assertions.
- functionName
- String JavaScript function name.
- scriptId
- String JavaScript script id.
- url
- String JavaScript script name or url.
- lineNumber
- Integer JavaScript script line number.
- columnNumber
- Integer JavaScript script column number.
Console.StackTrace Type
Call frames for assertions or error messages.
- [Console.CallFrame]
Console.enable Command
Enables console domain, sends the messages collected so far to the client by means of the messageAdded
notification.
Code Example:
// WebInspector Command: Console.enable
Console.enable();
Console.disable Command
Disables console domain, prevents further console messages from being reported to the client.
Code Example:
// WebInspector Command: Console.disable
Console.disable();
Console.clearMessages Command
Clears console messages collected in the browser.
Code Example:
// WebInspector Command: Console.clearMessages
Console.clearMessages();
Console.setMonitoringXHREnabled Command
Toggles monitoring of XMLHttpRequest. If true
, console will receive messages upon each XHR issued.
- enabled
- Boolean Monitoring enabled state.
Code Example:
// WebInspector Command: Console.setMonitoringXHREnabled
Console.setMonitoringXHREnabled(enabled);
Console.addInspectedNode Command
Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
- nodeId
- DOM.NodeId DOM node id to be accessible by means of $x command line API.
Code Example:
// WebInspector Command: Console.addInspectedNode
Console.addInspectedNode(nodeId);
Console.addInspectedHeapObject Command
- heapObjectId
- Integer
Code Example:
// WebInspector Command: Console.addInspectedHeapObject
Console.addInspectedHeapObject(heapObjectId);
Console.messageAdded Event
Issued when new console message is added.
- message
- Console.ConsoleMessage Console message that has been added.
Code Example:
// WebInspector Event: Console.messageAdded
function onMessageAdded(res) {
// res = {message}
}
Console.messageRepeatCountUpdated Event
Issued when subsequent message(s) are equal to the previous one(s).
- count
- Integer New repeat count value.
- timestamp
- Console.Timestamp Timestamp of most recent message in batch.
Code Example:
// WebInspector Event: Console.messageRepeatCountUpdated
function onMessageRepeatCountUpdated(res) {
// res = {count, timestamp}
}
Console.messagesCleared Event
Issued when console is cleared. This happens either upon clearMessages
command or after page navigation.
Code Example:
// WebInspector Event: Console.messagesCleared
function onMessagesCleared(res) {
// res = {}
}
DOM
This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an id
. This id
can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client.
Note that iframe
owner elements will return corresponding document elements as their child nodes.
Type
- DOM.NodeId: Unique DOM node identifier.
- DOM.BackendNodeId: Unique DOM node identifier used to reference a node that may not have been pushed to the front-end.
- DOM.PseudoType: Pseudo element type.
- DOM.Node: DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.
- DOM.EventListener: DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.
- DOM.RGBA: A structure holding an RGBA color.
- DOM.Quad: An array of quad vertices, x immediately followed by y for each point, points clock-wise.
- DOM.BoxModel: Box model.
- DOM.Rect: Rectangle.
- DOM.HighlightConfig: Configuration data for the highlighting of page elements.
Command
- DOM.enable: Enables DOM agent for the given page.
- DOM.disable: Disables DOM agent for the given page.
- DOM.getDocument: Returns the root DOM node to the caller.
- DOM.requestChildNodes: Requests that children of the node with given id are returned to the caller in form of setChildNodes events where not only immediate children are retrieved, but all children down to the specified depth.
- DOM.querySelector: Executes querySelector on a given node.
- DOM.querySelectorAll: Executes querySelectorAll on a given node.
- DOM.setNodeName: Sets node name for a node with given id.
- DOM.setNodeValue: Sets node value for a node with given id.
- DOM.removeNode: Removes node with given id.
- DOM.setAttributeValue: Sets attribute for an element with given id.
- DOM.setAttributesAsText: Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs.
- DOM.removeAttribute: Removes attribute with given name from an element with given id.
- DOM.getEventListenersForNode: Returns event listeners relevant to the node.
- DOM.getOuterHTML: Returns node's HTML markup.
- DOM.setOuterHTML: Sets node HTML markup, returns new node id.
- DOM.performSearch: Searches for a given string in the DOM tree. Use getSearchResults to access search results or cancelSearch to end this search session.
- DOM.getSearchResults: Returns search results from given fromIndex to given toIndex from the sarch with the given identifier.
- DOM.discardSearchResults: Discards search results from the session with the given id. getSearchResults should no longer be called for that search.
- DOM.requestNode: Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series of setChildNodes notifications.
- DOM.setInspectModeEnabled: Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. Backend then generates 'inspectNodeRequested' event upon element selection.
- DOM.highlightRect: Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.
- DOM.highlightQuad: Highlights given quad. Coordinates are absolute with respect to the main frame viewport.
- DOM.highlightNode: Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified.
- DOM.hideHighlight: Hides DOM node highlight.
- DOM.highlightFrame: Highlights owner element of the frame with given id.
- DOM.pushNodeByPathToFrontend: Requests that the node is sent to the caller given its path. // FIXME, use XPath
- DOM.pushNodeByBackendIdToFrontend: Requests that the node is sent to the caller given its backend node id.
- DOM.releaseBackendNodeIds: Requests that group of BackendNodeIds is released.
- DOM.resolveNode: Resolves JavaScript node object for given node id.
- DOM.getAttributes: Returns attributes for the specified node.
- DOM.moveTo: Moves node into the new container, places it before the given anchor.
- DOM.undo: Undoes the last performed action.
- DOM.redo: Re-does the last undone action.
- DOM.markUndoableState: Marks last undoable state.
- DOM.focus: Focuses the given element.
- DOM.setFileInputFiles: Sets files for the given file input element.
- DOM.getBoxModel: Returns boxes for the currently selected nodes.
- DOM.getNodeForLocation: Returns node id at given location.
Event
DOM.NodeId Type
Unique DOM node identifier.
- Integer
DOM.BackendNodeId Type
Unique DOM node identifier used to reference a node that may not have been pushed to the front-end.
- Integer
DOM.PseudoType Type
Pseudo element type.
- ( before | after )
DOM.Node Type
DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.
- nodeId
- DOM.NodeId Node identifier that is passed into the rest of the DOM messages as the
nodeId
. Backend will only push node with given id
once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client.
- nodeType
- Integer
Node
's nodeType.
- nodeName
- String
Node
's nodeName.
- localName
- String
Node
's localName.
- nodeValue
- String
Node
's nodeValue.
- childNodeCount (optional)
- Integer Child count for
Container
nodes.
- children (optional)
- [DOM.Node] Child nodes of this node when requested with children.
- attributes (optional)
- [String] Attributes of the
Element
node in the form of flat array [name1, value1, name2, value2]
.
- documentURL (optional)
- String Document URL that
Document
or FrameOwner
node points to.
- baseURL (optional)
- String Base URL that
Document
or FrameOwner
node uses for URL completion.
- publicId (optional)
- String
DocumentType
's publicId.
- systemId (optional)
- String
DocumentType
's systemId.
- internalSubset (optional)
- String
DocumentType
's internalSubset.
- xmlVersion (optional)
- String
Document
's XML version in case of XML documents.
- name (optional)
- String
Attr
's name.
- value (optional)
- String
Attr
's value.
- pseudoType (optional)
- DOM.PseudoType Pseudo element type for this node.
- frameId (optional)
- Page.FrameId Frame ID for frame owner elements.
- contentDocument (optional)
- DOM.Node Content document for frame owner elements.
- shadowRoots (optional)
- [DOM.Node] Shadow root list for given element host.
- templateContent (optional)
- DOM.Node Content document fragment for template elements.
- pseudoElements (optional)
- [DOM.Node] Pseudo elements associated with this node.
DOM.EventListener Type
DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type.
- type
- String
EventListener
's type.
- useCapture
- Boolean
EventListener
's useCapture.
- isAttribute
- Boolean
EventListener
's isAttribute.
- nodeId
- DOM.NodeId Target
DOMNode
id.
- handlerBody
- String Event handler function body.
- location (optional)
- Debugger.Location Handler code location.
- sourceName (optional)
- String Source script URL.
- handler (optional)
- Runtime.RemoteObject Event handler function value.
DOM.RGBA Type
A structure holding an RGBA color.
- r
- Integer The red component, in the [0-255] range.
- g
- Integer The green component, in the [0-255] range.
- b
- Integer The blue component, in the [0-255] range.
- a (optional)
- Number The alpha component, in the [0-1] range (default: 1).
DOM.Quad Type
An array of quad vertices, x immediately followed by y for each point, points clock-wise.
- [Number]
DOM.BoxModel Type
Box model.
- content
- DOM.Quad Content box
- padding
- DOM.Quad Padding box
- border
- DOM.Quad Border box
- margin
- DOM.Quad Margin box
- width
- Integer Node width
- height
- Integer Node height
DOM.Rect Type
Rectangle.
- x
- Number X coordinate
- y
- Number Y coordinate
- width
- Number Rectangle width
- height
- Number Rectangle height
DOM.HighlightConfig Type
Configuration data for the highlighting of page elements.
- showInfo (optional)
- Boolean Whether the node info tooltip should be shown (default: false).
- contentColor (optional)
- DOM.RGBA The content box highlight fill color (default: transparent).
- paddingColor (optional)
- DOM.RGBA The padding highlight fill color (default: transparent).
- borderColor (optional)
- DOM.RGBA The border highlight fill color (default: transparent).
- marginColor (optional)
- DOM.RGBA The margin highlight fill color (default: transparent).
- eventTargetColor (optional)
- DOM.RGBA The event target element highlight fill color (default: transparent).
DOM.enable Command
Enables DOM agent for the given page.
Code Example:
// WebInspector Command: DOM.enable
DOM.enable();
DOM.disable Command
Disables DOM agent for the given page.
Code Example:
// WebInspector Command: DOM.disable
DOM.disable();
DOM.getDocument Command
Returns the root DOM node to the caller.
Callback Parameters:
- root
- DOM.Node Resulting node.
Code Example:
// WebInspector Command: DOM.getDocument
DOM.getDocument(function callback(res) {
// res = {root}
});
DOM.requestChildNodes Command
Requests that children of the node with given id are returned to the caller in form of setChildNodes
events where not only immediate children are retrieved, but all children down to the specified depth.
- nodeId
- DOM.NodeId Id of the node to get children for.
- depth (optional)
- Integer The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
Code Example:
// WebInspector Command: DOM.requestChildNodes
DOM.requestChildNodes(nodeId, depth);
DOM.querySelector Command
Executes querySelector
on a given node.
- nodeId
- DOM.NodeId Id of the node to query upon.
- selector
- String Selector string.
Callback Parameters:
- nodeId
- DOM.NodeId Query selector result.
Code Example:
// WebInspector Command: DOM.querySelector
DOM.querySelector(nodeId, selector, function callback(res) {
// res = {nodeId}
});
DOM.querySelectorAll Command
Executes querySelectorAll
on a given node.
- nodeId
- DOM.NodeId Id of the node to query upon.
- selector
- String Selector string.
Callback Parameters:
- nodeIds
- [DOM.NodeId] Query selector result.
Code Example:
// WebInspector Command: DOM.querySelectorAll
DOM.querySelectorAll(nodeId, selector, function callback(res) {
// res = {nodeIds}
});
DOM.setNodeName Command
Sets node name for a node with given id.
- nodeId
- DOM.NodeId Id of the node to set name for.
- name
- String New node's name.
Callback Parameters:
- nodeId
- DOM.NodeId New node's id.
Code Example:
// WebInspector Command: DOM.setNodeName
DOM.setNodeName(nodeId, name, function callback(res) {
// res = {nodeId}
});
DOM.setNodeValue Command
Sets node value for a node with given id.
- nodeId
- DOM.NodeId Id of the node to set value for.
- value
- String New node's value.
Code Example:
// WebInspector Command: DOM.setNodeValue
DOM.setNodeValue(nodeId, value);
DOM.removeNode Command
Removes node with given id.
- nodeId
- DOM.NodeId Id of the node to remove.
Code Example:
// WebInspector Command: DOM.removeNode
DOM.removeNode(nodeId);
DOM.setAttributeValue Command
Sets attribute for an element with given id.
- nodeId
- DOM.NodeId Id of the element to set attribute for.
- name
- String Attribute name.
- value
- String Attribute value.
Code Example:
// WebInspector Command: DOM.setAttributeValue
DOM.setAttributeValue(nodeId, name, value);
DOM.setAttributesAsText Command
Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs.
- nodeId
- DOM.NodeId Id of the element to set attributes for.
- text
- String Text with a number of attributes. Will parse this text using HTML parser.
- name (optional)
- String Attribute name to replace with new attributes derived from text in case text parsed successfully.
Code Example:
// WebInspector Command: DOM.setAttributesAsText
DOM.setAttributesAsText(nodeId, text, name);
DOM.removeAttribute Command
Removes attribute with given name from an element with given id.
- nodeId
- DOM.NodeId Id of the element to remove attribute from.
- name
- String Name of the attribute to remove.
Code Example:
// WebInspector Command: DOM.removeAttribute
DOM.removeAttribute(nodeId, name);
DOM.getEventListenersForNode Command
Returns event listeners relevant to the node.
- nodeId
- DOM.NodeId Id of the node to get listeners for.
- objectGroup (optional)
- String Symbolic group name for handler value. Handler value is not returned without this parameter specified.
Callback Parameters:
- listeners
- [DOM.EventListener] Array of relevant listeners.
Code Example:
// WebInspector Command: DOM.getEventListenersForNode
DOM.getEventListenersForNode(nodeId, objectGroup, function callback(res) {
// res = {listeners}
});
DOM.getOuterHTML Command
Returns node's HTML markup.
- nodeId
- DOM.NodeId Id of the node to get markup for.
Callback Parameters:
- outerHTML
- String Outer HTML markup.
Code Example:
// WebInspector Command: DOM.getOuterHTML
DOM.getOuterHTML(nodeId, function callback(res) {
// res = {outerHTML}
});
DOM.setOuterHTML Command
Sets node HTML markup, returns new node id.
- nodeId
- DOM.NodeId Id of the node to set markup for.
- outerHTML
- String Outer HTML markup to set.
Code Example:
// WebInspector Command: DOM.setOuterHTML
DOM.setOuterHTML(nodeId, outerHTML);
DOM.getSearchResults Command
Returns search results from given fromIndex
to given toIndex
from the sarch with the given identifier.
- searchId
- String Unique search session identifier.
- fromIndex
- Integer Start index of the search result to be returned.
- toIndex
- Integer End index of the search result to be returned.
Callback Parameters:
- nodeIds
- [DOM.NodeId] Ids of the search result nodes.
Code Example:
// WebInspector Command: DOM.getSearchResults
DOM.getSearchResults(searchId, fromIndex, toIndex, function callback(res) {
// res = {nodeIds}
});
DOM.discardSearchResults Command
Discards search results from the session with the given id. getSearchResults
should no longer be called for that search.
- searchId
- String Unique search session identifier.
Code Example:
// WebInspector Command: DOM.discardSearchResults
DOM.discardSearchResults(searchId);
DOM.requestNode Command
Requests that the node is sent to the caller given the JavaScript node object reference. All nodes that form the path from the node to the root are also sent to the client as a series of setChildNodes
notifications.
- objectId
- Runtime.RemoteObjectId JavaScript object id to convert into node.
Callback Parameters:
- nodeId
- DOM.NodeId Node id for given object.
Code Example:
// WebInspector Command: DOM.requestNode
DOM.requestNode(objectId, function callback(res) {
// res = {nodeId}
});
DOM.setInspectModeEnabled Command
Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. Backend then generates 'inspectNodeRequested' event upon element selection.
- enabled
- Boolean True to enable inspection mode, false to disable it.
- inspectShadowDOM (optional)
- Boolean True to enable inspection mode for shadow DOM.
- highlightConfig (optional)
- DOM.HighlightConfig A descriptor for the highlight appearance of hovered-over nodes. May be omitted if
enabled == false
.
Code Example:
// WebInspector Command: DOM.setInspectModeEnabled
DOM.setInspectModeEnabled(enabled, inspectShadowDOM, highlightConfig);
DOM.highlightRect Command
Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.
- x
- Integer X coordinate
- y
- Integer Y coordinate
- width
- Integer Rectangle width
- height
- Integer Rectangle height
- color (optional)
- DOM.RGBA The highlight fill color (default: transparent).
- outlineColor (optional)
- DOM.RGBA The highlight outline color (default: transparent).
Code Example:
// WebInspector Command: DOM.highlightRect
DOM.highlightRect(x, y, width, height, color, outlineColor);
DOM.highlightQuad Command
Highlights given quad. Coordinates are absolute with respect to the main frame viewport.
- quad
- DOM.Quad Quad to highlight
- color (optional)
- DOM.RGBA The highlight fill color (default: transparent).
- outlineColor (optional)
- DOM.RGBA The highlight outline color (default: transparent).
Code Example:
// WebInspector Command: DOM.highlightQuad
DOM.highlightQuad(quad, color, outlineColor);
DOM.highlightNode Command
Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or objectId must be specified.
- highlightConfig
- DOM.HighlightConfig A descriptor for the highlight appearance.
- nodeId (optional)
- DOM.NodeId Identifier of the node to highlight.
- objectId (optional)
- Runtime.RemoteObjectId JavaScript object id of the node to be highlighted.
Code Example:
// WebInspector Command: DOM.highlightNode
DOM.highlightNode(highlightConfig, nodeId, objectId);
DOM.hideHighlight Command
Hides DOM node highlight.
Code Example:
// WebInspector Command: DOM.hideHighlight
DOM.hideHighlight();
DOM.highlightFrame Command
Highlights owner element of the frame with given id.
- frameId
- Page.FrameId Identifier of the frame to highlight.
- contentColor (optional)
- DOM.RGBA The content box highlight fill color (default: transparent).
- contentOutlineColor (optional)
- DOM.RGBA The content box highlight outline color (default: transparent).
Code Example:
// WebInspector Command: DOM.highlightFrame
DOM.highlightFrame(frameId, contentColor, contentOutlineColor);
DOM.pushNodeByPathToFrontend Command
Requests that the node is sent to the caller given its path. // FIXME, use XPath
- path
- String Path to node in the proprietary format.
Callback Parameters:
- nodeId
- DOM.NodeId Id of the node for given path.
Code Example:
// WebInspector Command: DOM.pushNodeByPathToFrontend
DOM.pushNodeByPathToFrontend(path, function callback(res) {
// res = {nodeId}
});
DOM.pushNodeByBackendIdToFrontend Command
Requests that the node is sent to the caller given its backend node id.
- backendNodeId
- DOM.BackendNodeId The backend node id of the node.
Callback Parameters:
- nodeId
- DOM.NodeId The pushed node's id.
Code Example:
// WebInspector Command: DOM.pushNodeByBackendIdToFrontend
DOM.pushNodeByBackendIdToFrontend(backendNodeId, function callback(res) {
// res = {nodeId}
});
DOM.releaseBackendNodeIds Command
Requests that group of BackendNodeIds
is released.
- nodeGroup
- String The backend node ids group name.
Code Example:
// WebInspector Command: DOM.releaseBackendNodeIds
DOM.releaseBackendNodeIds(nodeGroup);
DOM.resolveNode Command
Resolves JavaScript node object for given node id.
- nodeId
- DOM.NodeId Id of the node to resolve.
- objectGroup (optional)
- String Symbolic group name that can be used to release multiple objects.
Callback Parameters:
- object
- Runtime.RemoteObject JavaScript object wrapper for given node.
Code Example:
// WebInspector Command: DOM.resolveNode
DOM.resolveNode(nodeId, objectGroup, function callback(res) {
// res = {object}
});
DOM.getAttributes Command
Returns attributes for the specified node.
- nodeId
- DOM.NodeId Id of the node to retrieve attibutes for.
Callback Parameters:
- attributes
- [String] An interleaved array of node attribute names and values.
Code Example:
// WebInspector Command: DOM.getAttributes
DOM.getAttributes(nodeId, function callback(res) {
// res = {attributes}
});
DOM.moveTo Command
Moves node into the new container, places it before the given anchor.
- nodeId
- DOM.NodeId Id of the node to drop.
- targetNodeId
- DOM.NodeId Id of the element to drop into.
- insertBeforeNodeId (optional)
- DOM.NodeId Drop node before given one.
Callback Parameters:
- nodeId
- DOM.NodeId New id of the moved node.
Code Example:
// WebInspector Command: DOM.moveTo
DOM.moveTo(nodeId, targetNodeId, insertBeforeNodeId, function callback(res) {
// res = {nodeId}
});
DOM.undo Command
Undoes the last performed action.
Code Example:
// WebInspector Command: DOM.undo
DOM.undo();
DOM.redo Command
Re-does the last undone action.
Code Example:
// WebInspector Command: DOM.redo
DOM.redo();
DOM.markUndoableState Command
Marks last undoable state.
Code Example:
// WebInspector Command: DOM.markUndoableState
DOM.markUndoableState();
DOM.focus Command
Focuses the given element.
- nodeId
- DOM.NodeId Id of the node to focus.
Code Example:
// WebInspector Command: DOM.focus
DOM.focus(nodeId);
DOM.getBoxModel Command
Returns boxes for the currently selected nodes.
- nodeId
- DOM.NodeId Id of the node to get box model for.
Callback Parameters:
- model
- DOM.BoxModel Box model for the node.
Code Example:
// WebInspector Command: DOM.getBoxModel
DOM.getBoxModel(nodeId, function callback(res) {
// res = {model}
});
DOM.getNodeForLocation Command
Returns node id at given location.
- x
- Integer X coordinate.
- y
- Integer Y coordinate.
Callback Parameters:
- nodeId
- DOM.NodeId Id of the node at given coordinates.
Code Example:
// WebInspector Command: DOM.getNodeForLocation
DOM.getNodeForLocation(x, y, function callback(res) {
// res = {nodeId}
});
DOM.documentUpdated Event
Fired when Document
has been totally updated. Node ids are no longer valid.
Code Example:
// WebInspector Event: DOM.documentUpdated
function onDocumentUpdated(res) {
// res = {}
}
DOM.inspectNodeRequested Event
Fired when the node should be inspected. This happens after call to setInspectModeEnabled
.
- nodeId
- DOM.NodeId Id of the node to inspect.
Code Example:
// WebInspector Event: DOM.inspectNodeRequested
function onInspectNodeRequested(res) {
// res = {nodeId}
}
DOM.setChildNodes Event
Fired when backend wants to provide client with the missing DOM structure. This happens upon most of the calls requesting node ids.
- parentId
- DOM.NodeId Parent node id to populate with children.
- nodes
- [DOM.Node] Child nodes array.
Code Example:
// WebInspector Event: DOM.setChildNodes
function onSetChildNodes(res) {
// res = {parentId, nodes}
}
DOM.attributeModified Event
Fired when Element
's attribute is modified.
- nodeId
- DOM.NodeId Id of the node that has changed.
- name
- String Attribute name.
- value
- String Attribute value.
Code Example:
// WebInspector Event: DOM.attributeModified
function onAttributeModified(res) {
// res = {nodeId, name, value}
}
DOM.attributeRemoved Event
Fired when Element
's attribute is removed.
- nodeId
- DOM.NodeId Id of the node that has changed.
- name
- String A ttribute name.
Code Example:
// WebInspector Event: DOM.attributeRemoved
function onAttributeRemoved(res) {
// res = {nodeId, name}
}
DOM.inlineStyleInvalidated Event
Fired when Element
's inline style is modified via a CSS property modification.
- nodeIds
- [DOM.NodeId] Ids of the nodes for which the inline styles have been invalidated.
Code Example:
// WebInspector Event: DOM.inlineStyleInvalidated
function onInlineStyleInvalidated(res) {
// res = {nodeIds}
}
DOM.characterDataModified Event
Mirrors DOMCharacterDataModified
event.
- nodeId
- DOM.NodeId Id of the node that has changed.
- characterData
- String New text value.
Code Example:
// WebInspector Event: DOM.characterDataModified
function onCharacterDataModified(res) {
// res = {nodeId, characterData}
}
DOM.childNodeCountUpdated Event
Fired when Container
's child node count has changed.
- nodeId
- DOM.NodeId Id of the node that has changed.
- childNodeCount
- Integer New node count.
Code Example:
// WebInspector Event: DOM.childNodeCountUpdated
function onChildNodeCountUpdated(res) {
// res = {nodeId, childNodeCount}
}
DOM.childNodeInserted Event
Mirrors DOMNodeInserted
event.
- parentNodeId
- DOM.NodeId Id of the node that has changed.
- previousNodeId
- DOM.NodeId If of the previous siblint.
- node
- DOM.Node Inserted node data.
Code Example:
// WebInspector Event: DOM.childNodeInserted
function onChildNodeInserted(res) {
// res = {parentNodeId, previousNodeId, node}
}
DOM.childNodeRemoved Event
Mirrors DOMNodeRemoved
event.
- parentNodeId
- DOM.NodeId Parent id.
- nodeId
- DOM.NodeId Id of the node that has been removed.
Code Example:
// WebInspector Event: DOM.childNodeRemoved
function onChildNodeRemoved(res) {
// res = {parentNodeId, nodeId}
}
DOM.shadowRootPushed Event
Called when shadow root is pushed into the element.
- hostId
- DOM.NodeId Host element id.
- root
- DOM.Node Shadow root.
Code Example:
// WebInspector Event: DOM.shadowRootPushed
function onShadowRootPushed(res) {
// res = {hostId, root}
}
DOM.shadowRootPopped Event
Called when shadow root is popped from the element.
- hostId
- DOM.NodeId Host element id.
- rootId
- DOM.NodeId Shadow root id.
Code Example:
// WebInspector Event: DOM.shadowRootPopped
function onShadowRootPopped(res) {
// res = {hostId, rootId}
}
DOM.pseudoElementAdded Event
Called when a pseudo element is added to an element.
- parentId
- DOM.NodeId Pseudo element's parent element id.
- pseudoElement
- DOM.Node The added pseudo element.
Code Example:
// WebInspector Event: DOM.pseudoElementAdded
function onPseudoElementAdded(res) {
// res = {parentId, pseudoElement}
}
DOM.pseudoElementRemoved Event
Called when a pseudo element is removed from an element.
- parentId
- DOM.NodeId Pseudo element's parent element id.
- pseudoElementId
- DOM.NodeId The removed pseudo element id.
Code Example:
// WebInspector Event: DOM.pseudoElementRemoved
function onPseudoElementRemoved(res) {
// res = {parentId, pseudoElementId}
}
DOMDebugger
DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript execution will stop on these operations as if there was a regular breakpoint set.
Type
Command
DOMDebugger.DOMBreakpointType Type
DOM breakpoint type.
- ( subtree-modified | attribute-modified | node-removed )
DOMDebugger.setDOMBreakpoint Command
Sets breakpoint on particular operation with DOM.
- nodeId
- DOM.NodeId Identifier of the node to set breakpoint on.
- type
- DOMDebugger.DOMBreakpointType Type of the operation to stop upon.
Code Example:
// WebInspector Command: DOMDebugger.setDOMBreakpoint
DOMDebugger.setDOMBreakpoint(nodeId, type);
DOMDebugger.removeDOMBreakpoint Command
Removes DOM breakpoint that was set using setDOMBreakpoint
.
- nodeId
- DOM.NodeId Identifier of the node to remove breakpoint from.
- type
- DOMDebugger.DOMBreakpointType Type of the breakpoint to remove.
Code Example:
// WebInspector Command: DOMDebugger.removeDOMBreakpoint
DOMDebugger.removeDOMBreakpoint(nodeId, type);
DOMDebugger.setEventListenerBreakpoint Command
Sets breakpoint on particular DOM event.
- eventName
- String DOM Event name to stop on (any DOM event will do).
Code Example:
// WebInspector Command: DOMDebugger.setEventListenerBreakpoint
DOMDebugger.setEventListenerBreakpoint(eventName);
DOMDebugger.removeEventListenerBreakpoint Command
Removes breakpoint on particular DOM event.
- eventName
- String Event name.
Code Example:
// WebInspector Command: DOMDebugger.removeEventListenerBreakpoint
DOMDebugger.removeEventListenerBreakpoint(eventName);
DOMDebugger.setInstrumentationBreakpoint Command
Sets breakpoint on particular native event.
- eventName
- String Instrumentation name to stop on.
Code Example:
// WebInspector Command: DOMDebugger.setInstrumentationBreakpoint
DOMDebugger.setInstrumentationBreakpoint(eventName);
DOMDebugger.removeInstrumentationBreakpoint Command
Removes breakpoint on particular native event.
- eventName
- String Instrumentation name to stop on.
Code Example:
// WebInspector Command: DOMDebugger.removeInstrumentationBreakpoint
DOMDebugger.removeInstrumentationBreakpoint(eventName);
DOMDebugger.setXHRBreakpoint Command
Sets breakpoint on XMLHttpRequest.
- url
- String Resource URL substring. All XHRs having this substring in the URL will get stopped upon.
Code Example:
// WebInspector Command: DOMDebugger.setXHRBreakpoint
DOMDebugger.setXHRBreakpoint(url);
DOMDebugger.removeXHRBreakpoint Command
Removes breakpoint from XMLHttpRequest.
- url
- String Resource URL substring.
Code Example:
// WebInspector Command: DOMDebugger.removeXHRBreakpoint
DOMDebugger.removeXHRBreakpoint(url);
DOMStorage
Query and modify DOM storage.
Type
Command
Event
DOMStorage.StorageId Type
DOM Storage identifier.
- securityOrigin
- String Security origin for the storage.
- isLocalStorage
- Boolean Whether the storage is local storage (not session storage).
DOMStorage.Item Type
DOM Storage item.
- [String]
DOMStorage.enable Command
Enables storage tracking, storage events will now be delivered to the client.
Code Example:
// WebInspector Command: DOMStorage.enable
DOMStorage.enable();
DOMStorage.disable Command
Disables storage tracking, prevents storage events from being sent to the client.
Code Example:
// WebInspector Command: DOMStorage.disable
DOMStorage.disable();
DOMStorage.getDOMStorageItems Command
- storageId
- DOMStorage.StorageId
Callback Parameters:
- entries
- [DOMStorage.Item]
Code Example:
// WebInspector Command: DOMStorage.getDOMStorageItems
DOMStorage.getDOMStorageItems(storageId, function callback(res) {
// res = {entries}
});
DOMStorage.setDOMStorageItem Command
- storageId
- DOMStorage.StorageId
- key
- String
- value
- String
Code Example:
// WebInspector Command: DOMStorage.setDOMStorageItem
DOMStorage.setDOMStorageItem(storageId, key, value);
DOMStorage.removeDOMStorageItem Command
- storageId
- DOMStorage.StorageId
- key
- String
Code Example:
// WebInspector Command: DOMStorage.removeDOMStorageItem
DOMStorage.removeDOMStorageItem(storageId, key);
DOMStorage.domStorageItemsCleared Event
- storageId
- DOMStorage.StorageId
Code Example:
// WebInspector Event: DOMStorage.domStorageItemsCleared
function onDomStorageItemsCleared(res) {
// res = {storageId}
}
DOMStorage.domStorageItemRemoved Event
- storageId
- DOMStorage.StorageId
- key
- String
Code Example:
// WebInspector Event: DOMStorage.domStorageItemRemoved
function onDomStorageItemRemoved(res) {
// res = {storageId, key}
}
DOMStorage.domStorageItemAdded Event
- storageId
- DOMStorage.StorageId
- key
- String
- newValue
- String
Code Example:
// WebInspector Event: DOMStorage.domStorageItemAdded
function onDomStorageItemAdded(res) {
// res = {storageId, key, newValue}
}
DOMStorage.domStorageItemUpdated Event
- storageId
- DOMStorage.StorageId
- key
- String
- oldValue
- String
- newValue
- String
Code Example:
// WebInspector Event: DOMStorage.domStorageItemUpdated
function onDomStorageItemUpdated(res) {
// res = {storageId, key, oldValue, newValue}
}
Debugger
Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
Type
Command
Event
Debugger.BreakpointId Type
Breakpoint identifier.
- String
Debugger.ScriptId Type
Unique script identifier.
- String
Debugger.CallFrameId Type
Call frame identifier.
- String
Debugger.Location Type
Location in the source code.
- scriptId
- Debugger.ScriptId Script identifier as reported in the
Debugger.scriptParsed
.
- lineNumber
- Integer Line number in the script (0-based).
- columnNumber (optional)
- Integer Column number in the script (0-based).
Debugger.FunctionDetails Type
Information about the function.
- location
- Debugger.Location Location of the function.
- name (optional)
- String Name of the function. Not present for anonymous functions.
- displayName (optional)
- String Display name of the function(specified in 'displayName' property on the function object).
- inferredName (optional)
- String Name of the function inferred from its initial assignment.
- scopeChain (optional)
- [Debugger.Scope] Scope chain for this closure.
Debugger.CallFrame Type
JavaScript call frame. Array of call frames form the call stack.
- callFrameId
- Debugger.CallFrameId Call frame identifier. This identifier is only valid while the virtual machine is paused.
- functionName
- String Name of the JavaScript function called on this call frame.
- location
- Debugger.Location Location in the source code.
- scopeChain
- [Debugger.Scope] Scope chain for this call frame.
- this
- Runtime.RemoteObject
this
object for this call frame.
Debugger.Scope Type
Scope description.
- type
- ( global | local | with | closure | catch ) Scope type.
- object
- Runtime.RemoteObject Object representing the scope. For
global
and with
scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties.
Debugger.SetScriptSourceError Type
Error data for setScriptSource command. compileError is a case type for uncompilable script source error.
- compileError (optional)
- Object
Debugger.enable Command
Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
Code Example:
// WebInspector Command: Debugger.enable
Debugger.enable();
Debugger.disable Command
Disables debugger for given page.
Code Example:
// WebInspector Command: Debugger.disable
Debugger.disable();
Debugger.setBreakpointsActive Command
Activates / deactivates all breakpoints on the page.
- active
- Boolean New value for breakpoints active state.
Code Example:
// WebInspector Command: Debugger.setBreakpointsActive
Debugger.setBreakpointsActive(active);
Debugger.setSkipAllPauses Command
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
- skipped
- Boolean New value for skip pauses state.
- untilReload (optional)
- Boolean Whether page reload should set skipped to false.
Code Example:
// WebInspector Command: Debugger.setSkipAllPauses
Debugger.setSkipAllPauses(skipped, untilReload);
Debugger.setBreakpointByUrl Command
Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations
property. Further matching script parsing will result in subsequent breakpointResolved
events issued. This logical breakpoint will survive page reloads.
- lineNumber
- Integer Line number to set breakpoint at.
- url (optional)
- String URL of the resources to set breakpoint on.
- urlRegex (optional)
- String Regex pattern for the URLs of the resources to set breakpoints on. Either
url
or urlRegex
must be specified.
- columnNumber (optional)
- Integer Offset in the line to set breakpoint at.
- condition (optional)
- String Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
- isAntibreakpoint (optional)
- Boolean Creates pseudo-breakpoint that prevents debugger from pausing on exception at this location.
Callback Parameters:
- breakpointId
- Debugger.BreakpointId Id of the created breakpoint for further reference.
- locations
- [Debugger.Location] List of the locations this breakpoint resolved into upon addition.
Code Example:
// WebInspector Command: Debugger.setBreakpointByUrl
Debugger.setBreakpointByUrl(lineNumber, url, urlRegex, columnNumber, condition, isAntibreakpoint, function callback(res) {
// res = {breakpointId, locations}
});
Debugger.setBreakpoint Command
Sets JavaScript breakpoint at a given location.
- location
- Debugger.Location Location to set breakpoint in.
- condition (optional)
- String Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
Callback Parameters:
- breakpointId
- Debugger.BreakpointId Id of the created breakpoint for further reference.
- actualLocation
- Debugger.Location Location this breakpoint resolved into.
Code Example:
// WebInspector Command: Debugger.setBreakpoint
Debugger.setBreakpoint(location, condition, function callback(res) {
// res = {breakpointId, actualLocation}
});
Debugger.removeBreakpoint Command
Removes JavaScript breakpoint.
- breakpointId
- Debugger.BreakpointId
Code Example:
// WebInspector Command: Debugger.removeBreakpoint
Debugger.removeBreakpoint(breakpointId);
Debugger.continueToLocation Command
Continues execution until specific location is reached.
- location
- Debugger.Location Location to continue to.
- interstatementLocation (optional)
- Boolean Allows breakpoints at the intemediate positions inside statements.
Code Example:
// WebInspector Command: Debugger.continueToLocation
Debugger.continueToLocation(location, interstatementLocation);
Debugger.stepOver Command
Steps over the statement.
Code Example:
// WebInspector Command: Debugger.stepOver
Debugger.stepOver();
Debugger.stepInto Command
Steps into the function call.
Code Example:
// WebInspector Command: Debugger.stepInto
Debugger.stepInto();
Debugger.stepOut Command
Steps out of the function call.
Code Example:
// WebInspector Command: Debugger.stepOut
Debugger.stepOut();
Debugger.pause Command
Stops on the next JavaScript statement.
Code Example:
// WebInspector Command: Debugger.pause
Debugger.pause();
Debugger.resume Command
Resumes JavaScript execution.
Code Example:
// WebInspector Command: Debugger.resume
Debugger.resume();
Debugger.searchInContent Command
Searches for given string in script content.
- scriptId
- Debugger.ScriptId Id of the script to search in.
- query
- String String to search for.
- caseSensitive (optional)
- Boolean If true, search is case sensitive.
- isRegex (optional)
- Boolean If true, treats string parameter as regex.
Callback Parameters:
- result
- [Page.SearchMatch] List of search matches.
Code Example:
// WebInspector Command: Debugger.searchInContent
Debugger.searchInContent(scriptId, query, caseSensitive, isRegex, function callback(res) {
// res = {result}
});
Debugger.canSetScriptSource Command
Always returns true.
Callback Parameters:
- result
- Boolean True if
setScriptSource
is supported.
Code Example:
// WebInspector Command: Debugger.canSetScriptSource
Debugger.canSetScriptSource(function callback(res) {
// res = {result}
});
Debugger.setScriptSource Command
Edits JavaScript source live.
- scriptId
- Debugger.ScriptId Id of the script to edit.
- scriptSource
- String New content of the script.
- preview (optional)
- Boolean If true the change will not actually be applied. Preview mode may be used to get result description without actually modifying the code.
Callback Parameters:
- callFrames (optional)
- [Debugger.CallFrame] New stack trace in case editing has happened while VM was stopped.
- result (optional)
- Object VM-specific description of the changes applied.
Code Example:
// WebInspector Command: Debugger.setScriptSource
Debugger.setScriptSource(scriptId, scriptSource, preview, function callback(res) {
// res = {callFrames, result}
});
Debugger.restartFrame Command
Restarts particular call frame from the beginning.
- callFrameId
- Debugger.CallFrameId Call frame identifier to evaluate on.
Callback Parameters:
- callFrames
- [Debugger.CallFrame] New stack trace.
- result
- Object VM-specific description.
Code Example:
// WebInspector Command: Debugger.restartFrame
Debugger.restartFrame(callFrameId, function callback(res) {
// res = {callFrames, result}
});
Debugger.getScriptSource Command
Returns source for the script with given id.
- scriptId
- Debugger.ScriptId Id of the script to get source for.
Callback Parameters:
- scriptSource
- String Script source.
Code Example:
// WebInspector Command: Debugger.getScriptSource
Debugger.getScriptSource(scriptId, function callback(res) {
// res = {scriptSource}
});
Debugger.getFunctionDetails Command
Returns detailed informtation on given function.
- functionId
- Runtime.RemoteObjectId Id of the function to get location for.
Callback Parameters:
- details
- Debugger.FunctionDetails Information about the function.
Code Example:
// WebInspector Command: Debugger.getFunctionDetails
Debugger.getFunctionDetails(functionId, function callback(res) {
// res = {details}
});
Debugger.setPauseOnExceptions Command
Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none
.
- state
- ( none | uncaught | all ) Pause on exceptions mode.
Code Example:
// WebInspector Command: Debugger.setPauseOnExceptions
Debugger.setPauseOnExceptions(state);
Debugger.evaluateOnCallFrame Command
Evaluates expression on a given call frame.
- callFrameId
- Debugger.CallFrameId Call frame identifier to evaluate on.
- expression
- String Expression to evaluate.
- objectGroup (optional)
- String String object group name to put result into (allows rapid releasing resulting object handles using
releaseObjectGroup
).
- includeCommandLineAPI (optional)
- Boolean Specifies whether command line API should be available to the evaluated expression, defaults to false.
- doNotPauseOnExceptionsAndMuteConsole (optional)
- Boolean Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.
- returnByValue (optional)
- Boolean Whether the result is expected to be a JSON object that should be sent by value.
- generatePreview (optional)
- Boolean Whether preview should be generated for the result.
Callback Parameters:
- result
- Runtime.RemoteObject Object wrapper for the evaluation result.
- wasThrown (optional)
- Boolean True if the result was thrown during the evaluation.
Code Example:
// WebInspector Command: Debugger.evaluateOnCallFrame
Debugger.evaluateOnCallFrame(callFrameId, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, function callback(res) {
// res = {result, wasThrown}
});
Debugger.compileScript Command
Compiles expression.
- expression
- String Expression to compile.
- sourceURL
- String Source url to be set for the script.
Callback Parameters:
- scriptId (optional)
- Debugger.ScriptId Id of the script.
- syntaxErrorMessage (optional)
- String Syntax error message if compilation failed.
Code Example:
// WebInspector Command: Debugger.compileScript
Debugger.compileScript(expression, sourceURL, function callback(res) {
// res = {scriptId, syntaxErrorMessage}
});
Debugger.runScript Command
Runs script with given id in a given context.
- scriptId
- Debugger.ScriptId Id of the script to run.
- contextId (optional)
- Runtime.ExecutionContextId Specifies in which isolated context to perform script run. Each content script lives in an isolated context and this parameter may be used to specify one of those contexts. If the parameter is omitted or 0 the evaluation will be performed in the context of the inspected page.
- objectGroup (optional)
- String Symbolic group name that can be used to release multiple objects.
- doNotPauseOnExceptionsAndMuteConsole (optional)
- Boolean Specifies whether script run should stop on exceptions and mute console. Overrides setPauseOnException state.
Callback Parameters:
- result
- Runtime.RemoteObject Run result.
- wasThrown (optional)
- Boolean True if the result was thrown during the script run.
Code Example:
// WebInspector Command: Debugger.runScript
Debugger.runScript(scriptId, contextId, objectGroup, doNotPauseOnExceptionsAndMuteConsole, function callback(res) {
// res = {result, wasThrown}
});
Debugger.setOverlayMessage Command
Sets overlay message.
- message (optional)
- String Overlay message to display when paused in debugger.
Code Example:
// WebInspector Command: Debugger.setOverlayMessage
Debugger.setOverlayMessage(message);
Debugger.setVariableValue Command
Changes value of variable in a callframe or a closure. Either callframe or function must be specified. Object-based scopes are not supported and must be mutated manually.
- scopeNumber
- Integer 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.
- variableName
- String Variable name.
- newValue
- Runtime.CallArgument New variable value.
- callFrameId (optional)
- Debugger.CallFrameId Id of callframe that holds variable.
- functionObjectId (optional)
- Runtime.RemoteObjectId Object id of closure (function) that holds variable.
Code Example:
// WebInspector Command: Debugger.setVariableValue
Debugger.setVariableValue(scopeNumber, variableName, newValue, callFrameId, functionObjectId);
Debugger.getStepInPositions Command
Lists all positions where step-in is possible for a current statement in a specified call frame
- callFrameId
- Debugger.CallFrameId Id of a call frame where the current statement should be analized
Callback Parameters:
- stepInPositions (optional)
- [Debugger.Location] experimental
Code Example:
// WebInspector Command: Debugger.getStepInPositions
Debugger.getStepInPositions(callFrameId, function callback(res) {
// res = {stepInPositions}
});
Debugger.getBacktrace Command
Returns call stack including variables changed since VM was paused. VM must be paused.
Callback Parameters:
- callFrames
- [Debugger.CallFrame] Call stack the virtual machine stopped on.
Code Example:
// WebInspector Command: Debugger.getBacktrace
Debugger.getBacktrace(function callback(res) {
// res = {callFrames}
});
Debugger.skipStackFrames Command
Makes backend skip steps in the sources with names matching given pattern. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
- script (optional)
- String Regular expression defining the scripts to ignore while stepping.
Code Example:
// WebInspector Command: Debugger.skipStackFrames
Debugger.skipStackFrames(script);
Debugger.globalObjectCleared Event
Called when global has been cleared and debugger client should reset its state. Happens upon navigation or reload.
Code Example:
// WebInspector Event: Debugger.globalObjectCleared
function onGlobalObjectCleared(res) {
// res = {}
}
Debugger.scriptParsed Event
Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.
- scriptId
- Debugger.ScriptId Identifier of the script parsed.
- url
- String URL or name of the script parsed (if any).
- startLine
- Integer Line offset of the script within the resource with given URL (for script tags).
- startColumn
- Integer Column offset of the script within the resource with given URL.
- endLine
- Integer Last line of the script.
- endColumn
- Integer Length of the last line of the script.
- isContentScript (optional)
- Boolean Determines whether this script is a user extension script.
- sourceMapURL (optional)
- String URL of source map associated with script (if any).
- hasSourceURL (optional)
- Boolean True, if this script has sourceURL.
Code Example:
// WebInspector Event: Debugger.scriptParsed
function onScriptParsed(res) {
// res = {scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceMapURL, hasSourceURL}
}
Debugger.scriptFailedToParse Event
Fired when virtual machine fails to parse the script.
- url
- String URL of the script that failed to parse.
- scriptSource
- String Source text of the script that failed to parse.
- startLine
- Integer Line offset of the script within the resource.
- errorLine
- Integer Line with error.
- errorMessage
- String Parse error message.
Code Example:
// WebInspector Event: Debugger.scriptFailedToParse
function onScriptFailedToParse(res) {
// res = {url, scriptSource, startLine, errorLine, errorMessage}
}
Debugger.breakpointResolved Event
Fired when breakpoint is resolved to an actual script and location.
- breakpointId
- Debugger.BreakpointId Breakpoint unique identifier.
- location
- Debugger.Location Actual breakpoint location.
Code Example:
// WebInspector Event: Debugger.breakpointResolved
function onBreakpointResolved(res) {
// res = {breakpointId, location}
}
Debugger.paused Event
Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.
- callFrames
- [Debugger.CallFrame] Call stack the virtual machine stopped on.
- reason
- ( XHR | DOM | EventListener | exception | assert | CSPViolation | debugCommand | other ) Pause reason.
- data (optional)
- Object Object containing break-specific auxiliary properties.
- hitBreakpoints (optional)
- [String] Hit breakpoints IDs
Code Example:
// WebInspector Event: Debugger.paused
function onPaused(res) {
// res = {callFrames, reason, data, hitBreakpoints}
}
Debugger.resumed Event
Fired when the virtual machine resumed execution.
Code Example:
// WebInspector Event: Debugger.resumed
function onResumed(res) {
// res = {}
}
FileSystem
Type
Command
FileSystem.Entry Type
Represents a browser side file or directory.
- url
- String filesystem: URL for the entry.
- name
- String The name of the file or directory.
- isDirectory
- Boolean True if the entry is a directory.
- mimeType (optional)
- String MIME type of the entry, available for a file only.
- resourceType (optional)
- Page.ResourceType ResourceType of the entry, available for a file only.
- isTextFile (optional)
- Boolean True if the entry is a text file.
FileSystem.enable Command
Enables events from backend.
Code Example:
// WebInspector Command: FileSystem.enable
FileSystem.enable();
FileSystem.disable Command
Disables events from backend.
Code Example:
// WebInspector Command: FileSystem.disable
FileSystem.disable();
FileSystem.requestFileSystemRoot Command
Returns root directory of the FileSystem, if exists.
- origin
- String Security origin of requesting FileSystem. One of frames in current page needs to have this security origin.
- type
- ( temporary | persistent ) FileSystem type of requesting FileSystem.
Callback Parameters:
- errorCode
- Integer 0, if no error. Otherwise, errorCode is set to FileError::ErrorCode value.
- root (optional)
- FileSystem.Entry Contains root of the requested FileSystem if the command completed successfully.
Code Example:
// WebInspector Command: FileSystem.requestFileSystemRoot
FileSystem.requestFileSystemRoot(origin, type, function callback(res) {
// res = {errorCode, root}
});
FileSystem.requestDirectoryContent Command
Returns content of the directory.
- url
- String URL of the directory that the frontend is requesting to read from.
Callback Parameters:
- errorCode
- Integer 0, if no error. Otherwise, errorCode is set to FileError::ErrorCode value.
- entries (optional)
- [FileSystem.Entry] Contains all entries on directory if the command completed successfully.
Code Example:
// WebInspector Command: FileSystem.requestDirectoryContent
FileSystem.requestDirectoryContent(url, function callback(res) {
// res = {errorCode, entries}
});
FileSystem.requestFileContent Command
Returns content of the file. Result should be sliced into [start, end).
- url
- String URL of the file that the frontend is requesting to read from.
- readAsText
- Boolean True if the content should be read as text, otherwise the result will be returned as base64 encoded text.
- start (optional)
- Integer Specifies the start of range to read.
- end (optional)
- Integer Specifies the end of range to read exclusively.
- charset (optional)
- String Overrides charset of the content when content is served as text.
Callback Parameters:
- errorCode
- Integer 0, if no error. Otherwise, errorCode is set to FileError::ErrorCode value.
- content (optional)
- String Content of the file.
- charset (optional)
- String Charset of the content if it is served as text.
Code Example:
// WebInspector Command: FileSystem.requestFileContent
FileSystem.requestFileContent(url, readAsText, start, end, charset, function callback(res) {
// res = {errorCode, content, charset}
});
FileSystem.deleteEntry Command
Deletes specified entry. If the entry is a directory, the agent deletes children recursively.
- url
- String URL of the entry to delete.
Callback Parameters:
- errorCode
- Integer 0, if no error. Otherwise errorCode is set to FileError::ErrorCode value.
Code Example:
// WebInspector Command: FileSystem.deleteEntry
FileSystem.deleteEntry(url, function callback(res) {
// res = {errorCode}
});
HeapProfiler
Type
Command
Event
HeapProfiler.HeapSnapshotObjectId Type
Heap snashot object id.
- String
HeapProfiler.getProfileHeaders Command
Callback Parameters:
- headers
- [HeapProfiler.ProfileHeader]
Code Example:
// WebInspector Command: HeapProfiler.getProfileHeaders
HeapProfiler.getProfileHeaders(function callback(res) {
// res = {headers}
});
HeapProfiler.startTrackingHeapObjects Command
Code Example:
// WebInspector Command: HeapProfiler.startTrackingHeapObjects
HeapProfiler.startTrackingHeapObjects();
HeapProfiler.stopTrackingHeapObjects Command
Code Example:
// WebInspector Command: HeapProfiler.stopTrackingHeapObjects
HeapProfiler.stopTrackingHeapObjects();
HeapProfiler.getHeapSnapshot Command
- uid
- Integer
Code Example:
// WebInspector Command: HeapProfiler.getHeapSnapshot
HeapProfiler.getHeapSnapshot(uid);
HeapProfiler.removeProfile Command
- uid
- Integer
Code Example:
// WebInspector Command: HeapProfiler.removeProfile
HeapProfiler.removeProfile(uid);
HeapProfiler.clearProfiles Command
Code Example:
// WebInspector Command: HeapProfiler.clearProfiles
HeapProfiler.clearProfiles();
HeapProfiler.takeHeapSnapshot Command
- reportProgress (optional)
- Boolean If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
Code Example:
// WebInspector Command: HeapProfiler.takeHeapSnapshot
HeapProfiler.takeHeapSnapshot(reportProgress);
HeapProfiler.collectGarbage Command
Code Example:
// WebInspector Command: HeapProfiler.collectGarbage
HeapProfiler.collectGarbage();
HeapProfiler.getObjectByHeapObjectId Command
- objectId
- HeapProfiler.HeapSnapshotObjectId
- objectGroup (optional)
- String Symbolic group name that can be used to release multiple objects.
Callback Parameters:
- result
- Runtime.RemoteObject Evaluation result.
Code Example:
// WebInspector Command: HeapProfiler.getObjectByHeapObjectId
HeapProfiler.getObjectByHeapObjectId(objectId, objectGroup, function callback(res) {
// res = {result}
});
HeapProfiler.getHeapObjectId Command
- objectId
- Runtime.RemoteObjectId Identifier of the object to get heap object id for.
Callback Parameters:
- heapSnapshotObjectId
- HeapProfiler.HeapSnapshotObjectId Id of the heap snapshot object corresponding to the passed remote object id.
Code Example:
// WebInspector Command: HeapProfiler.getHeapObjectId
HeapProfiler.getHeapObjectId(objectId, function callback(res) {
// res = {heapSnapshotObjectId}
});
HeapProfiler.addProfileHeader Event
- header
- HeapProfiler.ProfileHeader
Code Example:
// WebInspector Event: HeapProfiler.addProfileHeader
function onAddProfileHeader(res) {
// res = {header}
}
HeapProfiler.addHeapSnapshotChunk Event
- uid
- Integer
- chunk
- String
Code Example:
// WebInspector Event: HeapProfiler.addHeapSnapshotChunk
function onAddHeapSnapshotChunk(res) {
// res = {uid, chunk}
}
HeapProfiler.finishHeapSnapshot Event
- uid
- Integer
Code Example:
// WebInspector Event: HeapProfiler.finishHeapSnapshot
function onFinishHeapSnapshot(res) {
// res = {uid}
}
HeapProfiler.resetProfiles Event
Code Example:
// WebInspector Event: HeapProfiler.resetProfiles
function onResetProfiles(res) {
// res = {}
}
HeapProfiler.reportHeapSnapshotProgress Event
- done
- Integer
- total
- Integer
Code Example:
// WebInspector Event: HeapProfiler.reportHeapSnapshotProgress
function onReportHeapSnapshotProgress(res) {
// res = {done, total}
}
HeapProfiler.lastSeenObjectId Event
If heap objects tracking has been started then backend regulary sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event.
- lastSeenObjectId
- Integer
- timestamp
- Number
Code Example:
// WebInspector Event: HeapProfiler.lastSeenObjectId
function onLastSeenObjectId(res) {
// res = {lastSeenObjectId, timestamp}
}
HeapProfiler.heapStatsUpdate Event
If heap objects tracking has been started then backend may send update for one or more fragments
- statsUpdate
- [Integer] An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment.
Code Example:
// WebInspector Event: HeapProfiler.heapStatsUpdate
function onHeapStatsUpdate(res) {
// res = {statsUpdate}
}
IndexedDB
Type
Command
IndexedDB.DatabaseWithObjectStores Type
Database with an array of object stores.
- name
- String Database name.
- version
- String Deprecated string database version.
- intVersion
- Integer Integer database version.
- objectStores
- [IndexedDB.ObjectStore] Object stores in this database.
IndexedDB.ObjectStore Type
Object store.
- name
- String Object store name.
- keyPath
- IndexedDB.KeyPath Object store key path.
- autoIncrement
- Boolean If true, object store has auto increment flag set.
- indexes
- [IndexedDB.ObjectStoreIndex] Indexes in this object store.
IndexedDB.ObjectStoreIndex Type
Object store index.
- name
- String Index name.
- keyPath
- IndexedDB.KeyPath Index key path.
- unique
- Boolean If true, index is unique.
- multiEntry
- Boolean If true, index allows multiple entries for a key.
IndexedDB.Key Type
Key.
- type
- ( number | string | date | array ) Key type.
- number (optional)
- Number Number value.
- string (optional)
- String String value.
- date (optional)
- Number Date value.
- array (optional)
- [IndexedDB.Key] Array value.
IndexedDB.KeyRange Type
Key range.
- lower (optional)
- IndexedDB.Key Lower bound.
- upper (optional)
- IndexedDB.Key Upper bound.
- lowerOpen
- Boolean If true lower bound is open.
- upperOpen
- Boolean If true upper bound is open.
IndexedDB.DataEntry Type
Data entry.
- key
- Runtime.RemoteObject Key.
- primaryKey
- Runtime.RemoteObject Primary key.
- value
- Runtime.RemoteObject Value.
IndexedDB.KeyPath Type
Key path.
- type
- ( null | string | array ) Key path type.
- string (optional)
- String String value.
- array (optional)
- [String] Array value.
IndexedDB.enable Command
Enables events from backend.
Code Example:
// WebInspector Command: IndexedDB.enable
IndexedDB.enable();
IndexedDB.disable Command
Disables events from backend.
Code Example:
// WebInspector Command: IndexedDB.disable
IndexedDB.disable();
IndexedDB.requestDatabaseNames Command
Requests database names for given security origin.
- securityOrigin
- String Security origin.
Callback Parameters:
- databaseNames
- [String] Database names for origin.
Code Example:
// WebInspector Command: IndexedDB.requestDatabaseNames
IndexedDB.requestDatabaseNames(securityOrigin, function callback(res) {
// res = {databaseNames}
});
IndexedDB.requestDatabase Command
Requests database with given name in given frame.
- securityOrigin
- String Security origin.
- databaseName
- String Database name.
Callback Parameters:
- databaseWithObjectStores
- IndexedDB.DatabaseWithObjectStores Database with an array of object stores.
Code Example:
// WebInspector Command: IndexedDB.requestDatabase
IndexedDB.requestDatabase(securityOrigin, databaseName, function callback(res) {
// res = {databaseWithObjectStores}
});
IndexedDB.requestData Command
Requests data from object store or index.
- securityOrigin
- String Security origin.
- databaseName
- String Database name.
- objectStoreName
- String Object store name.
- indexName
- String Index name, empty string for object store data requests.
- skipCount
- Integer Number of records to skip.
- pageSize
- Integer Number of records to fetch.
- keyRange (optional)
- IndexedDB.KeyRange Key range.
Callback Parameters:
- objectStoreDataEntries
- [IndexedDB.DataEntry] Array of object store data entries.
- hasMore
- Boolean If true, there are more entries to fetch in the given range.
Code Example:
// WebInspector Command: IndexedDB.requestData
IndexedDB.requestData(securityOrigin, databaseName, objectStoreName, indexName, skipCount, pageSize, keyRange, function callback(res) {
// res = {objectStoreDataEntries, hasMore}
});
IndexedDB.clearObjectStore Command
Clears all entries from an object store.
- securityOrigin
- String Security origin.
- databaseName
- String Database name.
- objectStoreName
- String Object store name.
Callback Parameters:
Code Example:
// WebInspector Command: IndexedDB.clearObjectStore
IndexedDB.clearObjectStore(securityOrigin, databaseName, objectStoreName, function callback(res) {
// res = {}
});
Network
Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.
Type
Command
- Network.enable: Enables network tracking, network events will now be delivered to the client.
- Network.disable: Disables network tracking, prevents network events from being sent to the client.
- Network.setUserAgentOverride: Allows overriding user agent with the given string.
- Network.setExtraHTTPHeaders: Specifies whether to always send extra HTTP headers with the requests from this page.
- Network.getResponseBody: Returns content served for the given request.
- Network.replayXHR: This method sends a new XMLHttpRequest which is identical to the original one. The following parameters should be identical: method, url, async, request body, extra headers, withCredentials attribute, user, password.
- Network.canClearBrowserCache: Tells whether clearing browser cache is supported.
- Network.clearBrowserCache: Clears browser cache.
- Network.canClearBrowserCookies: Tells whether clearing browser cookies is supported.
- Network.clearBrowserCookies: Clears browser cookies.
- Network.setCacheDisabled: Toggles ignoring cache for each request. If true, cache will not be used.
- Network.loadResourceForFrontend: Loads a resource in the context of a frame on the inspected page without cross origin checks.
Event
Network.LoaderId Type
Unique loader identifier.
- String
Network.RequestId Type
Unique request identifier.
- String
Network.Timestamp Type
Number of seconds since epoch.
- Number
Network.ResourceTiming Type
Timing information for the request.
- requestTime
- Number Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime.
- proxyStart
- Number Started resolving proxy.
- proxyEnd
- Number Finished resolving proxy.
- dnsStart
- Number Started DNS address resolve.
- dnsEnd
- Number Finished DNS address resolve.
- connectStart
- Number Started connecting to the remote host.
- connectEnd
- Number Connected to the remote host.
- sslStart
- Number Started SSL handshake.
- sslEnd
- Number Finished SSL handshake.
- sendStart
- Number Started sending request.
- sendEnd
- Number Finished sending request.
- receiveHeadersEnd
- Number Finished receiving response headers.
Network.Request Type
HTTP request data.
- url
- String Request URL.
- method
- String HTTP request method.
- headers
- Network.Headers HTTP request headers.
- postData (optional)
- String HTTP POST request data.
Network.Response Type
HTTP response data.
- url
- String Response URL. This URL can be different from CachedResource.url in case of redirect.
- status
- Number HTTP response status code.
- statusText
- String HTTP response status text.
- headers
- Network.Headers HTTP response headers.
- headersText (optional)
- String HTTP response headers text.
- mimeType
- String Resource mimeType as determined by the browser.
- requestHeaders (optional)
- Network.Headers Refined HTTP request headers that were actually transmitted over the network.
- requestHeadersText (optional)
- String HTTP request headers text.
- connectionReused
- Boolean Specifies whether physical connection was actually reused for this request.
- connectionId
- Number Physical connection id that was actually used for this request.
- fromDiskCache (optional)
- Boolean Specifies that the request was served from the disk cache.
- timing (optional)
- Network.ResourceTiming Timing information for the given request.
Network.WebSocketRequest Type
WebSocket request data.
- headers
- Network.Headers HTTP response headers.
Network.WebSocketResponse Type
WebSocket response data.
- status
- Number HTTP response status code.
- statusText
- String HTTP response status text.
- headers
- Network.Headers HTTP response headers.
Network.WebSocketFrame Type
WebSocket frame data.
- opcode
- Number WebSocket frame opcode.
- mask
- Boolean WebSocke frame mask.
- payloadData
- String WebSocke frame payload data.
Network.CachedResource Type
Information about the cached resource.
- url
- String Resource URL. This is the url of the original network request.
- type
- Page.ResourceType Type of this resource.
- response (optional)
- Network.Response Cached response data.
- bodySize
- Number Cached response body size.
Network.Initiator Type
Information about the request initiator.
- type
- ( parser | script | other ) Type of this initiator.
- stackTrace (optional)
- Console.StackTrace Initiator JavaScript stack trace, set for Script only.
- url (optional)
- String Initiator URL, set for Parser type only.
- lineNumber (optional)
- Number Initiator line number, set for Parser type only.
Network.enable Command
Enables network tracking, network events will now be delivered to the client.
Code Example:
// WebInspector Command: Network.enable
Network.enable();
Network.disable Command
Disables network tracking, prevents network events from being sent to the client.
Code Example:
// WebInspector Command: Network.disable
Network.disable();
Network.setUserAgentOverride Command
Allows overriding user agent with the given string.
- userAgent
- String User agent to use.
Code Example:
// WebInspector Command: Network.setUserAgentOverride
Network.setUserAgentOverride(userAgent);
Network.setExtraHTTPHeaders Command
Specifies whether to always send extra HTTP headers with the requests from this page.
- headers
- Network.Headers Map with extra HTTP headers.
Code Example:
// WebInspector Command: Network.setExtraHTTPHeaders
Network.setExtraHTTPHeaders(headers);
Network.getResponseBody Command
Returns content served for the given request.
- requestId
- Network.RequestId Identifier of the network request to get content for.
Callback Parameters:
- body
- String Response body.
- base64Encoded
- Boolean True, if content was sent as base64.
Code Example:
// WebInspector Command: Network.getResponseBody
Network.getResponseBody(requestId, function callback(res) {
// res = {body, base64Encoded}
});
Network.replayXHR Command
This method sends a new XMLHttpRequest which is identical to the original one. The following parameters should be identical: method, url, async, request body, extra headers, withCredentials attribute, user, password.
- requestId
- Network.RequestId Identifier of XHR to replay.
Code Example:
// WebInspector Command: Network.replayXHR
Network.replayXHR(requestId);
Network.canClearBrowserCache Command
Tells whether clearing browser cache is supported.
Callback Parameters:
- result
- Boolean True if browser cache can be cleared.
Code Example:
// WebInspector Command: Network.canClearBrowserCache
Network.canClearBrowserCache(function callback(res) {
// res = {result}
});
Network.clearBrowserCache Command
Clears browser cache.
Code Example:
// WebInspector Command: Network.clearBrowserCache
Network.clearBrowserCache();
Network.canClearBrowserCookies Command
Tells whether clearing browser cookies is supported.
Callback Parameters:
- result
- Boolean True if browser cookies can be cleared.
Code Example:
// WebInspector Command: Network.canClearBrowserCookies
Network.canClearBrowserCookies(function callback(res) {
// res = {result}
});
Network.clearBrowserCookies Command
Clears browser cookies.
Code Example:
// WebInspector Command: Network.clearBrowserCookies
Network.clearBrowserCookies();
Network.setCacheDisabled Command
Toggles ignoring cache for each request. If true
, cache will not be used.
- cacheDisabled
- Boolean Cache disabled state.
Code Example:
// WebInspector Command: Network.setCacheDisabled
Network.setCacheDisabled(cacheDisabled);
Network.loadResourceForFrontend Command
Loads a resource in the context of a frame on the inspected page without cross origin checks.
- frameId
- Page.FrameId Frame to load the resource from.
- url
- String URL of the resource to load.
- requestHeaders (optional)
- Network.Headers Request headers.
Callback Parameters:
- statusCode
- Number HTTP status code.
- responseHeaders
- Network.Headers Response headers.
- content
- String Resource content.
Code Example:
// WebInspector Command: Network.loadResourceForFrontend
Network.loadResourceForFrontend(frameId, url, requestHeaders, function callback(res) {
// res = {statusCode, responseHeaders, content}
});
Network.requestWillBeSent Event
Fired when page is about to send HTTP request.
- requestId
- Network.RequestId Request identifier.
- frameId
- Page.FrameId Frame identifier.
- loaderId
- Network.LoaderId Loader identifier.
- documentURL
- String URL of the document this request is loaded for.
- request
- Network.Request Request data.
- timestamp
- Network.Timestamp Timestamp.
- initiator
- Network.Initiator Request initiator.
- redirectResponse (optional)
- Network.Response Redirect response data.
Code Example:
// WebInspector Event: Network.requestWillBeSent
function onRequestWillBeSent(res) {
// res = {requestId, frameId, loaderId, documentURL, request, timestamp, initiator, redirectResponse}
}
Network.requestServedFromCache Event
Fired if request ended up loading from cache.
- requestId
- Network.RequestId Request identifier.
Code Example:
// WebInspector Event: Network.requestServedFromCache
function onRequestServedFromCache(res) {
// res = {requestId}
}
Network.responseReceived Event
Fired when HTTP response is available.
- requestId
- Network.RequestId Request identifier.
- frameId
- Page.FrameId Frame identifier.
- loaderId
- Network.LoaderId Loader identifier.
- timestamp
- Network.Timestamp Timestamp.
- type
- Page.ResourceType Resource type.
- response
- Network.Response Response data.
Code Example:
// WebInspector Event: Network.responseReceived
function onResponseReceived(res) {
// res = {requestId, frameId, loaderId, timestamp, type, response}
}
Network.dataReceived Event
Fired when data chunk was received over the network.
- requestId
- Network.RequestId Request identifier.
- timestamp
- Network.Timestamp Timestamp.
- dataLength
- Integer Data chunk length.
- encodedDataLength
- Integer Actual bytes received (might be less than dataLength for compressed encodings).
Code Example:
// WebInspector Event: Network.dataReceived
function onDataReceived(res) {
// res = {requestId, timestamp, dataLength, encodedDataLength}
}
Network.loadingFinished Event
Fired when HTTP request has finished loading.
- requestId
- Network.RequestId Request identifier.
- timestamp
- Network.Timestamp Timestamp.
Code Example:
// WebInspector Event: Network.loadingFinished
function onLoadingFinished(res) {
// res = {requestId, timestamp}
}
Network.loadingFailed Event
Fired when HTTP request has failed to load.
- requestId
- Network.RequestId Request identifier.
- timestamp
- Network.Timestamp Timestamp.
- errorText
- String User friendly error message.
- canceled (optional)
- Boolean True if loading was canceled.
Code Example:
// WebInspector Event: Network.loadingFailed
function onLoadingFailed(res) {
// res = {requestId, timestamp, errorText, canceled}
}
Network.webSocketWillSendHandshakeRequest Event
Fired when WebSocket is about to initiate handshake.
- requestId
- Network.RequestId Request identifier.
- timestamp
- Network.Timestamp Timestamp.
- request
- Network.WebSocketRequest WebSocket request data.
Code Example:
// WebInspector Event: Network.webSocketWillSendHandshakeRequest
function onWebSocketWillSendHandshakeRequest(res) {
// res = {requestId, timestamp, request}
}
Network.webSocketHandshakeResponseReceived Event
Fired when WebSocket handshake response becomes available.
- requestId
- Network.RequestId Request identifier.
- timestamp
- Network.Timestamp Timestamp.
- response
- Network.WebSocketResponse WebSocket response data.
Code Example:
// WebInspector Event: Network.webSocketHandshakeResponseReceived
function onWebSocketHandshakeResponseReceived(res) {
// res = {requestId, timestamp, response}
}
Network.webSocketCreated Event
Fired upon WebSocket creation.
- requestId
- Network.RequestId Request identifier.
- url
- String WebSocket request URL.
Code Example:
// WebInspector Event: Network.webSocketCreated
function onWebSocketCreated(res) {
// res = {requestId, url}
}
Network.webSocketClosed Event
Fired when WebSocket is closed.
- requestId
- Network.RequestId Request identifier.
- timestamp
- Network.Timestamp Timestamp.
Code Example:
// WebInspector Event: Network.webSocketClosed
function onWebSocketClosed(res) {
// res = {requestId, timestamp}
}
Network.webSocketFrameReceived Event
Fired when WebSocket frame is received.
- requestId
- Network.RequestId Request identifier.
- timestamp
- Network.Timestamp Timestamp.
- response
- Network.WebSocketFrame WebSocket response data.
Code Example:
// WebInspector Event: Network.webSocketFrameReceived
function onWebSocketFrameReceived(res) {
// res = {requestId, timestamp, response}
}
Network.webSocketFrameError Event
Fired when WebSocket frame error occurs.
- requestId
- Network.RequestId Request identifier.
- timestamp
- Network.Timestamp Timestamp.
- errorMessage
- String WebSocket frame error message.
Code Example:
// WebInspector Event: Network.webSocketFrameError
function onWebSocketFrameError(res) {
// res = {requestId, timestamp, errorMessage}
}
Network.webSocketFrameSent Event
Fired when WebSocket frame is sent.
- requestId
- Network.RequestId Request identifier.
- timestamp
- Network.Timestamp Timestamp.
- response
- Network.WebSocketFrame WebSocket response data.
Code Example:
// WebInspector Event: Network.webSocketFrameSent
function onWebSocketFrameSent(res) {
// res = {requestId, timestamp, response}
}
Page
Actions and events related to the inspected page belong to the page domain.
Type
Command
Event
Page.ResourceType Type
Resource type as it was perceived by the rendering engine.
- ( Document | Stylesheet | Image | Font | Script | XHR | WebSocket | Other )
Page.FrameId Type
Unique frame identifier.
- String
Page.Frame Type
Information about the Frame on the page.
- id
- String Frame unique identifier.
- parentId (optional)
- String Parent frame identifier.
- loaderId
- Network.LoaderId Identifier of the loader associated with this frame.
- name (optional)
- String Frame's name as specified in the tag.
- url
- String Frame document's URL.
- securityOrigin
- String Frame document's security origin.
- mimeType
- String Frame document's mimeType as determined by the browser.
Page.FrameResourceTree Type
Information about the Frame hierarchy along with their cached resources.
- frame
- Page.Frame Frame information for this tree item.
- childFrames (optional)
- [Page.FrameResourceTree] Child frames.
- resources
- [Object] Information about frame resources.
Page.SearchMatch Type
Search match for resource.
- lineNumber
- Number Line number in resource content.
- lineContent
- String Line with match content.
Page.SearchResult Type
Search result for resource.
- url
- String Resource URL.
- frameId
- Page.FrameId Resource frame id.
- matchesCount
- Number Number of matches in the resource content.
Page.Cookie Type
Cookie object
- name
- String Cookie name.
- value
- String Cookie value.
- domain
- String Cookie domain.
- path
- String Cookie path.
- expires
- Number Cookie expires.
- size
- Integer Cookie size.
- httpOnly
- Boolean True if cookie is http-only.
- secure
- Boolean True if cookie is secure.
- session
- Boolean True in case of session cookie.
Page.ScriptIdentifier Type
Unique script identifier.
- String
Page.NavigationEntry Type
Navigation history entry.
- id
- Integer Unique id of the navigation history entry.
- url
- String URL of the navigation history entry.
- title
- String Title of the navigation history entry.
Page.enable Command
Enables page domain notifications.
Code Example:
// WebInspector Command: Page.enable
Page.enable();
Page.disable Command
Disables page domain notifications.
Code Example:
// WebInspector Command: Page.disable
Page.disable();
Page.addScriptToEvaluateOnLoad Command
- scriptSource
- String
Callback Parameters:
- identifier
- Page.ScriptIdentifier Identifier of the added script.
Code Example:
// WebInspector Command: Page.addScriptToEvaluateOnLoad
Page.addScriptToEvaluateOnLoad(scriptSource, function callback(res) {
// res = {identifier}
});
Page.removeScriptToEvaluateOnLoad Command
- identifier
- Page.ScriptIdentifier
Code Example:
// WebInspector Command: Page.removeScriptToEvaluateOnLoad
Page.removeScriptToEvaluateOnLoad(identifier);
Page.reload Command
Reloads given page optionally ignoring the cache.
- ignoreCache (optional)
- Boolean If true, browser cache is ignored (as if the user pressed Shift+refresh).
- scriptToEvaluateOnLoad (optional)
- String If set, the script will be injected into all frames of the inspected page after reload.
- scriptPreprocessor (optional)
- String Script body that should evaluate to function that will preprocess all the scripts before their compilation.
Code Example:
// WebInspector Command: Page.reload
Page.reload(ignoreCache, scriptToEvaluateOnLoad, scriptPreprocessor);
Page.navigate Command
Navigates current page to the given URL.
- url
- String URL to navigate the page to.
Code Example:
// WebInspector Command: Page.navigate
Page.navigate(url);
Page.getNavigationHistory Command
Returns navigation history for the current page.
Callback Parameters:
- currentIndex
- Integer Index of the current navigation history entry.
- entries
- [Page.NavigationEntry] Array of navigation history entries.
Code Example:
// WebInspector Command: Page.getNavigationHistory
Page.getNavigationHistory(function callback(res) {
// res = {currentIndex, entries}
});
Page.navigateToHistoryEntry Command
Navigates current page to the given history entry.
- entryId
- Integer Unique id of the entry to navigate to.
Code Example:
// WebInspector Command: Page.navigateToHistoryEntry
Page.navigateToHistoryEntry(entryId);
Page.getCookies Command
Returns all browser cookies. Depending on the backend support, will either return detailed cookie information in the cookie
field or string cookie representation using cookieString
.
Callback Parameters:
- cookies
- [Page.Cookie] Array of cookie objects.
- cookiesString
- String document.cookie string representation of the cookies.
Code Example:
// WebInspector Command: Page.getCookies
Page.getCookies(function callback(res) {
// res = {cookies, cookiesString}
});
Page.deleteCookie Command
Deletes browser cookie with given name, domain and path.
- cookieName
- String Name of the cookie to remove.
- url
- String URL to match cooke domain and path.
Code Example:
// WebInspector Command: Page.deleteCookie
Page.deleteCookie(cookieName, url);
Page.getResourceTree Command
Returns present frame / resource tree structure.
Callback Parameters:
- frameTree
- Page.FrameResourceTree Present frame / resource tree structure.
Code Example:
// WebInspector Command: Page.getResourceTree
Page.getResourceTree(function callback(res) {
// res = {frameTree}
});
Page.getResourceContent Command
Returns content of the given resource.
- frameId
- Page.FrameId Frame id to get resource for.
- url
- String URL of the resource to get content for.
Callback Parameters:
- content
- String Resource content.
- base64Encoded
- Boolean True, if content was served as base64.
Code Example:
// WebInspector Command: Page.getResourceContent
Page.getResourceContent(frameId, url, function callback(res) {
// res = {content, base64Encoded}
});
Page.searchInResource Command
Searches for given string in resource content.
- frameId
- Page.FrameId Frame id for resource to search in.
- url
- String URL of the resource to search in.
- query
- String String to search for.
- caseSensitive (optional)
- Boolean If true, search is case sensitive.
- isRegex (optional)
- Boolean If true, treats string parameter as regex.
Callback Parameters:
- result
- [Page.SearchMatch] List of search matches.
Code Example:
// WebInspector Command: Page.searchInResource
Page.searchInResource(frameId, url, query, caseSensitive, isRegex, function callback(res) {
// res = {result}
});
Page.searchInResources Command
Searches for given string in frame / resource tree structure.
- text
- String String to search for.
- caseSensitive (optional)
- Boolean If true, search is case sensitive.
- isRegex (optional)
- Boolean If true, treats string parameter as regex.
Callback Parameters:
- result
- [Page.SearchResult] List of search results.
Code Example:
// WebInspector Command: Page.searchInResources
Page.searchInResources(text, caseSensitive, isRegex, function callback(res) {
// res = {result}
});
Page.setDocumentContent Command
Sets given markup as the document's HTML.
- frameId
- Page.FrameId Frame id to set HTML for.
- html
- String HTML content to set.
Code Example:
// WebInspector Command: Page.setDocumentContent
Page.setDocumentContent(frameId, html);
Page.setDeviceMetricsOverride Command
Overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results) and the font scale factor.
- width
- Integer Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
- height
- Integer Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
- fontScaleFactor
- Number Overriding font scale factor value (must be positive). 1 disables the override.
- fitWindow
- Boolean Whether a view that exceeds the available browser window area should be scaled down to fit.
Code Example:
// WebInspector Command: Page.setDeviceMetricsOverride
Page.setDeviceMetricsOverride(width, height, fontScaleFactor, fitWindow);
Page.setShowPaintRects Command
Requests that backend shows paint rectangles
- result
- Boolean True for showing paint rectangles
Code Example:
// WebInspector Command: Page.setShowPaintRects
Page.setShowPaintRects(result);
Page.setShowDebugBorders Command
Requests that backend shows debug borders on layers
- show
- Boolean True for showing debug borders
Code Example:
// WebInspector Command: Page.setShowDebugBorders
Page.setShowDebugBorders(show);
Page.setShowFPSCounter Command
Requests that backend shows the FPS counter
- show
- Boolean True for showing the FPS counter
Code Example:
// WebInspector Command: Page.setShowFPSCounter
Page.setShowFPSCounter(show);
Page.setContinuousPaintingEnabled Command
Requests that backend enables continuous painting
- enabled
- Boolean True for enabling cointinuous painting
Code Example:
// WebInspector Command: Page.setContinuousPaintingEnabled
Page.setContinuousPaintingEnabled(enabled);
Page.setShowScrollBottleneckRects Command
Requests that backend shows scroll bottleneck rects
- show
- Boolean True for showing scroll bottleneck rects
Code Example:
// WebInspector Command: Page.setShowScrollBottleneckRects
Page.setShowScrollBottleneckRects(show);
Page.getScriptExecutionStatus Command
Determines if scripts can be executed in the page.
Callback Parameters:
- result
- ( allowed | disabled | forbidden ) Script execution status: "allowed" if scripts can be executed, "disabled" if script execution has been disabled through page settings, "forbidden" if script execution for the given page is not possible for other reasons.
Code Example:
// WebInspector Command: Page.getScriptExecutionStatus
Page.getScriptExecutionStatus(function callback(res) {
// res = {result}
});
Page.setScriptExecutionDisabled Command
Switches script execution in the page.
- value
- Boolean Whether script execution should be disabled in the page.
Code Example:
// WebInspector Command: Page.setScriptExecutionDisabled
Page.setScriptExecutionDisabled(value);
Page.setGeolocationOverride Command
Overrides the Geolocation Position or Error.
- latitude (optional)
- Number Mock longitude
- longitude (optional)
- Number Mock latitude
- accuracy (optional)
- Number Mock accuracy
Code Example:
// WebInspector Command: Page.setGeolocationOverride
Page.setGeolocationOverride(latitude, longitude, accuracy);
Page.clearGeolocationOverride Command
Clears the overriden Geolocation Position and Error.
Code Example:
// WebInspector Command: Page.clearGeolocationOverride
Page.clearGeolocationOverride();
Page.setDeviceOrientationOverride Command
Overrides the Device Orientation.
- alpha
- Number Mock alpha
- beta
- Number Mock beta
- gamma
- Number Mock gamma
Code Example:
// WebInspector Command: Page.setDeviceOrientationOverride
Page.setDeviceOrientationOverride(alpha, beta, gamma);
Page.clearDeviceOrientationOverride Command
Clears the overridden Device Orientation.
Code Example:
// WebInspector Command: Page.clearDeviceOrientationOverride
Page.clearDeviceOrientationOverride();
Page.setTouchEmulationEnabled Command
Toggles mouse event-based touch event emulation.
- enabled
- Boolean Whether the touch event emulation should be enabled.
Code Example:
// WebInspector Command: Page.setTouchEmulationEnabled
Page.setTouchEmulationEnabled(enabled);
Page.setEmulatedMedia Command
Emulates the given media for CSS media queries.
- media
- String Media type to emulate. Empty string disables the override.
Code Example:
// WebInspector Command: Page.setEmulatedMedia
Page.setEmulatedMedia(media);
Page.captureScreenshot Command
Capture page screenshot.
- format (optional)
- ( jpeg | png ) Image compression format.
- quality (optional)
- Integer Compression quality from range [0..100].
- maxWidth (optional)
- Integer Maximum screenshot width.
- maxHeight (optional)
- Integer Maximum screenshot height.
Callback Parameters:
- data
- String Base64-encoded image data (PNG).
- deviceScaleFactor
- Number Device scale factor.
- pageScaleFactor
- Number Page scale factor.
- viewport
- DOM.Rect Viewport in CSS pixels.
Code Example:
// WebInspector Command: Page.captureScreenshot
Page.captureScreenshot(format, quality, maxWidth, maxHeight, function callback(res) {
// res = {data, deviceScaleFactor, pageScaleFactor, viewport}
});
Page.startScreencast Command
Starts sending each frame using the screencastFrame
event.
- format (optional)
- ( jpeg | png ) Image compression format.
- quality (optional)
- Integer Compression quality from range [0..100].
- maxWidth (optional)
- Integer Maximum screenshot width.
- maxHeight (optional)
- Integer Maximum screenshot height.
Code Example:
// WebInspector Command: Page.startScreencast
Page.startScreencast(format, quality, maxWidth, maxHeight);
Page.stopScreencast Command
Stops sending each frame in the screencastFrame
.
Code Example:
// WebInspector Command: Page.stopScreencast
Page.stopScreencast();
Page.handleJavaScriptDialog Command
Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
- accept
- Boolean Whether to accept or dismiss the dialog.
- promptText (optional)
- String The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.
Code Example:
// WebInspector Command: Page.handleJavaScriptDialog
Page.handleJavaScriptDialog(accept, promptText);
Page.setShowViewportSizeOnResize Command
Paints viewport size upon main frame resize.
- show
- Boolean Whether to paint size or not.
- showGrid (optional)
- Boolean Whether to paint grid as well.
Code Example:
// WebInspector Command: Page.setShowViewportSizeOnResize
Page.setShowViewportSizeOnResize(show, showGrid);
Page.setForceCompositingMode Command
Force accelerated compositing mode for inspected page.
- force
- Boolean Whether to force accelerated compositing or not.
Code Example:
// WebInspector Command: Page.setForceCompositingMode
Page.setForceCompositingMode(force);
Page.domContentEventFired Event
- timestamp
- Number
Code Example:
// WebInspector Event: Page.domContentEventFired
function onDomContentEventFired(res) {
// res = {timestamp}
}
Page.loadEventFired Event
- timestamp
- Number
Code Example:
// WebInspector Event: Page.loadEventFired
function onLoadEventFired(res) {
// res = {timestamp}
}
Page.frameAttached Event
Fired when frame has been attached to its parent.
- frameId
- Page.FrameId Id of the frame that has been attached.
Code Example:
// WebInspector Event: Page.frameAttached
function onFrameAttached(res) {
// res = {frameId}
}
Page.frameNavigated Event
Fired once navigation of the frame has completed. Frame is now associated with the new loader.
- frame
- Page.Frame Frame object.
Code Example:
// WebInspector Event: Page.frameNavigated
function onFrameNavigated(res) {
// res = {frame}
}
Page.frameDetached Event
Fired when frame has been detached from its parent.
- frameId
- Page.FrameId Id of the frame that has been detached.
Code Example:
// WebInspector Event: Page.frameDetached
function onFrameDetached(res) {
// res = {frameId}
}
Page.frameStartedLoading Event
Fired when frame has started loading.
- frameId
- Page.FrameId Id of the frame that has started loading.
Code Example:
// WebInspector Event: Page.frameStartedLoading
function onFrameStartedLoading(res) {
// res = {frameId}
}
Page.frameStoppedLoading Event
Fired when frame has stopped loading.
- frameId
- Page.FrameId Id of the frame that has stopped loading.
Code Example:
// WebInspector Event: Page.frameStoppedLoading
function onFrameStoppedLoading(res) {
// res = {frameId}
}
Page.frameScheduledNavigation Event
Fired when frame schedules a potential navigation.
- frameId
- Page.FrameId Id of the frame that has scheduled a navigation.
- delay
- Number Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start.
Code Example:
// WebInspector Event: Page.frameScheduledNavigation
function onFrameScheduledNavigation(res) {
// res = {frameId, delay}
}
Page.frameClearedScheduledNavigation Event
Fired when frame no longer has a scheduled navigation.
- frameId
- Page.FrameId Id of the frame that has cleared its scheduled navigation.
Code Example:
// WebInspector Event: Page.frameClearedScheduledNavigation
function onFrameClearedScheduledNavigation(res) {
// res = {frameId}
}
Page.javascriptDialogOpening Event
Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.
- message
- String Message that will be displayed by the dialog.
Code Example:
// WebInspector Event: Page.javascriptDialogOpening
function onJavascriptDialogOpening(res) {
// res = {message}
}
Page.javascriptDialogClosed Event
Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed.
Code Example:
// WebInspector Event: Page.javascriptDialogClosed
function onJavascriptDialogClosed(res) {
// res = {}
}
Page.scriptsEnabled Event
Fired when the JavaScript is enabled/disabled on the page
- isEnabled
- Boolean Whether script execution is enabled or disabled on the page.
Code Example:
// WebInspector Event: Page.scriptsEnabled
function onScriptsEnabled(res) {
// res = {isEnabled}
}
Page.screencastFrame Event
Compressed image data requested by the startScreencast
.
- data
- String Base64-encoded compressed image.
- deviceScaleFactor (optional)
- Number Device scale factor.
- pageScaleFactor (optional)
- Number Page scale factor.
- viewport (optional)
- DOM.Rect Viewport in CSS pixels.
- offsetTop (optional)
- Number Top offset in DIP.
- offsetBottom (optional)
- Number Bottom offset in DIP.
Code Example:
// WebInspector Event: Page.screencastFrame
function onScreencastFrame(res) {
// res = {data, deviceScaleFactor, pageScaleFactor, viewport, offsetTop, offsetBottom}
}
Page.screencastVisibilityChanged Event
Fired when the page with currently enabled screencast was shown or hidden .
- visible
- Boolean True if the page is visible.
Code Example:
// WebInspector Event: Page.screencastVisibilityChanged
function onScreencastVisibilityChanged(res) {
// res = {visible}
}
Runtime
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.
Type
Command
- Runtime.evaluate: Evaluates expression on global object.
- Runtime.callFunctionOn: Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
- Runtime.getProperties: Returns properties of a given object. Object group of the result is inherited from the target object.
- Runtime.releaseObject: Releases remote object with given id.
- Runtime.releaseObjectGroup: Releases all remote objects that belong to a given group.
- Runtime.run: Tells inspected instance(worker or page) that it can run in case it was started paused.
- 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.disable: Disables reporting of execution contexts creation.
Event
Runtime.RemoteObjectId Type
Unique object identifier.
- String
Runtime.RemoteObject Type
Mirror object referencing original JavaScript object.
- type
- ( object | function | undefined | string | number | boolean ) Object type.
- subtype (optional)
- ( array | null | node | regexp | date ) Object subtype hint. Specified for
object
type values only.
- className (optional)
- String Object class (constructor) name. Specified for
object
type values only.
- value (optional)
- Any Remote object value (in case of primitive values or JSON values if it was requested).
- description (optional)
- String String representation of the object.
- objectId (optional)
- Runtime.RemoteObjectId Unique object identifier (for non-primitive values).
- preview (optional)
- Runtime.ObjectPreview Preview containing abbreviated property values.
Runtime.ObjectPreview Type
Object containing abbreviated remote object value.
- lossless
- Boolean Determines whether preview is lossless (contains all information of the original object).
- overflow
- Boolean True iff some of the properties of the original did not fit.
- properties
- [Runtime.PropertyPreview] List of the properties.
Runtime.PropertyPreview Type
- name
- String Property name.
- type
- ( object | function | undefined | string | number | boolean ) Object type.
- value (optional)
- String User-friendly property value string.
- valuePreview (optional)
- Runtime.ObjectPreview Nested value preview.
- subtype (optional)
- ( array | null | node | regexp | date ) Object subtype hint. Specified for
object
type values only.
Runtime.PropertyDescriptor Type
Object property descriptor.
- name
- String Property name.
- value (optional)
- Runtime.RemoteObject The value associated with the property.
- writable (optional)
- Boolean True if the value associated with the property may be changed (data descriptors only).
- get (optional)
- Runtime.RemoteObject A function which serves as a getter for the property, or
undefined
if there is no getter (accessor descriptors only).
- set (optional)
- Runtime.RemoteObject 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 (optional)
- Boolean True if the result was thrown during the evaluation.
- isOwn (optional)
- Boolean True if the property is owned for the object.
Runtime.InternalPropertyDescriptor Type
Object internal property descriptor. This property isn't normally visible in JavaScript code.
- name
- String Conventional property name.
- value (optional)
- Runtime.RemoteObject The value associated with the property.
Runtime.CallArgument Type
Represents function call argument. Either remote object id objectId
or primitive value
or neither of (for undefined) them should be specified.
- value (optional)
- Any Primitive value.
- objectId (optional)
- Runtime.RemoteObjectId Remote object handle.
Runtime.ExecutionContextId Type
Id of an execution context.
- Integer
Runtime.ExecutionContextDescription Type
Description of an isolated world.
- id
- Runtime.ExecutionContextId Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed.
- isPageContext
- Boolean True if this is a context where inpspected web page scripts run. False if it is a content script isolated context.
- name
- String Human readable name describing given context.
- frameId
- Page.FrameId Id of the owning frame.
Runtime.evaluate Command
Evaluates expression on global object.
- expression
- String Expression to evaluate.
- objectGroup (optional)
- String Symbolic group name that can be used to release multiple objects.
- includeCommandLineAPI (optional)
- Boolean Determines whether Command Line API should be available during the evaluation.
- doNotPauseOnExceptionsAndMuteConsole (optional)
- Boolean Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.
- contextId (optional)
- Runtime.ExecutionContextId Specifies in which isolated context to perform evaluation. Each content script lives in an isolated context and this parameter may be used to specify one of those contexts. If the parameter is omitted or 0 the evaluation will be performed in the context of the inspected page.
- returnByValue (optional)
- Boolean Whether the result is expected to be a JSON object that should be sent by value.
- generatePreview (optional)
- Boolean Whether preview should be generated for the result.
Callback Parameters:
- result
- Runtime.RemoteObject Evaluation result.
- wasThrown (optional)
- Boolean True if the result was thrown during the evaluation.
Code Example:
// WebInspector Command: Runtime.evaluate
Runtime.evaluate(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, contextId, returnByValue, generatePreview, function callback(res) {
// res = {result, wasThrown}
});
Runtime.callFunctionOn Command
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
- objectId
- Runtime.RemoteObjectId Identifier of the object to call function on.
- functionDeclaration
- String Declaration of the function to call.
- arguments (optional)
- [Runtime.CallArgument] Call arguments. All call arguments must belong to the same JavaScript world as the target object.
- doNotPauseOnExceptionsAndMuteConsole (optional)
- Boolean Specifies whether function call should stop on exceptions and mute console. Overrides setPauseOnException state.
- returnByValue (optional)
- Boolean Whether the result is expected to be a JSON object which should be sent by value.
- generatePreview (optional)
- Boolean Whether preview should be generated for the result.
Callback Parameters:
- result
- Runtime.RemoteObject Call result.
- wasThrown (optional)
- Boolean True if the result was thrown during the evaluation.
Code Example:
// WebInspector Command: Runtime.callFunctionOn
Runtime.callFunctionOn(objectId, functionDeclaration, arguments, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, function callback(res) {
// res = {result, wasThrown}
});
Runtime.getProperties Command
Returns properties of a given object. Object group of the result is inherited from the target object.
- objectId
- Runtime.RemoteObjectId Identifier of the object to return properties for.
- ownProperties (optional)
- Boolean If true, returns properties belonging only to the element itself, not to its prototype chain.
- accessorPropertiesOnly (optional)
- Boolean If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
Callback Parameters:
- result
- [Runtime.PropertyDescriptor] Object properties.
- internalProperties (optional)
- [Runtime.InternalPropertyDescriptor] Internal object properties (only of the element itself).
Code Example:
// WebInspector Command: Runtime.getProperties
Runtime.getProperties(objectId, ownProperties, accessorPropertiesOnly, function callback(res) {
// res = {result, internalProperties}
});
Runtime.releaseObject Command
Releases remote object with given id.
- objectId
- Runtime.RemoteObjectId Identifier of the object to release.
Code Example:
// WebInspector Command: Runtime.releaseObject
Runtime.releaseObject(objectId);
Runtime.releaseObjectGroup Command
Releases all remote objects that belong to a given group.
- objectGroup
- String Symbolic object group name.
Code Example:
// WebInspector Command: Runtime.releaseObjectGroup
Runtime.releaseObjectGroup(objectGroup);
Runtime.run Command
Tells inspected instance(worker or page) that it can run in case it was started paused.
Code Example:
// WebInspector Command: Runtime.run
Runtime.run();
Runtime.enable Command
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.
Code Example:
// WebInspector Command: Runtime.enable
Runtime.enable();
Runtime.disable Command
Disables reporting of execution contexts creation.
Code Example:
// WebInspector Command: Runtime.disable
Runtime.disable();
Runtime.executionContextCreated Event
Issued when new execution context is created.
- context
- Runtime.ExecutionContextDescription A newly created execution contex.
Code Example:
// WebInspector Event: Runtime.executionContextCreated
function onExecutionContextCreated(res) {
// res = {context}
}
Timeline
Timeline provides its clients with instrumentation records that are generated during the page runtime. Timeline instrumentation can be started and stopped using corresponding commands. While timeline is started, it is generating timeline event records.
Type
Command
Event
Timeline.DOMCounters Type
Current values of DOM counters.
- documents
- Integer
- nodes
- Integer
- jsEventListeners
- Integer
Timeline.TimelineEvent Type
Timeline record contains information about the recorded activity.
- type
- String Event type.
- thread (optional)
- String If present, identifies the thread that produced the event.
- data
- Object Event data.
- children (optional)
- [Timeline.TimelineEvent] Nested records.
- counters (optional)
- Timeline.DOMCounters Current values of DOM counters.
- usedHeapSize (optional)
- Integer Current size of JS heap.
- nativeHeapStatistics (optional)
- Object Native heap statistics.
Timeline.enable Command
Enables timeline. After this call, timeline can be started from within the page (for example upon console.timeline).
Code Example:
// WebInspector Command: Timeline.enable
Timeline.enable();
Timeline.disable Command
Disables timeline.
Code Example:
// WebInspector Command: Timeline.disable
Timeline.disable();
Timeline.start Command
Starts capturing instrumentation events.
- maxCallStackDepth (optional)
- Integer Samples JavaScript stack traces up to
maxCallStackDepth
, defaults to 5.
- bufferEvents (optional)
- Boolean Whether instrumentation events should be buffered and returned upon
stop
call.
- includeDomCounters (optional)
- Boolean Whether DOM counters data should be included into timeline events.
- includeNativeMemoryStatistics (optional)
- Boolean Whether native memory usage statistics should be reported as part of timeline events.
Code Example:
// WebInspector Command: Timeline.start
Timeline.start(maxCallStackDepth, bufferEvents, includeDomCounters, includeNativeMemoryStatistics);
Timeline.stop Command
Stops capturing instrumentation events.
Callback Parameters:
- events (optional)
- [Timeline.TimelineEvent] Timeline event record data.
Code Example:
// WebInspector Command: Timeline.stop
Timeline.stop(function callback(res) {
// res = {events}
});
Timeline.eventRecorded Event
Fired for every instrumentation event while timeline is started.
- record
- Timeline.TimelineEvent Timeline event record data.
Code Example:
// WebInspector Event: Timeline.eventRecorded
function onEventRecorded(res) {
// res = {record}
}
Timeline.started Event
Fired when timeline is started.
- consoleTimeline (optional)
- Boolean If specified, identifies that timeline was started using console.timeline() call.
Code Example:
// WebInspector Event: Timeline.started
function onStarted(res) {
// res = {consoleTimeline}
}
Timeline.stopped Event
Fired when timeline is stopped.
- consoleTimeline (optional)
- Boolean If specified, identifies that timeline was started using console.timeline() call.
Code Example:
// WebInspector Event: Timeline.stopped
function onStopped(res) {
// res = {consoleTimeline}
}