Network Domain
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.
Methods
Events
- Network.dataReceived
- Network.loadingFailed
- Network.loadingFinished
- Network.requestWillBeSent
- Network.responseReceived
- Network.requestWillBeSentExtraInfo Experimental
Types
Methods
Network.disable #
Disables network tracking, prevents network events from being sent to the client.
Network.disable support is experimental.
Disable network debugging. Returns false
if not initially enabled.
@cdp Network.disable
Network.enable #
Enables network tracking, network events will now be delivered to the client.
Network.enable support is experimental.
Enable network debugging. Returns false
if already enabled.
@cdp Network.enable
Parameters
maxTotalBufferSize
Optional
integer
Buffer size in bytes to use when preserving network payloads (XHRs, etc).
maxResourceBufferSize
Optional
integer
Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
maxPostDataSize
Optional
integer
Longest post body size (in bytes) that would be included in requestWillBeSent notification
reportDirectSocketTraffic
Optional
boolean
Whether DirectSocket chunk send/receive events should be reported.
enableDurableMessages
Optional
boolean
Enable storing response bodies outside of renderer, so that these survive a cross-process navigation. Requires maxTotalBufferSize to be set. Currently defaults to false.
Network.getResponseBody #
Returns content served for the given request.
Network.getResponseBody support is experimental.
Parameters
requestId
Identifier of the network request to get content for.
Return object
body
string
Response body.
base64Encoded
boolean
True, if content was sent as base64.
Network.loadNetworkResource Experimental#
Fetches the resource and returns the content.
Parameters
frameId
Optional
Frame id to get the resource for. Mandatory for frame targets, and should be omitted for worker targets.
url
string
URL of the resource to get content for.
options
Options for the request.
Return object
resource
Events
Network.dataReceived #
Fired when data chunk was received over the network.
Network.dataReceived
Parameters
requestId
Request identifier.
timestamp
Timestamp.
dataLength
integer
Data chunk length.
encodedDataLength
integer
Actual bytes received (might be less than dataLength for compressed encodings).
data
Optional
string
Data that was received. (Encoded as a base64 string when passed over JSON)
Network.loadingFailed #
Fired when HTTP request has failed to load.
Network.loadingFailed
Parameters
requestId
Request identifier.
timestamp
Timestamp.
type
Resource type.
errorText
string
Error message. List of network errors: https://cs.chromium.org/chromium/src/net/base/net_error_list.h
canceled
Optional
boolean
True if loading was canceled.
blockedReason
Optional
The reason why loading was blocked, if any.
corsErrorStatus
Optional
The reason why loading was blocked by CORS, if any.
Network.loadingFinished #
Fired when HTTP request has finished loading.
Network.loadingFinished
Parameters
requestId
Request identifier.
timestamp
Timestamp.
encodedDataLength
number
Total number of bytes received for this request.
Network.requestWillBeSent #
Fired when page is about to send HTTP request.
Network.requestWillBeSent
Parameters
requestId
Request identifier.
loaderId
Loader identifier. Empty string if the request is fetched from worker.
documentURL
string
URL of the document this request is loaded for.
request
Request data.
timestamp
Timestamp.
wallTime
Timestamp.
initiator
Request initiator.
redirectHasExtraInfo
boolean
In the case that redirectResponse is populated, this flag indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for the request which was just redirected.
redirectResponse
Optional
Redirect response data.
type
Optional
Type of this resource.
frameId
Optional
Frame identifier.
hasUserGesture
Optional
boolean
Whether the request is initiated by a user gesture. Defaults to false.
Network.responseReceived #
Fired when HTTP response is available.
Network.responseReceived
Parameters
requestId
Request identifier.
loaderId
Loader identifier. Empty string if the request is fetched from worker.
timestamp
Timestamp.
type
Resource type.
response
Response data.
hasExtraInfo
boolean
Indicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for this request.
frameId
Optional
Frame identifier.
Network.requestWillBeSentExtraInfo Experimental#
Fired when additional information about a requestWillBeSent event is available from the network stack. Not every requestWillBeSent event will have an additional requestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent or requestWillBeSentExtraInfo will be fired first for the same request.
Network.requestWillBeSentExtraInfo
Parameters
requestId
Request identifier. Used to match this information to an existing requestWillBeSent event.
associatedCookies
array[ AssociatedCookie ]
A list of cookies potentially associated to the requested URL. This includes both cookies sent with the request and the ones not sent; the latter are distinguished by having blockedReasons field set.
headers
Raw request headers as they will be sent over the wire.
connectTiming
clientSecurityState
Optional
The client security state set for the request.
siteHasCookieInOtherPartition
Optional
boolean
Whether the site has partitioned cookies stored in a partition different than the current one.
Types
Network.RequestId #
Unique network request identifier. Note that this does not identify individual HTTP requests that are part of a network request.
Type: string