tot: 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.

Commands

Network.canClearBrowserCache

request: {
"id": <number>,
"method": "Network.canClearBrowserCache"
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "result": <boolean>
}
}

Tells whether clearing browser cache is supported.

Returns

result
( boolean )
True if browser cache can be cleared.

Network.canClearBrowserCookies

request: {
"id": <number>,
"method": "Network.canClearBrowserCookies"
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "result": <boolean>
}
}

Tells whether clearing browser cookies is supported.

Returns

result
( boolean )
True if browser cookies can be cleared.

Network.clearBrowserCache

request: {
"id": <number>,
"method": "Network.clearBrowserCache"
}
response: {
"id": <number>,
"error": <object>
}

Clears browser cache.

Network.clearBrowserCookies

request: {
"id": <number>,
"method": "Network.clearBrowserCookies"
}
response: {
"id": <number>,
"error": <object>
}

Clears browser cookies.

Network.disable

request: {
"id": <number>,
"method": "Network.disable"
}
response: {
"id": <number>,
"error": <object>
}

Disables network tracking, prevents network events from being sent to the client.

Network.enable

request: {
"id": <number>,
"method": "Network.enable"
}
response: {
"id": <number>,
"error": <object>
}

Enables network tracking, network events will now be delivered to the client.

Network.getResponseBody

request: {
"id": <number>,
"method": "Network.getResponseBody",
"params": {
  "requestId": <RequestId>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
  "body": <string>,
  "base64Encoded": <boolean>
}
}

Returns content served for the given request.

Parameters

requestId
( RequestId )
Identifier of the network request to get content for.

Returns

body
( string )
Response body.
base64Encoded
( boolean )
True, if content was sent as base64.

Network.setCacheDisabled

request: {
"id": <number>,
"method": "Network.setCacheDisabled",
"params": {
  "cacheDisabled": <boolean>
}
}
response: {
"id": <number>,
"error": <object>
}

Toggles ignoring cache for each request. If true, cache will not be used.

Parameters

cacheDisabled
( boolean )
Cache disabled state.

Network.setExtraHTTPHeaders

request: {
"id": <number>,
"method": "Network.setExtraHTTPHeaders",
"params": {
  "headers": <Headers>
}
}
response: {
"id": <number>,
"error": <object>
}

Specifies whether to always send extra HTTP headers with the requests from this page.

Parameters

headers
( Headers )
Map with extra HTTP headers.

Network.setUserAgentOverride

request: {
"id": <number>,
"method": "Network.setUserAgentOverride",
"params": {
  "userAgent": <string>
}
}
response: {
"id": <number>,
"error": <object>
}

Allows overriding user agent with the given string.

Parameters

userAgent
( string )
User agent to use.

Notifications

Network.dataReceived

{
"method": "Network.dataReceived",
"params": {
  "requestId": <RequestId>,
  "timestamp": <Timestamp>,
  "dataLength": <integer>,
  "encodedDataLength": <integer>
}
}

Fired when data chunk was received over the network.

Parameters

requestId
( RequestId )
Request identifier.
timestamp
( Timestamp )
Timestamp.
dataLength
( integer )
Data chunk length.
encodedDataLength
( integer )
Actual bytes received (might be less than dataLength for compressed encodings).

Network.loadingFailed

{
"method": "Network.loadingFailed",
"params": {
  "requestId": <RequestId>,
  "timestamp": <Timestamp>,
  "errorText": <string>,
  "canceled": <boolean>
}
}

Fired when HTTP request has failed to load.

Parameters

requestId
( RequestId )
Request identifier.
timestamp
( Timestamp )
Timestamp.
errorText
( string )
User friendly error message.
canceled
( optional boolean )
True if loading was canceled.

Network.loadingFinished

{
"method": "Network.loadingFinished",
"params": {
  "requestId": <RequestId>,
  "timestamp": <Timestamp>
}
}

Fired when HTTP request has finished loading.

Parameters

requestId
( RequestId )
Request identifier.
timestamp
( Timestamp )
Timestamp.

Network.requestServedFromCache

{
"method": "Network.requestServedFromCache",
"params": {
  "requestId": <RequestId>
}
}

Fired if request ended up loading from cache.

Parameters

requestId
( RequestId )
Request identifier.

Network.requestWillBeSent

{
"method": "Network.requestWillBeSent",
"params": {
  "requestId": <RequestId>,
  "loaderId": <LoaderId>,
  "documentURL": <string>,
  "request": <Request>,
  "timestamp": <Timestamp>,
  "initiator": <Initiator>,
  "redirectResponse": <Response>
}
}

Fired when page is about to send HTTP request.

Parameters

requestId
( RequestId )
Request identifier.
loaderId
( LoaderId )
Loader identifier.
documentURL
( string )
URL of the document this request is loaded for.
request
( Request )
Request data.
timestamp
( Timestamp )
Timestamp.
initiator
( Initiator )
Request initiator.
redirectResponse
( optional Response )
Redirect response data.

Network.responseReceived

{
"method": "Network.responseReceived",
"params": {
  "requestId": <RequestId>,
  "loaderId": <LoaderId>,
  "timestamp": <Timestamp>,
  "type": <Page.ResourceType>,
  "response": <Response>
}
}

Fired when HTTP response is available.

Parameters

requestId
( RequestId )
Request identifier.
loaderId
( LoaderId )
Loader identifier.
timestamp
( Timestamp )
Timestamp.
type
Resource type.
response
( Response )
Response data.

Types

CachedResource: object

bodySize
( number )
Cached response body size.
response
( optional Response )
Cached response data.
type
Type of this resource.
url
( string )
Resource URL. This is the url of the original network request.

Headers: object

Initiator: object

lineNumber
( optional number )
Initiator line number, set for Parser type only.
stackTrace
( optional Console.StackTrace )
Initiator JavaScript stack trace, set for Script only.
type
( enumerated string [ "other" , "parser" , "script" ] )
Type of this initiator.
url
( optional string )
Initiator URL, set for Parser type only.

LoaderId: string

Request: object

headers
( Headers )
HTTP request headers.
method
( string )
HTTP request method.
postData
( optional string )
HTTP POST request data.
url
( string )
Request URL.

RequestId: string

ResourceTiming: object

connectEnd
( number )
Connected to the remote host.
connectStart
( number )
Started connecting to the remote host.
dnsEnd
( number )
Finished DNS address resolve.
dnsStart
( number )
Started DNS address resolve.
proxyEnd
( number )
Finished resolving proxy.
proxyStart
( number )
Started resolving proxy.
receiveHeadersEnd
( number )
Finished receiving response headers.
requestTime
( number )
Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime.
sendEnd
( number )
Finished sending request.
sendStart
( number )
Started sending request.
sslEnd
( number )
Finished SSL handshake.
sslStart
( number )
Started SSL handshake.

Response: object

connectionId
( number )
Physical connection id that was actually used for this request.
connectionReused
( boolean )
Specifies whether physical connection was actually reused for this request.
fromDiskCache
( optional boolean )
Specifies that the request was served from the disk cache.
headers
( Headers )
HTTP response headers.
headersText
( optional string )
HTTP response headers text.
mimeType
( string )
Resource mimeType as determined by the browser.
requestHeaders
( optional Headers )
Refined HTTP request headers that were actually transmitted over the network.
requestHeadersText
( optional string )
HTTP request headers text.
status
( number )
HTTP response status code.
statusText
( string )
HTTP response status text.
timing
( optional ResourceTiming )
Timing information for the given request.
url
( string )
Response URL. This URL can be different from CachedResource.url in case of redirect.

Timestamp: number