Network
网络域允许追踪页面的网络活动。它暴露了关于http、文件、数据及其他请求和响应的信息,包括它们的头部、主体、时间等。
EN
✅️️ Methods
🔨Network.clearBrowserCache
清除浏览器缓存。
EN
🔨Network.clearBrowserCookies
清除浏览器Cookie。
EN
🔨Network.deleteCookies
删除具有匹配名称和URL或域名/路径/分区键对的浏览器Cookie。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | 要移除的Cookie的名称。 | ENName of the cookies to remove. | |
| url | string | 如果指定,将删除所有具有给定名称且域名和路径与提供的URL匹配的cookie。 | ENIf specified, deletes all the cookies with the given name where domain and path match provided URL. | ||
| domain | string | 如果指定,仅删除具有确切域名的Cookie。 | ENIf specified, deletes only cookies with the exact domain. | ||
| path | string | 如果指定,仅删除路径完全匹配的''和``内的内容的cookie。 | ENIf specified, deletes only cookies with the exact path. | ||
| partitionKey | 🧪 | CookiePartitionKey | 如果指定,仅删除具有给定名称 和分区键的Cookie,其中所有分区键属性均与Cookie分区键属性匹配。 | ENIf specified, deletes only cookies with the the given name and partitionKey where all partition key attributes match the cookie partition key attribute. |
🔨Network.disable
禁用网络跟踪,防止网络事件被发送到客户端。
EN
🔨Network.enable
启用网络追踪功能,网络事件现在将发送给客户端。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| maxTotalBufferSize | 🧪 | integer | 保留网络负载(XHR等)时使用的缓冲区大小(以字节为单位)。这是此DevTools会话将收集的最大字节数。 | ENBuffer size in bytes to use when preserving network payloads (XHRs, etc). This is the maximum number of bytes that will be collected by this DevTools session. | |
| maxResourceBufferSize | 🧪 | integer | 每个资源的缓冲区大小(以字节为单位),用于保存网络负载(XHR等)。 | ENPer-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). | |
| maxPostDataSize | integer | 请求将发送通知中包含的最长帖子正文大小(以字节为单位) | ENLongest post body size (in bytes) that would be included in requestWillBeSent notification | ||
| reportDirectSocketTraffic | 🧪 | boolean | 是否应报告DirectSocket分块发送/接收事件。 | ENWhether DirectSocket chunk send/receive events should be reported. | |
| enableDurableMessages | 🧪 | boolean | 启用将响应体存储在渲染器外部,以便这些响应体能在跨进程导航中保留。需要设置maxTotalBufferSize。当前默认值为false。由于在发出Runtime.runIfWaitingForDebugger之前等待Network.enable可能导致死锁,该字段正在被弃用,转而支持专用的configureDurableMessages命令。 | ENEnable storing response bodies outside of renderer, so that these survive a cross-process navigation. Requires maxTotalBufferSize to be set. Currently defaults to false. This field is being deprecated in favor of the dedicated configureDurableMessages command, due to the possibility of deadlocks when awaiting Network.enable before issuing Runtime.runIfWaitingForDebugger. |
🔨Network.getCookies
返回当前URL的所有浏览器Cookie。根据后端支持情况,将在cookies字段中返回详细的Cookie信息。
EN
cookies field.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| urls | array[string] | 将获取适用Cookie的URL列表。如果未指定,则假定设置为包含页面及其所有子框架URL的列表。 | ENThe list of URLs for which applicable cookies will be fetched. If not specified, it's assumed to be set to the list containing the URLs of the page and all of its subframes. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| cookies | array[Cookie] | Cookie对象数组。 | ENArray of cookie objects. |
🔨Network.getRequestPostData
返回随请求发送的发布数据。当请求未附带数据时,将返回错误。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 获取内容的网络请求标识符。 | ENIdentifier of the network request to get content for. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| postData | string | 请求体字符串,省略多部分请求中的文件 | ENRequest body string, omitting files from multipart requests |
| base64Encoded | boolean | 是的,如果内容是以base64格式发送的。 | ENTrue, if content was sent as base64. |
🔨Network.getResponseBody
返回为给定请求提供的内容。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 获取内容的网络请求标识符。 | ENIdentifier of the network request to get content for. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| body | string | 响应正文。 | ENResponse body. |
| base64Encoded | boolean | 是的,如果内容是以 base64 格式发送的。 | ENTrue, if content was sent as base64. |
🔨Network.setBypassServiceWorker
切换是否忽略每个请求的服务工作者。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| bypass | ✔️ | boolean | 绕过服务工作者并从网络加载。 | ENBypass service worker and load from network. |
🔨Network.setCacheDisabled
切换是否忽略每个请求的缓存。如果为true,则不会使用缓存。
EN
true, cache will not be used.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| cacheDisabled | ✔️ | boolean | 缓存禁用状态。 | ENCache disabled state. |
🔨Network.setCookie
使用给定的cookie数据设置一个cookie;如果存在等效的cookie,可能会覆盖它们。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | Cookie name. | ENCookie name. | |
| value | ✔️ | string | Cookie值。 | ENCookie value. | |
| url | string | 与cookie设置相关联的请求URI。该值会影响所创建cookie的默认域名、路径、源端口和源方案值。 | ENThe request-URI to associate with the setting of the cookie. This value can affect the default domain, path, source port, and source scheme values of the created cookie. | ||
| domain | string | Cookie domain. | ENCookie domain. | ||
| path | string | Cookie 路径。 | ENCookie path. | ||
| secure | boolean | 如果 cookie 是安全的,则为 True。 | ENTrue if cookie is secure. | ||
| httpOnly | boolean | 如果 cookie 是 http-only,则为 True。 | ENTrue if cookie is http-only. | ||
| sameSite | CookieSameSite | Cookie SameSite 类型。 | ENCookie SameSite type. | ||
| expires | TimeSinceEpoch | Cookie 过期日期,如果未设置则为会话 Cookie | ENCookie expiration date, session cookie if not set | ||
| priority | 🧪 | CookiePriority | Cookie 优先级类型。 | ENCookie Priority type. | |
| sourceScheme | 🧪 | CookieSourceScheme | Cookie 来源方案类型。 | ENCookie source scheme type. | |
| sourcePort | 🧪 | integer | Cookie 源端口。有效值为 {-1, [1, 65535]},-1 表示未指定端口。未指定的端口值允许协议客户端模拟旧版 Cookie 的端口作用域。这是一个临时功能,未来将被移除。 | ENCookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. This is a temporary ability and it will be removed in the future. | |
| partitionKey | 🧪 | CookiePartitionKey | Cookie partition key。如果未设置,cookie将被设置为未分区。 | ENCookie partition key. If not set, the cookie will be set as not partitioned. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| success | boolean | 始终设置为true。如果发生错误,响应将指示协议错误。 | ENAlways set to true. If an error occurs, the response indicates protocol error. |
🔨Network.setCookies
设置给定的cookies。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| cookies | ✔️ | array[CookieParam] | 要设置的Cookies。 | ENCookies to be set. |
🔨Network.setExtraHTTPHeaders
指定是否始终随此页面的请求发送额外的HTTP头。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| headers | ✔️ | Headers | 包含额外HTTP头部的映射。 | ENMap with extra HTTP headers. |
🔨Network.setUserAgentOverride
允许使用给定的字符串覆盖用户代理。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| userAgent | ✔️ | string | 要使用的用户代理。 | ENUser agent to use. | |
| acceptLanguage | string | 要模拟的浏览器语言。 | ENBrowser language to emulate. | ||
| platform | string | 平台 navigator.platform 应该返回。 | ENThe platform navigator.platform should return. | ||
| userAgentMetadata | 🧪 | Emulation.UserAgentMetadata | 在Sec-CH-UA-*头部中发送,并在navigator.userAgentData中返回 | ENTo be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData |
🔨Network.canClearBrowserCache❌️
指示是否支持清除浏览器缓存。
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| result | boolean | 如果浏览器缓存可以被清除,则为真。 | ENTrue if browser cache can be cleared. |
🔨Network.canClearBrowserCookies❌️
指示是否支持清除浏览器Cookie。
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| result | boolean | 如果浏览器cookie可以被清除,则为True。 | ENTrue if browser cookies can be cleared. |
🔨Network.canEmulateNetworkConditions❌️
判断是否支持网络条件模拟。
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| result | boolean | 如果支持网络条件模拟,则为真。 | ENTrue if emulation of network conditions is supported. |
🔨Network.emulateNetworkConditions❌️
激活网络条件模拟。此命令已弃用,推荐使用 emulateNetworkConditionsByRule 和 overrideNetworkState 命令,两者结合使用可达到相同效果。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| offline | ✔️ | boolean | 模拟网络断开的真实情况。 | ENTrue to emulate internet disconnection. | |
| latency | ✔️ | number | 从请求发送到响应头接收的最小延迟(毫秒)。 | ENMinimum latency from request sent to response headers received (ms). | |
| downloadThroughput | ✔️ | number | 最大聚合下载吞吐量(字节/秒)。-1 表示禁用下载限流。 | ENMaximal aggregated download throughput (bytes/sec). -1 disables download throttling. | |
| uploadThroughput | ✔️ | number | 最大聚合上传吞吐量(字节/秒)。-1 表示禁用上传限流。 | ENMaximal aggregated upload throughput (bytes/sec). -1 disables upload throttling. | |
| connectionType | ConnectionType | 如果已知,连接类型。 | ENConnection type if known. | ||
| packetLoss | 🧪 | number | WebRTC 数据包丢失率(百分比,0-100)。0 表示禁用数据包丢失模拟,100 表示丢弃所有数据包。 | ENWebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets. | |
| packetQueueLength | 🧪 | integer | WebRTC 数据包队列长度(数据包)。0 表示移除任何队列长度限制。 | ENWebRTC packet queue length (packet). 0 removes any queue length limitations. | |
| packetReordering | 🧪 | boolean | WebRTC packetReordering 功能。 | ENWebRTC packetReordering feature. |
🔨Network.getAllCookies❌️
返回所有浏览器Cookie。根据后端支持情况,将在cookies字段中返回详细的Cookie信息。已弃用。请改用Storage.getCookies。
EN
cookies field. Deprecated. Use Storage.getCookies instead.| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| cookies | array[Cookie] | Cookie 对象数组。 | ENArray of cookie objects. |
🔨Network.clearAcceptedEncodingsOverride🧪
清除由 setAcceptedEncodings 设置的已接受编码
EN
🔨Network.configureDurableMessages🧪
配置将响应体存储在渲染器外部,使其在跨进程导航中得以保留。如果未设置 maxTotalBufferSize,则禁用持久消息。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| maxTotalBufferSize | integer | 保留网络负载(XHR等)时使用的缓冲区大小(以字节为单位)。 | ENBuffer size in bytes to use when preserving network payloads (XHRs, etc). | ||
| maxResourceBufferSize | integer | 当保留网络负载(XHR等)时,每个资源使用的缓冲区大小(以字节为单位)。 | ENPer-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). |
🔨Network.emulateNetworkConditionsByRule🧪
使用URL匹配模式为单个请求激活网络条件模拟。与已弃用的Network.emulateNetworkConditions不同,此方法不会影响navigator状态。如需显式修改navigator行为,请使用Network.overrideNetworkState。
EN
navigator state. Use Network.overrideNetworkState to explicitly modify navigator behavior.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| offline | ✔️ | boolean | True to emulate internet disconnection. | ENTrue to emulate internet disconnection. | |
| matchedNetworkConditions | ✔️ | array[NetworkConditions] | 配置请求匹配条件。如果多个条目匹配一个请求,则第一个条目生效。通过将条件的 urlPattern 留空,可以配置全局条件。这些全局条件也适用于 P2P 连接的节流控制。 | ENConfigure conditions for matching requests. If multiple entries match a request, the first entry wins. Global conditions can be configured by leaving the urlPattern for the conditions empty. These global conditions are also applied for throttling of p2p connections. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| ruleIds | array[string] | 每个匹配网络条件条目的唯一标识符。该标识符将包含在受规则影响的请求的requestWillBeSentExtraInfo中。 | ENAn id for each entry in matchedNetworkConditions. The id will be included in the requestWillBeSentExtraInfo for requests affected by a rule. |
🔨Network.enableDeviceBoundSessions🧪
设置跟踪设备绑定的 会话并获取初始会话集。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| enable | ✔️ | boolean | 是否启用或禁用事件。 | ENWhether to enable or disable events. |
🔨Network.enableReportingApi🧪
启用Reporting API的跟踪功能,现在Reporting API生成的事件将被发送到客户端。启用此功能会为所有现有报告触发'reportingApiReportAdded'事件。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| enable | ✔️ | boolean | 是否启用或禁用Reporting API的事件 | ENWhether to enable or disable events for the Reporting API |
🔨Network.fetchSchemefulSite🧪
获取特定来源的''schemeful site''。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| origin | ✔️ | string | URL 来源。 | ENThe URL origin. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| schemefulSite | string | 对应的schemeful site。 | ENThe corresponding schemeful site. |
🔨Network.getCertificate🧪
返回DER编码的证书。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| origin | ✔️ | string | 获取证书的来源。 | ENOrigin to get certificate for. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| tableNames | array[string] |
🔨Network.getResponseBodyForInterception🧪
返回为当前被拦截请求提供的内容。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| interceptionId | ✔️ | InterceptionId | 获取请求正文的拦截请求标识符。 | ENIdentifier for the intercepted request to get body for. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| body | string | 响应正文。 | ENResponse body. |
| base64Encoded | boolean | 是的,如果内容是以base64格式发送的。 | ENTrue, if content was sent as base64. |
🔨Network.getSecurityIsolationStatus🧪
返回有关COEP/COOP隔离状态的信息。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | Page.FrameId | 如果未提供frameId,则提供目标的状态。 | ENIf no frameId is provided, the status of the target is provided. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| status | SecurityIsolationStatus |
🔨Network.loadNetworkResource🧪
获取资源并返回内容。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | Page.FrameId | 获取资源的框架ID。对于框架目标是必需的,对于工作线程目标则应省略。 | ENFrame id to get the resource for. Mandatory for frame targets, and should be omitted for worker targets. | ||
| url | ✔️ | string | 获取内容的资源URL。 | ENURL of the resource to get content for. | |
| options | ✔️ | LoadNetworkResourceOptions | 请求的选项。 | ENOptions for the request. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| resource | LoadNetworkResourcePageResult |
🔨Network.overrideNetworkState🧪
覆盖 ''navigator.onLine'' 和 ''navigator.connection'' 的状态。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| offline | ✔️ | boolean | True to emulate internet disconnection. | ENTrue to emulate internet disconnection. | |
| latency | ✔️ | number | 从请求发送到响应头接收的最小延迟(毫秒)。 | ENMinimum latency from request sent to response headers received (ms). | |
| downloadThroughput | ✔️ | number | 最大聚合下载吞吐量(字节/秒)。-1 表示禁用下载限流。 | ENMaximal aggregated download throughput (bytes/sec). -1 disables download throttling. | |
| uploadThroughput | ✔️ | number | 最大聚合上传吞吐量(字节/秒)。-1 表示禁用上传限流。 | ENMaximal aggregated upload throughput (bytes/sec). -1 disables upload throttling. | |
| connectionType | ConnectionType | 如果已知,连接类型。 | ENConnection type if known. |
🔨Network.replayXHR🧪
此方法发送一个与原始请求完全相同的新XMLHttpRequest。以下参数应保持一致:method、url、async、request body、extra headers、withCredentials attribute、user、password。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 重放XHR的标识符。 | ENIdentifier of XHR to replay. |
🔨Network.searchInResponseBody🧪
在响应内容中搜索指定字符串。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 搜索网络响应的标识符。 | ENIdentifier of the network response to search. | |
| query | ✔️ | string | 要搜索的字符串。 | ENString to search for. | |
| caseSensitive | boolean | 如果为真,则搜索区分大小写。 | ENIf true, search is case sensitive. | ||
| isRegex | boolean | 如果为真,则将字符串参数视为正则表达式。 | ENIf true, treats string parameter as regex. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| result | array[Debugger.SearchMatch] | 搜索结果列表。 | ENList of search matches. |
🔨Network.setAcceptedEncodings🧪
设置一个将被接受的内容编码列表。空列表意味着不接受任何编码。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| encodings | ✔️ | array[ContentEncoding] | 接受的编码格式列表。 | ENList of accepted content encodings. |
🔨Network.setAttachDebugStack🧪
指定是否在请求中附加页面脚本堆栈ID
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| enabled | ✔️ | boolean | 是否附加页面脚本堆栈以用于调试目的。 | ENWhether to attach a page script stack for debugging purpose. |
🔨Network.setBlockedURLs🧪
阻止来自加载的URL。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| urlPatterns | array[BlockPattern] | 按照给定的顺序匹配模式。这些模式也优先于 urls 中定义的任何通配符模式。 | ENPatterns to match in the order in which they are given. These patterns also take precedence over any wildcard patterns defined inurls. | ||
| urls | ❌️ | array[string] | 要屏蔽的URL模式。允许使用通配符('*')。 | ENURL patterns to block. Wildcards ('*') are allowed. |
🔨Network.setCookieControls🧪
设置第三方 Cookie 访问控制''需要刷新页面才能观察到新的 Cookie 行为``
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| enableThirdPartyCookieRestriction | ✔️ | boolean | 是否启用了第三方Cookie限制。 | ENWhether 3pc restriction is enabled. | |
| disableThirdPartyCookieMetadata | ✔️ | boolean | 是否应启用第三方Cookie宽限期例外;默认情况下为false。 | ENWhether 3pc grace period exception should be enabled; false by default. | |
| disableThirdPartyCookieHeuristics | ✔️ | boolean | 是否应启用第三方Cookie启发式例外;默认情况下为false。 | ENWhether 3pc heuristics exceptions should be enabled; false by default. |
🔨Network.streamResourceContent🧪
启用对给定请求ID(requestId)的响应流式传输。如果启用,dataReceived事件将包含流式传输期间接收到的数据。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 要流式传输的请求标识符。 | ENIdentifier of the request to stream. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| bufferedData | string | 在流式传输启用前已缓冲的数据。(通过JSON传递时编码为base64字符串) | ENData that has been buffered until streaming is enabled. (Encoded as a base64 string when passed over JSON) |
🔨Network.takeResponseBodyForInterceptionAsStream🧪
返回表示响应体的流的一个句柄。请注意,在此命令之后,被拦截的请求不能按原样继续——您需要取消它或提供响应体。该流仅支持顺序读取,如果指定了位置,IO.read 将会失败。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| interceptionId | ✔️ | InterceptionId |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| stream | IO.StreamHandle |
🔨Network.continueInterceptedRequest🧪❌️
对Network.requestIntercepted的响应,该响应要么修改请求以继续执行任何修改,要么阻止它,要么使用提供的响应字节完成它。如果因此发生网络获取并遇到重定向,将发送一个额外的Network.requestIntercepted事件,并带有相同的InterceptionId。已弃用,请改用Fetch.continueRequest、Fetch.fulfillRequest和Fetch.failRequest。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| interceptionId | ✔️ | InterceptionId | |||
| errorReason | ErrorReason | 如果设置此项,将导致请求因给定原因而失败。对于标记为 isNavigationRequest 的请求,传递 Aborted 也会取消导航。不得在响应 authChallenge 时设置。 | ENIf set this causes the request to fail with the given reason. PassingAborted for requests marked with isNavigationRequest also cancels the navigation. Must not be set in response to an authChallenge. | ||
| rawResponse | string | 如果设置,请求将使用提供的base64编码原始响应(包含HTTP状态行和头部信息等)完成。不得在响应authChallenge时设置此选项。(通过JSON传递时编码为base64字符串) | ENIf set the requests completes using with the provided base64 encoded raw response, including HTTP status line and headers etc... Must not be set in response to an authChallenge. (Encoded as a base64 string when passed over JSON) | ||
| url | string | 如果设置了该选项,请求的URL将被修改,且这种修改对页面不可见。不得在响应authChallenge时设置。 | ENIf set the request url will be modified in a way that's not observable by page. Must not be set in response to an authChallenge. | ||
| method | string | 如果设置此选项,将允许覆盖请求方法。不得在响应身份验证质询时设置。 | ENIf set this allows the request method to be overridden. Must not be set in response to an authChallenge. | ||
| postData | string | 如果设置此项,将允许设置 postData。在响应 authChallenge 时不得设置。 | ENIf set this allows postData to be set. Must not be set in response to an authChallenge. | ||
| headers | Headers | 如果设置此选项,允许更改请求头。在响应身份验证挑战时不得设置。 | ENIf set this allows the request headers to be changed. Must not be set in response to an authChallenge. | ||
| authChallengeResponse | AuthChallengeResponse | 对带有身份验证挑战(authChallenge)的请求拦截(requestIntercepted)的响应。否则不得设置。 | ENResponse to a requestIntercepted with an authChallenge. Must not be set otherwise. |
🔨Network.setRequestInterception🧪❌️
设置要拦截的请求,这些请求需匹配提供的模式并可选择性地匹配资源类型。已弃用,请改用 Fetch.enable。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| patterns | ✔️ | array[RequestPattern] | 符合这些模式中任意一个的请求将被转发,并等待相应的''continueInterceptedRequest''调用。 | ENRequests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call. |
✅️️ Events
👋Network.dataReceived
当通过网络接收到数据块时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| dataLength | ✔️ | integer | 数据块长度。 | ENData chunk length. | |
| encodedDataLength | ✔️ | integer | 实际接收的字节数(对于压缩编码,可能小于数据长度)。 | ENActual bytes received (might be less than dataLength for compressed encodings). | |
| data | 🧪 | string | 已接收的数据。(在通过JSON传递时,编码为base64字符串) | ENData that was received. (Encoded as a base64 string when passed over JSON) |
👋Network.eventSourceMessageReceived
当接收到 EventSource 消息时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| eventName | ✔️ | string | 消息类型。 | ENMessage type. | |
| eventId | ✔️ | string | 消息标识符。 | ENMessage identifier. | |
| data | ✔️ | string | 消息内容。 | ENMessage content. |
👋Network.loadingFailed
当HTTP请求加载失败时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | Timestamp. | ENTimestamp. | |
| type | ✔️ | ResourceType | 资源类型。 | ENResource type. | |
| errorText | ✔️ | string | 错误信息。网络错误列表:https://cs.chromium.org/chromium/src/net/base/net_error_list.h | ENError message. List of network errors: https://cs.chromium.org/chromium/src/net/base/net_error_list.h | |
| canceled | boolean | 如果加载被取消,则为真。 | ENTrue if loading was canceled. | ||
| blockedReason | BlockedReason | 加载被阻止的原因(如果有的话)。 | ENThe reason why loading was blocked, if any. | ||
| corsErrorStatus | CorsErrorStatus | 加载被CORS阻止的原因(如果有的话)。 | ENThe reason why loading was blocked by CORS, if any. |
👋Network.loadingFinished
当HTTP请求完成加载时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| encodedDataLength | ✔️ | number | 此请求接收的总字节数。 | ENTotal number of bytes received for this request. |
👋Network.requestServedFromCache
如果请求最终从缓存加载,则触发此事件。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. |
👋Network.requestWillBeSent
当页面即将发送HTTP请求时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| loaderId | ✔️ | LoaderId | Loader标识符。如果请求是从worker获取的,则为空字符串。 | ENLoader identifier. Empty string if the request is fetched from worker. | |
| documentURL | ✔️ | string | 此请求加载的文档的URL。 | ENURL of the document this request is loaded for. | |
| request | ✔️ | Request | 请求数据。 | ENRequest data. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| wallTime | ✔️ | TimeSinceEpoch | Timestamp. | ENTimestamp. | |
| initiator | ✔️ | Initiator | 请求发起者。 | ENRequest initiator. | |
| redirectHasExtraInfo | ✔️ | 🧪 | boolean | 当redirectResponse被填充时,此标志指示是否将为刚刚重定向的请求发出requestWillBeSentExtraInfo和responseReceivedExtraInfo事件。 | ENIn 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 | Response | 重定向响应数据。 | ENRedirect response data. | ||
| type | ResourceType | 此资源的类型。 | ENType of this resource. | ||
| frameId | Page.FrameId | Frame identifier. | ENFrame identifier. | ||
| hasUserGesture | boolean | 请求是否由用户手势发起。默认为 false。 | ENWhether the request is initiated by a user gesture. Defaults to false. | ||
| renderBlockingBehavior | 🧪 | RenderBlockingBehavior | 请求的渲染阻塞行为。 | ENThe render-blocking behavior of the request. |
👋Network.responseReceived
当HTTP响应可用时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| loaderId | ✔️ | LoaderId | 加载器标识符。如果请求是从工作线程获取的,则为空字符串。 | ENLoader identifier. Empty string if the request is fetched from worker. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| type | ✔️ | ResourceType | 资源类型。 | ENResource type. | |
| response | ✔️ | Response | 响应数据。 | ENResponse data. | |
| hasExtraInfo | ✔️ | 🧪 | boolean | 表示对于此请求,是否将或已经触发了 requestWillBeSentExtraInfo 和 responseReceivedExtraInfo 事件。 | ENIndicates whether requestWillBeSentExtraInfo and responseReceivedExtraInfo events will be or were emitted for this request. |
| frameId | Page.FrameId | 帧标识符。 | ENFrame identifier. |
👋Network.webSocketClosed
当WebSocket关闭时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | Timestamp. | ENTimestamp. |
👋Network.webSocketCreated
在WebSocket创建时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| url | ✔️ | string | WebSocket 请求 URL。 | ENWebSocket request URL. | |
| initiator | Initiator | 请求发起方。 | ENRequest initiator. |
👋Network.webSocketFrameError
当WebSocket消息错误发生 时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| errorMessage | ✔️ | string | WebSocket 错误信息。 | ENWebSocket error message. |
👋Network.webSocketFrameReceived
当接收到WebSocket消息时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | Timestamp. | ENTimestamp. | |
| response | ✔️ | WebSocketFrame | WebSocket响应数据。 | ENWebSocket response data. |
👋Network.webSocketFrameSent
当WebSocket消息被发送时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| response | ✔️ | WebSocketFrame | WebSocket响应数据。 | ENWebSocket response data. |
👋Network.webSocketHandshakeResponseReceived
当WebSocket握手响应可用时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| response | ✔️ | WebSocketResponse | WebSocket响应数据。 | ENWebSocket response data. |
👋Network.webSocketWillSendHandshakeRequest
当WebSocket即将发起握手时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| wallTime | ✔️ | TimeSinceEpoch | UTC 时间戳。 | ENUTC Timestamp. | |
| request | ✔️ | WebSocketRequest | WebSocket请求数据。 | ENWebSocket request data. |
👋Network.webTransportClosed
当WebTransport被释放时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| transportId | ✔️ | RequestId | WebTransport 标识符。 | ENWebTransport identifier. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. |
👋Network.webTransportConnectionEstablished
当WebTransport握手完成时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| transportId | ✔️ | RequestId | WebTransport 标识符。 | ENWebTransport identifier. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. |
👋Network.webTransportCreated
在WebTransport创建时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| transportId | ✔️ | RequestId | WebTransport 标识符。 | ENWebTransport identifier. | |
| url | ✔️ | string | WebTransport 请求 URL。 | ENWebTransport request URL. | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. | |
| initiator | Initiator | 请求发起者。 | ENRequest initiator. |
👋Network.deviceBoundSessionEventOccurred🧪
当发生设备绑定会话事件时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| eventId | ✔️ | DeviceBoundSessionEventId | 此会话事件的唯一标识符。 | ENA unique identifier for this session event. | |
| site | ✔️ | string | 此会话事件关联的站点。 | ENThe site this session event is associated with. | |
| succeeded | ✔️ | boolean | 此事件是否被视为成功。 | ENWhether this event was considered successful. | |
| sessionId | string | 与此事件关联的会话ID。对于失败的事件,此字段可能为空。 | ENThe session ID this event is associated with. May not be populated for failed events. | ||
| creationEventDetails | CreationEventDetails | 以下是不同会话事件类型的详细信息。''和``中的内容保持不变。 | ENThe below are the different session event type details. Exactly one is populated. | ||
| refreshEventDetails | RefreshEventDetails | ||||
| terminationEventDetails | TerminationEventDetails | ||||
| challengeEventDetails | ChallengeEventDetails |
👋Network.deviceBoundSessionsAdded🧪
当初始的设备绑定会话集合被添加时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| sessions | ✔️ | array[DeviceBoundSession] | 设备绑定的会话。 | ENThe device bound sessions. |
👋Network.directTCPSocketAborted🧪
当 direct_socket.TCPSocket 被中止时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| errorMessage | ✔️ | string | |||
| timestamp | ✔️ | MonotonicTime |
👋Network.directTCPSocketChunkReceived🧪
当从TCP直接套接字流接收到数据时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| data | ✔️ | string | |||
| timestamp | ✔️ | MonotonicTime |
👋Network.directTCPSocketChunkSent🧪
当数据被发送到tcp直接套接字流时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| data | ✔️ | string | |||
| timestamp | ✔️ | MonotonicTime |
👋Network.directTCPSocketClosed🧪
当 direct_socket.TCPSocket 关闭时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| timestamp | ✔️ | MonotonicTime |
👋Network.directTCPSocketCreated🧪
在创建 direct_socket.TCPSocket 时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| remoteAddr | ✔️ | string | |||
| remotePort | ✔️ | integer | 无符号整数 16。 | ENUnsigned int 16. | |
| options | ✔️ | DirectTCPSocketOptions | |||
| timestamp | ✔️ | MonotonicTime | |||
| initiator | Initiator |
👋Network.directTCPSocketOpened🧪
当 direct_socket.TCPSocket 连接被打开时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| remoteAddr | ✔️ | string | |||
| remotePort | ✔️ | integer | 预期为无符号整数。 | ENExpected to be unsigned integer. | |
| timestamp | ✔️ | MonotonicTime | |||
| localAddr | string | ||||
| localPort | integer | 预期为无符号整数。 | ENExpected to be unsigned integer. |
👋Network.directUDPSocketAborted🧪
当 direct_socket.UDPSocket 被中止时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| errorMessage | ✔️ | string | |||
| timestamp | ✔️ | MonotonicTime |
👋Network.directUDPSocketChunkReceived🧪
当从UDP直接套接字流接收到消息时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| message | ✔️ | DirectUDPMessage | |||
| timestamp | ✔️ | MonotonicTime |
👋Network.directUDPSocketChunkSent🧪
当消息被发送到 UDP 直接套接字流时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| message | ✔️ | DirectUDPMessage | |||
| timestamp | ✔️ | MonotonicTime |
👋Network.directUDPSocketClosed🧪
当 direct_socket.UDPSocket 被关闭时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| timestamp | ✔️ | MonotonicTime |
👋Network.directUDPSocketCreated🧪
在直接套接字.UDP套接字创建时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| options | ✔️ | DirectUDPSocketOptions | |||
| timestamp | ✔️ | MonotonicTime | |||
| initiator | Initiator |
👋Network.directUDPSocketJoinedMulticastGroup🧪
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| IPAddress | ✔️ | string |
👋Network.directUDPSocketLeftMulticastGroup🧪
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| IPAddress | ✔️ | string |
👋Network.directUDPSocketOpened🧪
当 direct_socket.UDPSocket 连接被打开时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| identifier | ✔️ | RequestId | |||
| localAddr | ✔️ | string | |||
| localPort | ✔️ | integer | 预期为无符号整数。 | ENExpected to be unsigned integer. | |
| timestamp | ✔️ | MonotonicTime | |||
| remoteAddr | string | ||||
| remotePort | integer | 预期为无符号整数。 | ENExpected to be unsigned integer. |
👋Network.policyUpdated🧪
安 全策略更新后触发一次。
EN
👋Network.reportingApiEndpointsChangedForOrigin🧪
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| origin | ✔️ | string | 配置端点的文档来源。 | ENOrigin of the document(s) which configured the endpoints. | |
| endpoints | ✔️ | array[ReportingApiEndpoint] |
👋Network.reportingApiReportAdded🧪
每当添加新报告时发送。并且在为所有现有报告执行 'enableReportingApi' 之后。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| report | ✔️ | ReportingApiReport |
👋Network.reportingApiReportUpdated🧪
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| report | ✔️ | ReportingApiReport |
👋Network.requestWillBeSentExtraInfo🧪
当网络堆栈提供关于requestWillBeSent事件的额外信息时触发。并非每个requestWillBeSent事件都会对应触发额外的requestWillBeSentExtraInfo事件,且对于同一请求, 无法保证requestWillBeSent与requestWillBeSentExtraInfo的触发先后顺序。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。用于将此信息与现有的 requestWillBeSent 事件进行匹配。 | ENRequest identifier. Used to match this information to an existing requestWillBeSent event. | |
| associatedCookies | ✔️ | array[AssociatedCookie] | 与请求URL可能关联的Cookie列表。这包括随请求发送的Cookie和未发送的Cookie;后者通过设置blockedReasons字段来区分。 | ENA 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 | ✔️ | Headers | 原始请求头,它们将通过网络线路发送。 | ENRaw request headers as they will be sent over the wire. | |
| connectTiming | ✔️ | 🧪 | ConnectTiming | 请求的连接计时信息。 | ENConnection timing information for the request. |
| deviceBoundSessionUsages | array[DeviceBoundSessionWithUsage] | 在此次请求中,请求站点的设备绑定会话是如何被使用的。 | ENHow the request site's device bound sessions were used during this request. | ||
| clientSecurityState | ClientSecurityState | 为请求设置的客户端安全状态。 | ENThe client security state set for the request. | ||
| siteHasCookieInOtherPartition | boolean | 该站点是否在不同于当前分区的分区中存储了分区Cookie。 | ENWhether the site has partitioned cookies stored in a partition different than the current one. | ||
| appliedNetworkConditionsId | string | 网络条件ID,如果此请求受到通过emulateNetworkConditionsByRule配置的网络条件影响。 | ENThe network conditions id if this request was affected by network conditions configured via emulateNetworkConditionsByRule. |
👋Network.resourceChangedPriority🧪
当资源加载优先级发生变化时触发
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| newPriority | ✔️ | ResourcePriority | 新优先级 | ENNew priority | |
| timestamp | ✔️ | MonotonicTime | 时间戳。 | ENTimestamp. |
👋Network.responseReceivedEarlyHints🧪
当接收到103早期提示标头以及常规响应时触发。并非每个responseReceived事件都会触发responseReceivedEarlyHints。每个responseReceived事件最多只能触发一个responseReceivedEarlyHints。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。用于将此信息与另一个responseReceived事件进行匹配。 | ENRequest identifier. Used to match this information to another responseReceived event. | |
| headers | ✔️ | Headers | 原始响应头,即通过网络接收到的原始数据。响应中的重复头会以单个键的形式表示,其值使用 \n 作为分隔符进行连接 。另请参阅包含 HTTP/1.* 原始文本的 headersText。 | ENRaw response headers as they were received over the wire. Duplicate headers in the response are represented as a single key with their values concatentated using\n as the separator. See also headersText that contains verbatim text for HTTP/1.*. |
👋Network.responseReceivedExtraInfo🧪
当网络堆栈提供了关于responseReceived事件的额外信息时触发。并非每个responseReceived事件都会对应一个额外的responseReceivedExtraInfo,并且responseReceivedExtraInfo可能在responseReceived之前或之后触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。用于将此信息与另一个responseReceived事件匹配 。 | ENRequest identifier. Used to match this information to another responseReceived event. | |
| blockedCookies | ✔️ | array[BlockedSetCookieWithReason] | 一份未从响应中存储的cookie列表,以及相应的阻止原因。这里的cookie可能因语法错误而无效,这些错误通过无效cookie行字符串而非正确cookie来表示。 | ENA list of cookies which were not stored from the response along with the corresponding reasons for blocking. The cookies here may not be valid due to syntax errors, which are represented by the invalid cookie line string instead of a proper cookie. | |
| headers | ✔️ | Headers | 原始响应头,即通过网络接收到的原始形式。响应中的重复头字段会以单个键表示,其值使用 \n 作为分隔符进行拼接。另请参阅包含 HTTP/1.* 原始文本的 headersText。 | ENRaw response headers as they were received over the wire. Duplicate headers in the response are represented as a single key with their values concatentated using\n as the separator. See also headersText that contains verbatim text for HTTP/1.*. | |
| resourceIPAddressSpace | ✔️ | IPAddressSpace | 资源的IP地址空间。地址空间只有在传输建立连接后才能确定,因此我们无法在requestWillBeSentExtraInfo中发送 。 | ENThe IP address space of the resource. The address space can only be determined once the transport established the connection, so we can't send it inrequestWillBeSentExtraInfo. | |
| statusCode | ✔️ | integer | 响应的状态码。这在请求失败且未触发responseReceived事件的情况下非常有用,例如CORS错误。对于缓存请求,这也是正确的状态码,此时responseReceived中的状态码为200,而此处的状态码将为304。 | ENThe status code of the response. This is useful in cases the request failed and no responseReceived event is triggered, which is the case for, e.g., CORS errors. This is also the correct status code for cached requests, where the status in responseReceived is a 200 and this will be 304. | |
| headersText | string | 原始响应头文本,即通过网络接收到的原始文本。原始文本可能并不总是可用,例如在HTTP/2或QUIC的情况下。 | ENRaw response header text as it was received over the wire. The raw text may not always be available, such as in the case of HTTP/2 or QUIC. | ||
| cookiePartitionKey | 🧪 | CookiePartitionKey | 用于存储此响应中设置的已分区 Cookie 的 Cookie 分区密钥。仅在启用分区 Cookie 时发送。 | ENThe cookie partition key that will be used to store partitioned cookies set in this response. Only sent when partitioned cookies are enabled. | |
| cookiePartitionKeyOpaque | boolean | 如果启用了分区cookies,但分区键无法序列化为字符串,则为True。 | ENTrue if partitioned cookies are enabled, but the partition key is not serializable to string. | ||
| exemptedCookies | array[ExemptedSetCookieWithReason] | 一份本应被第三方Cookie拦截(3PCD)阻止但被豁免并因相应原因从响应中存储的Cookie列表。 | ENA list of cookies which should have been blocked by 3PCD but are exempted and stored from the response with the corresponding reason. |
👋Network.signedExchangeReceived🧪
当通过网络接收到一个签名交换时触发
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | RequestId | 请求标识符。 | ENRequest identifier. | |
| info | ✔️ | SignedExchangeInfo | 有关已签名交换响应的信息。 | ENInformation about the signed exchange response. |
👋Network.trustTokenOperationDone🧪
对于每个信任令牌操作,该事件仅触发一次。根据操作类型以及操作成功与否,事件会在相应请求发送之前或收到响应之后触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| status | ✔️ | string | 操作的成功或错误详细状态。'AlreadyExists' 同样表示操作成功,因为操作结果已存在,因此操作被预先中止(例如缓存命中)。 允许值: Ok, InvalidArgument, MissingIssuerKeys, FailedPrecondition, ResourceExhausted, AlreadyExists, ResourceLimited, Unauthorized, BadResponse, InternalError, UnknownError, FulfilledLocally, SiteIssuerLimit | ENDetailed success or error status of the operation. 'AlreadyExists' also signifies a successful operation, as the result of the operation already exists und thus, the operation was abort preemptively (e.g. a cache hit).Allowed Values: Ok, InvalidArgument, MissingIssuerKeys, FailedPrecondition, ResourceExhausted, AlreadyExists, ResourceLimited, Unauthorized, BadResponse, InternalError, UnknownError, FulfilledLocally, SiteIssuerLimit | |
| type | ✔️ | TrustTokenOperationType | |||
| requestId | ✔️ | RequestId | |||
| topLevelOrigin | string | 顶级来源。尝试操作所处的上下文环境。 | ENTop level origin. The context in which the operation was attempted. | ||
| issuerOrigin | string | 在“发行”或“赎回”操作中,发行方的来源。 | ENOrigin of the issuer in case of a "Issuance" or "Redemption" operation. | ||
| issuedTokenCount | integer | 在成功的“发行”操作中获取的信任令牌数量。 | ENThe number of obtained Trust Tokens on a successful "Issuance" operation. |
👋Network.requestIntercepted🧪❌️
被拦截的HTTP请求的详细信息,该请求必须被允许、阻止、修改或模拟。已弃用,请改用Fetch.requestPaused。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| interceptionId | ✔️ | InterceptionId | 页面发出的每个请求都会有一个唯一的ID,但如果在该请求处理过程中遇到任何重定向,它们将使用与原始请求相同的ID进行报告。同样,如果需要HTTP身份验证,也会使用相同的请求ID。 | ENEach request the page makes will have a unique id, however if any redirects are encountered while processing that fetch, they will be reported with the same id as the original fetch. Likewise if HTTP authentication is needed then the same fetch id will be used. | |
| request | ✔️ | Request | |||
| frameId | ✔️ | Page.FrameId | 发起请求的帧的ID。 | ENThe id of the frame that initiated the request. | |
| resourceType | ✔️ | ResourceType | 请求的资源将如何被使用。 | ENHow the requested resource will be used. | |
| isNavigationRequest | ✔️ | boolean | 这是否为导航请求,该请求可以完全中止导航。 | ENWhether this is a navigation request, which can abort the navigation completely. | |
| isDownload | boolean | 设置请求是否为会导致下载的导航。仅在从服务器收到响应后(即HeadersReceived阶段)出现。 | ENSet if the request is a navigation that will result in a download. Only present after response is received from the server (i.e. HeadersReceived stage). | ||
| redirectUrl | string | 重定向位置,仅在拦截到重定向时发送。 | ENRedirect location, only sent if a redirect was intercepted. | ||
| authChallenge | AuthChallenge | 授权质询的详细信息。如果设置了此项,则 continueInterceptedRequest 必须包含 authChallengeResponse。 | ENDetails of the Authorization Challenge encountered. If this is set then continueInterceptedRequest must contain an authChallengeResponse. | ||
| responseErrorReason | ErrorReason | 如果在响应阶段被拦截,或者在拦截请求时发生重定向,则会出现响应错误。 | ENResponse error if intercepted at response stage or if redirect occurred while intercepting request. | ||
| responseStatusCode | integer | 如果拦截发生在响应阶段,或者在拦截请求时发生重定向,或者发生身份验证重试,则返回响应代码。 | ENResponse code if intercepted at response stage or if redirect occurred while intercepting request or auth retry occurred. | ||
| responseHeaders | Headers | 如果响应在响应阶段被拦截,或者在拦截请求时发生重定向,或者发生身份验证重试,则返回响应头。 | ENResponse headers if intercepted at the response stage or if redirect occurred while intercepting request or auth retry occurred. | ||
| requestId | RequestId | 如果被拦截的请求触发了相应的requestWillBeSent事件,那么这个requestId将与requestWillBeSent事件中的requestId相同。 | ENIf the intercepted request had a corresponding requestWillBeSent event fired for it, then this requestId will be the same as the requestId present in the requestWillBeSent event. |
✅️️ Types
📌Network.BlockedReason
请求被阻止的原因。
允许的值:other、csp、mixed-content、origin、inspector、integrity、subresource-filter、content-type、coep-frame-resource-needs-coep-header、coop-sandboxed-iframe-cannot-navigate-to-coop-page、corp-not-same-origin、corp-not-same-origin-after-defaulted-to-same-origin-by-coep、corp-not-same-origin-after-defaulted-to-same-origin-by-dip、corp-not-same-origin-after-defaulted-to-same-origin-by-coep-and-dip、corp-not-same-site、sri-message-signature-mismatch
EN
Allowed Values:
other, csp, mixed-content, origin, inspector, integrity, subresource-filter, content-type, coep-frame-resource-needs-coep-header, coop-sandboxed-iframe-cannot-navigate-to-coop-page, corp-not-same-origin, corp-not-same-origin-after-defaulted-to-same-origin-by-coep, corp-not-same-origin-after-defaulted-to-same-origin-by-dip, corp-not-same-origin-after-defaulted-to-same-origin-by-coep-and-dip, corp-not-same-site, sri-message-signature-mismatch返回类型:string
📌Network.CachedResource
关于缓存资源的信息。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| url | ✔️ | string | 资源URL。这是原始网络请求 的URL。 | ENResource URL. This is the url of the original network request. | |
| type | ✔️ | ResourceType | 此资源的类型。 | ENType of this resource. | |
| response | Response | 缓存的响应数据。 | ENCached response data. | ||
| bodySize | ✔️ | number | 缓存响应体大小。 | ENCached response body size. |
📌Network.CertificateTransparencyCompliance
该请求是否符合证书透明度政策。
允许值:unknown、not-compliant、compliant
EN
Allowed Values:
unknown, not-compliant, compliant返回类型:string
📌Network.ConnectionType
浏览器所采用的基础连接技术。
允许的取值:none、cellular2g、cellular3g、cellular4g、bluetooth、ethernet、wifi、wimax、other
EN
Allowed Values:
none, cellular2g, cellular3g, cellular4g, bluetooth, ethernet, wifi, wimax, other返回类型:string
📌Network.Cookie
Cookie 对象
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | Cookie 名称。 | ENCookie name. | |
| value | ✔️ | string | Cookie值。 | ENCookie value. | |
| domain | ✔️ | string | Cookie 域。 | ENCookie domain. | |
| path | ✔️ | string | Cookie 路径。 | ENCookie path. | |
| expires | ✔️ | number | Cookie的过期时间,以自UNIX纪元以来的秒数表示。如果未设置过期日期,则该值设为-1。对于无法在JSON中表示的值(±Inf),该值可以为null。 | ENCookie expiration date as the number of seconds since the UNIX epoch. The value is set to -1 if the expiry date is not set. The value can be null for values that cannot be represented in JSON (±Inf). | |
| size | ✔️ | integer | Cookie 大小。 | ENCookie size. | |
| httpOnly | ✔️ | boolean | 如果cookie是http-only,则为真。 | ENTrue if cookie is http-only. | |
| secure | ✔️ | boolean | 如果cookie是安全的,则为True。 | ENTrue if cookie is secure. | |
| session | ✔️ | boolean | 在会话 Cookie 的情况下为 True。 | ENTrue in case of session cookie. | |
| sameSite | CookieSameSite | Cookie SameSite 类型。 | ENCookie SameSite type. | ||
| priority | ✔️ | 🧪 | CookiePriority | Cookie Priority | ENCookie Priority |
| sourceScheme | ✔️ | 🧪 | CookieSourceScheme | Cookie 来源方案类型。 | ENCookie source scheme type. |
| sourcePort | ✔️ | 🧪 | integer | Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. This is a temporary ability and it will be removed in the future. | ENCookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. This is a temporary ability and it will be removed in the future. |
| partitionKey | 🧪 | CookiePartitionKey | Cookie partition key. | ENCookie partition key. | |
| partitionKeyOpaque | 🧪 | boolean | 如果cookie分区密钥不透明,则为True。 | ENTrue if cookie partition key is opaque. |
📌Network.CookieParam
Cookie 参数对象
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | Cookie 名称。 | ENCookie name. | |
| value | ✔️ | string | Cookie 值。 | ENCookie value. | |
| url | string | 与cookie设置相关联的请求URI。此值可能影响所创建cookie的默认域名、 路径、源端口和源方案值。 | ENThe request-URI to associate with the setting of the cookie. This value can affect the default domain, path, source port, and source scheme values of the created cookie. | ||
| domain | string | Cookie 域名。 | ENCookie domain. | ||
| path | string | Cookie 路径。 | ENCookie path. | ||
| secure | boolean | 如果 cookie 是安全的,则为 True。 | ENTrue if cookie is secure. | ||
| httpOnly | boolean | 如果cookie是http-only,则为真。 | ENTrue if cookie is http-only. | ||
| sameSite | CookieSameSite | Cookie SameSite 类型。 | ENCookie SameSite type. | ||
| expires | TimeSinceEpoch | Cookie过期日期,如果未设置则为会话Cookie | ENCookie expiration date, session cookie if not set | ||
| priority | 🧪 | CookiePriority | Cookie Priority. | ENCookie Priority. | |
| sourceScheme | 🧪 | CookieSourceScheme | Cookie 来源方案类型。 | ENCookie source scheme type. | |
| sourcePort | 🧪 | integer | Cookie 源端口。有效值为 {-1, [1, 65535]},-1 表示未指定端口。未指定的端口值允许协议客户端模拟该端口的旧版 Cookie 作用域。这是一个临时功能,未来将被移除。 | ENCookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. This is a temporary ability and it will be removed in the future. | |
| partitionKey | 🧪 | CookiePartitionKey | Cookie partition key。如果未设置,cookie 将被设置为未分区状态。 | ENCookie partition key. If not set, the cookie will be set as not partitioned. |
📌Network.CookieSameSite
表示Cookie的'SameSite'状态:https://tools.ietf.org/html/draft-west-first-party-cookies
允许的值:Strict, Lax, None
EN
Allowed Values:
Strict, Lax, None返回类型:string
📌Network.CorsError
请求被阻止的原因。
允许的值:DisallowedByMode、InvalidResponse、WildcardOriginNotAllowed、MissingAllowOriginHeader、MultipleAllowOriginValues、InvalidAllowOriginValue、AllowOriginMismatch、InvalidAllowCredentials、CorsDisabledScheme、PreflightInvalidStatus、PreflightDisallowedRedirect、PreflightWildcardOriginNotAllowed、PreflightMissingAllowOriginHeader、PreflightMultipleAllowOriginValues、PreflightInvalidAllowOriginValue、PreflightAllowOriginMismatch、PreflightInvalidAllowCredentials、PreflightMissingAllowExternal、PreflightInvalidAllowExternal、InvalidAllowMethodsPreflightResponse、InvalidAllowHeadersPreflightResponse、MethodDisallowedByPreflightResponse、HeaderDisallowedByPreflightResponse、RedirectContainsCredentials、InsecureLocalNetwork、InvalidLocalNetworkAccess、NoCorsRedirectModeNotFollow、LocalNetworkAccessPermissionDenied
EN
Allowed Values:
DisallowedByMode, InvalidResponse, WildcardOriginNotAllowed, MissingAllowOriginHeader, MultipleAllowOriginValues, InvalidAllowOriginValue, AllowOriginMismatch, InvalidAllowCredentials, CorsDisabledScheme, PreflightInvalidStatus, PreflightDisallowedRedirect, PreflightWildcardOriginNotAllowed, PreflightMissingAllowOriginHeader, PreflightMultipleAllowOriginValues, PreflightInvalidAllowOriginValue, PreflightAllowOriginMismatch, PreflightInvalidAllowCredentials, PreflightMissingAllowExternal, PreflightInvalidAllowExternal, InvalidAllowMethodsPreflightResponse, InvalidAllowHeadersPreflightResponse, MethodDisallowedByPreflightResponse, HeaderDisallowedByPreflightResponse, RedirectContainsCredentials, InsecureLocalNetwork, InvalidLocalNetworkAccess, NoCorsRedirectModeNotFollow, LocalNetworkAccessPermissionDenied返回类型:string
📌Network.CorsErrorStatus
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| corsError | ✔️ | CorsError | |||
| failedParameter | ✔️ | string |
📌Network.ErrorReason
网络层级获取失败原因。
允许值:Failed、Aborted、TimedOut、AccessDenied、ConnectionClosed、ConnectionReset、ConnectionRefused、ConnectionAborted、ConnectionFailed、NameNotResolved、InternetDisconnected、AddressUnreachable、BlockedByClient、BlockedByResponse
EN
Allowed Values:
Failed, Aborted, TimedOut, AccessDenied, ConnectionClosed, ConnectionReset, ConnectionRefused, ConnectionAborted, ConnectionFailed, NameNotResolved, InternetDisconnected, AddressUnreachable, BlockedByClient, BlockedByResponse返回类型:string
📌Network.Headers
请求/响应头作为JSON对象的键/值。
EN
返回类型:object
📌Network.Initiator
关于请求发起者的信息。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| type | ✔️ | string | 此发起者的类型。 允许的值: parser、script、preload、SignedExchange、preflight、FedCM、other | ENType of this initiator.Allowed Values: parser, script, preload, SignedExchange, preflight, FedCM, other | |
| stack | Runtime.StackTrace | 发起者JavaScript堆栈跟踪,仅针对脚本设置。需要启用调试器域。 | ENInitiator JavaScript stack trace, set for Script only. Requires the Debugger domain to be enabled. | ||
| url | string | 发起方URL,针对Parser类型或Script类型(当脚本导入模块时)或SignedExchange类型设置。 | ENInitiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. | ||
| lineNumber | number | 起始行号,针对Parser类型或Script类型(当脚本正在导入模块时)设置(从0开始计数)。 | ENInitiator line number, set for Parser type or for Script type (when script is importing module) (0-based). | ||
| columnNumber | number | 起始列号,为解析器类型或脚本类型(当脚本导入模块时)设置(从0开始计数)。 | ENInitiator column number, set for Parser type or for Script type (when script is importing module) (0-based). | ||
| requestId | RequestId | 设置是否由另一个请求触发了此请求(例如预检请求)。 | ENSet if another request triggered this request (e.g. preflight). |
📌Network.InterceptionId
唯一的拦截请求标识符。
EN
返回类型:string
📌Network.LoaderId
唯一的加载器标识符。
EN
返回类型:string
📌Network.MonotonicTime
自过去某个任意点起单调递增的时间,以秒为单位。
EN
返回类型:number
📌Network.PostDataEntry
HTTP请求的Post数据条目
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| bytes | string |
📌Network.Request
HTTP 请求数据。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| url | ✔️ | string | 请求URL(不含片段)。 | ENRequest URL (without fragment). | |
| urlFragment | string | 所请求URL的片段,如果存在,则从哈希符号(#)开始的部分。 | ENFragment of the requested URL starting with hash, if present. | ||
| method | ✔️ | string | HTTP请求方法。 | ENHTTP request method. | |
| headers | ✔️ | Headers | HTTP请求头。 | ENHTTP request headers. | |
| postData | ❌️ | string | HTTP POST 请求数据。请改用 postDataEntries。 | ENHTTP POST request data. Use postDataEntries instead. | |
| hasPostData | boolean | 当请求包含POST数据时为真。请注意,即使此标志为真,当数据过长时,postData仍可能被省略。 | ENTrue when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long. | ||
| postDataEntries | 🧪 | array[PostDataEntry] | 请求体元素(post数据被分解为各个条目)。 | ENRequest body elements (post data broken into individual entries). | |
| mixedContentType | Security.MixedContentType | 请求的混合内容类型。 | ENThe mixed content type of the request. | ||
| initialPriority | ✔️ | ResourcePriority | 资源请求在发送时的优先级。 | ENPriority of the resource request at the time request is sent. | |
| referrerPolicy | ✔️ | string | 请求的引用策略,定义于https://www.w3.org/TR/referrer-policy/ 允许的值: unsafe-url, no-referrer-when-downgrade, no-referrer, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin | ENThe referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/Allowed Values: unsafe-url, no-referrer-when-downgrade, no-referrer, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin | |
| isLinkPreload | boolean | 是否通过链接预加载加载。 | ENWhether is loaded via link preload. | ||
| trustTokenParams | 🧪 | TrustTokenParams | 当 使用TrustToken API时,为请求设置。包含后端所理解的开发者传递的参数(例如通过"fetch")。 | ENSet for requests when the TrustToken API is used. Contains the parameters passed by the developer (e.g. via "fetch") as understood by the backend. | |
| isSameSite | 🧪 | boolean | 如果此资源请求被视为与主框架对应的请求属于“同一站点”,则为真。 | ENTrue if this resource request is considered to be the 'same site' as the request corresponding to the main frame. | |
| isAdRelated | 🧪 | boolean | 当资源请求与广告相关时为真。 | ENTrue when the resource request is ad-related. |
📌Network.RequestId
唯一的网络请求标识符。请注意,这并不标识作为网络请求一部分的各个HTTP请求。
EN
返回类型:string