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
maxTotalBufferSizeOptional
integerBuffer size in bytes to use when preserving network payloads (XHRs, etc).
maxResourceBufferSizeOptional
integerPer-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
maxPostDataSizeOptional
integerLongest post body size (in bytes) that would be included in requestWillBeSent notification
reportDirectSocketTrafficOptional
booleanWhether DirectSocket chunk send/receive events should be reported.
enableDurableMessagesOptional
booleanEnable 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 stringResponse body.
base64Encoded booleanTrue, if content was sent as base64.
Network.loadNetworkResource Experimental#
Fetches the resource and returns the content.
Parameters
frameIdOptional
Frame id to get the resource for. Mandatory for frame targets, and should be omitted for worker targets.
url stringURL 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 integerData chunk length.
encodedDataLength integerActual bytes received (might be less than dataLength for compressed encodings).
dataOptional
stringData 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 stringError message. List of network errors: https://cs.chromium.org/chromium/src/net/base/net_error_list.h
canceledOptional
booleanTrue if loading was canceled.
blockedReasonOptional
The reason why loading was blocked, if any.
corsErrorStatusOptional
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 numberTotal 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 stringURL of the document this request is loaded for.
request Request data.
timestamp Timestamp.
wallTime Timestamp.
initiator Request initiator.
redirectHasExtraInfo booleanIn 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.
redirectResponseOptional
Redirect response data.
typeOptional
Type of this resource.
frameIdOptional
Frame identifier.
hasUserGestureOptional
booleanWhether 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 booleanIndicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for this request.
frameIdOptional
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 clientSecurityStateOptional
The client security state set for the request.
siteHasCookieInOtherPartitionOptional
booleanWhether 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