CDPotion.Domain.Network (cdpotion v0.1.4)

Summary

Types

The reason why Chrome uses a specific transport protocol for HTTP semantics.

Authorization challenge for HTTP status code 401 or 407.

Response to an AuthChallenge.

A cookie with was not sent with a request with the corresponding reason.

The reason why request was blocked.

A cookie which was not stored from a response with the corresponding reason.

Information about the cached resource.

Whether the request complied with Certificate Transparency policy.

description not provided :(

description not provided :(

The underlying connection technology that the browser is supposedly using.

List of content encodings supported by the backend.

description not provided :(

description not provided :(

Cookie object

Types of reasons why a cookie may not be sent with a request.

Cookie parameter object

Represents the source scheme of the origin that originally set the cookie. A value of 'Unset' allows protocol clients to emulate legacy cookie scope for the scheme. This is a temporary ability and it will be removed in the future.

The reason why request was blocked.

description not provided :(

description not provided :(

description not provided :(

description not provided :(

description not provided :(

Network level fetch failure reason.

Request / response headers as keys / values of JSON object.

Information about the request initiator.

Unique intercepted request identifier.

Stages of the interception to begin intercepting. Request will intercept before the request is sent. Response will intercept after the response is received.

description not provided :(

An options object that may be extended later to better support CORS, CORB and streaming.

An object providing the result of a network resource load.

Unique loader identifier.

Monotonically increasing time in seconds since an arbitrary point in the past.

Post data entry for HTTP request

description not provided :(

description not provided :(

The status of a Reporting API report.

description not provided :(

An object representing a report generated by the Reporting API.

HTTP request data.

Unique request identifier.

Request pattern for interception.

Loading priority of a resource request.

Timing information for the request.

Resource type as it was perceived by the rendering engine.

HTTP response data.

Security details about a request.

description not provided :(

Source of serviceworker response.

Types of reasons why a cookie may not be stored from a response.

Details of a signed certificate timestamp (SCT).

Information about a signed exchange response.

Field type for a signed exchange related error.

Information about a signed exchange response.

UTC time in seconds, counted from January 1, 1970.

description not provided :(

Determines what type of Trust Token operation is executed and depending on the type, some additional parameters. The values are specified in third_party/blink/renderer/core/fetch/trust_token.idl.

WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests.

WebSocket request data.

WebSocket response data.

Functions

Tells whether clearing browser cache is supported.

Tells whether clearing browser cookies is supported.

Tells whether emulation of network conditions is supported.

Clears accepted encodings set by setAcceptedEncodings

Clears browser cache.

Clears browser cookies.

Response to Network.requestIntercepted which either modifies the request to continue with any modifications, or blocks it, or completes it with the provided response bytes. If a network fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted event will be sent with the same InterceptionId. Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead.

Deletes browser cookies with matching name and url or domain/path pair.

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

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

Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client. Enabling triggers 'reportingApiReportAdded' for all existing reports.

Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies field. Deprecated. Use Storage.getCookies instead.

Returns the DER-encoded certificate.

Returns all browser cookies for the current URL. Depending on the backend support, will return detailed cookie information in the cookies field.

Returns post data sent with the request. Returns an error when no data was sent with the request.

Returns content served for the given request.

Returns content served for the given currently intercepted request.

Returns information about the COEP/COOP isolation status.

Fetches the resource and returns the content.

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.

Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted.

Specifies whether to attach a page script stack id in requests

Blocks URLs from loading.

Toggles ignoring of service worker for each request.

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

Sets given cookies.

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

Sets the requests to intercept that match the provided patterns and optionally resource types. Deprecated, please use Fetch.enable instead.

Returns a handle to the stream representing the response body. Note that after this command, the intercepted request can't be continued as is -- you either need to cancel it or to provide the response body. The stream only supports sequential read, IO.read will fail if the position is specified.

Types

Link to this type

alternate_protocol_usage()

@type alternate_protocol_usage() ::
  :alternativeJobWonWithoutRace
  | :alternativeJobWonRace
  | :mainJobWonRace
  | :mappingMissing
  | :broken
  | :dnsAlpnH3JobWonWithoutRace
  | :dnsAlpnH3JobWonRace
  | :unspecifiedReason

The reason why Chrome uses a specific transport protocol for HTTP semantics.

Link to this type

auth_challenge()

@type auth_challenge() :: %{
  origin: String.t(),
  realm: String.t(),
  scheme: String.t(),
  source: :Server | :Proxy | nil
}

Authorization challenge for HTTP status code 401 or 407.

Link to this type

auth_challenge_response()

@type auth_challenge_response() :: %{
  password: String.t() | nil,
  response: :Default | :CancelAuth | :ProvideCredentials,
  username: String.t() | nil
}

Response to an AuthChallenge.

Link to this type

blocked_reason()

@type blocked_reason() ::
  :other
  | :csp
  | :"mixed-content"
  | :origin
  | :inspector
  | :"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-site"

The reason why request was blocked.

Link to this type

cached_resource()

@type cached_resource() :: %{
  bodySize: number(),
  response: response() | nil,
  type: resource_type(),
  url: String.t()
}

Information about the cached resource.

Link to this type

certificate_transparency_compliance()

@type certificate_transparency_compliance() ::
  :unknown | :"not-compliant" | :compliant

Whether the request complied with Certificate Transparency policy.

Link to this type

client_security_state()

@type client_security_state() :: %{
  initiatorIPAddressSpace: ip_address_space(),
  initiatorIsSecureContext: boolean(),
  privateNetworkRequestPolicy: private_network_request_policy()
}

description not provided :(

Link to this type

connect_timing()

@type connect_timing() :: %{requestTime: number()}

description not provided :(

Link to this type

connection_type()

@type connection_type() ::
  :none
  | :cellular2g
  | :cellular3g
  | :cellular4g
  | :bluetooth
  | :ethernet
  | :wifi
  | :wimax
  | :other

The underlying connection technology that the browser is supposedly using.

Link to this type

content_encoding()

@type content_encoding() :: :deflate | :gzip | :br | :zstd

List of content encodings supported by the backend.

Link to this type

content_security_policy_source()

@type content_security_policy_source() :: :HTTP | :Meta

description not provided :(

Link to this type

content_security_policy_status()

@type content_security_policy_status() :: %{
  effectiveDirectives: String.t(),
  isEnforced: boolean(),
  source: content_security_policy_source()
}

description not provided :(

@type cookie() :: %{
  domain: String.t(),
  expires: number(),
  httpOnly: boolean(),
  name: String.t(),
  partitionKey: String.t() | nil,
  partitionKeyOpaque: boolean() | nil,
  path: String.t(),
  priority: cookie_priority(),
  sameParty: boolean(),
  sameSite: cookie_same_site() | nil,
  secure: boolean(),
  session: boolean(),
  size: integer(),
  sourcePort: integer(),
  sourceScheme: cookie_source_scheme(),
  value: String.t()
}

Cookie object

Link to this type

cookie_blocked_reason()

@type cookie_blocked_reason() ::
  :SecureOnly
  | :NotOnPath
  | :DomainMismatch
  | :SameSiteStrict
  | :SameSiteLax
  | :SameSiteUnspecifiedTreatedAsLax
  | :SameSiteNoneInsecure
  | :UserPreferences
  | :ThirdPartyBlockedInFirstPartySet
  | :UnknownError
  | :SchemefulSameSiteStrict
  | :SchemefulSameSiteLax
  | :SchemefulSameSiteUnspecifiedTreatedAsLax
  | :SamePartyFromCrossPartyContext
  | :NameValuePairExceedsMaxSize

Types of reasons why a cookie may not be sent with a request.

Link to this type

cookie_param()

@type cookie_param() :: %{
  domain: String.t() | nil,
  expires: time_since_epoch() | nil,
  httpOnly: boolean() | nil,
  name: String.t(),
  partitionKey: String.t() | nil,
  path: String.t() | nil,
  priority: cookie_priority() | nil,
  sameParty: boolean() | nil,
  sameSite: cookie_same_site() | nil,
  secure: boolean() | nil,
  sourcePort: integer() | nil,
  sourceScheme: cookie_source_scheme() | nil,
  url: String.t() | nil,
  value: String.t()
}

Cookie parameter object

Link to this type

cookie_priority()

@type cookie_priority() :: :Low | :Medium | :High

Represents the cookie's 'Priority' status: https://tools.ietf.org/html/draft-west-cookie-priority-00

Link to this type

cookie_same_site()

@type cookie_same_site() :: :Strict | :Lax | :None

Represents the cookie's 'SameSite' status: https://tools.ietf.org/html/draft-west-first-party-cookies

Link to this type

cookie_source_scheme()

@type cookie_source_scheme() :: :Unset | :NonSecure | :Secure

Represents the source scheme of the origin that originally set the cookie. A value of 'Unset' allows protocol clients to emulate legacy cookie scope for the scheme. This is a temporary ability and it will be removed in the future.

Link to this type

cors_error()

@type cors_error() ::
  :DisallowedByMode
  | :InvalidResponse
  | :WildcardOriginNotAllowed
  | :MissingAllowOriginHeader
  | :MultipleAllowOriginValues
  | :InvalidAllowOriginValue
  | :AllowOriginMismatch
  | :InvalidAllowCredentials
  | :CorsDisabledScheme
  | :PreflightInvalidStatus
  | :PreflightDisallowedRedirect
  | :PreflightWildcardOriginNotAllowed
  | :PreflightMissingAllowOriginHeader
  | :PreflightMultipleAllowOriginValues
  | :PreflightInvalidAllowOriginValue
  | :PreflightAllowOriginMismatch
  | :PreflightInvalidAllowCredentials
  | :PreflightMissingAllowExternal
  | :PreflightInvalidAllowExternal
  | :PreflightMissingAllowPrivateNetwork
  | :PreflightInvalidAllowPrivateNetwork
  | :InvalidAllowMethodsPreflightResponse
  | :InvalidAllowHeadersPreflightResponse
  | :MethodDisallowedByPreflightResponse
  | :HeaderDisallowedByPreflightResponse
  | :RedirectContainsCredentials
  | :InsecurePrivateNetwork
  | :InvalidPrivateNetworkAccess
  | :UnexpectedPrivateNetworkAccess
  | :NoCorsRedirectModeNotFollow
  | :PreflightMissingPrivateNetworkAccessId
  | :PreflightMissingPrivateNetworkAccessName
  | :PrivateNetworkAccessPermissionUnavailable
  | :PrivateNetworkAccessPermissionDenied

The reason why request was blocked.

Link to this type

cors_error_status()

@type cors_error_status() :: %{corsError: cors_error(), failedParameter: String.t()}

description not provided :(

Link to this type

cross_origin_embedder_policy_status()

@type cross_origin_embedder_policy_status() :: %{
  reportOnlyReportingEndpoint: String.t() | nil,
  reportOnlyValue: cross_origin_embedder_policy_value(),
  reportingEndpoint: String.t() | nil,
  value: cross_origin_embedder_policy_value()
}

description not provided :(

Link to this type

cross_origin_embedder_policy_value()

@type cross_origin_embedder_policy_value() :: :None | :Credentialless | :RequireCorp

description not provided :(

Link to this type

cross_origin_opener_policy_status()

@type cross_origin_opener_policy_status() :: %{
  reportOnlyReportingEndpoint: String.t() | nil,
  reportOnlyValue: cross_origin_opener_policy_value(),
  reportingEndpoint: String.t() | nil,
  value: cross_origin_opener_policy_value()
}

description not provided :(

Link to this type

cross_origin_opener_policy_value()

@type cross_origin_opener_policy_value() ::
  :SameOrigin
  | :SameOriginAllowPopups
  | :RestrictProperties
  | :UnsafeNone
  | :SameOriginPlusCoep
  | :RestrictPropertiesPlusCoep

description not provided :(

Link to this type

error_reason()

@type error_reason() ::
  :Failed
  | :Aborted
  | :TimedOut
  | :AccessDenied
  | :ConnectionClosed
  | :ConnectionReset
  | :ConnectionRefused
  | :ConnectionAborted
  | :ConnectionFailed
  | :NameNotResolved
  | :InternetDisconnected
  | :AddressUnreachable
  | :BlockedByClient
  | :BlockedByResponse

Network level fetch failure reason.

@type headers() :: map()

Request / response headers as keys / values of JSON object.

@type initiator() :: %{
  columnNumber: number() | nil,
  lineNumber: number() | nil,
  requestId: request_id() | nil,
  stack: CDPotion.Domain.Runtime.stack_trace() | nil,
  type: :parser | :script | :preload | :SignedExchange | :preflight | :other,
  url: String.t() | nil
}

Information about the request initiator.

Link to this type

interception_id()

@type interception_id() :: String.t()

Unique intercepted request identifier.

Link to this type

interception_stage()

@type interception_stage() :: :Request | :HeadersReceived

Stages of the interception to begin intercepting. Request will intercept before the request is sent. Response will intercept after the response is received.

Link to this type

ip_address_space()

@type ip_address_space() :: :Local | :Private | :Public | :Unknown

description not provided :(

Link to this type

load_network_resource_options()

@type load_network_resource_options() :: %{
  disableCache: boolean(),
  includeCredentials: boolean()
}

An options object that may be extended later to better support CORS, CORB and streaming.

Link to this type

load_network_resource_page_result()

@type load_network_resource_page_result() :: %{
  headers: headers() | nil,
  httpStatusCode: number() | nil,
  netError: number() | nil,
  netErrorName: String.t() | nil,
  stream: CDPotion.Domain.IO.stream_handle() | nil,
  success: boolean()
}

An object providing the result of a network resource load.

@type loader_id() :: String.t()

Unique loader identifier.

Link to this type

monotonic_time()

@type monotonic_time() :: number()

Monotonically increasing time in seconds since an arbitrary point in the past.

Link to this type

post_data_entry()

@type post_data_entry() :: %{bytes: String.t() | nil}

Post data entry for HTTP request

Link to this type

private_network_request_policy()

@type private_network_request_policy() ::
  :Allow
  | :BlockFromInsecureToMorePrivate
  | :WarnFromInsecureToMorePrivate
  | :PreflightBlock
  | :PreflightWarn

description not provided :(

@type report_id() :: String.t()

description not provided :(

Link to this type

report_status()

@type report_status() :: :Queued | :Pending | :MarkedForRemoval | :Success

The status of a Reporting API report.

Link to this type

reporting_api_endpoint()

@type reporting_api_endpoint() :: %{groupName: String.t(), url: String.t()}

description not provided :(

Link to this type

reporting_api_report()

@type reporting_api_report() :: %{
  body: map(),
  completedAttempts: integer(),
  depth: integer(),
  destination: String.t(),
  id: report_id(),
  initiatorUrl: String.t(),
  status: report_status(),
  timestamp: time_since_epoch(),
  type: String.t()
}

An object representing a report generated by the Reporting API.

@type request() :: %{
  hasPostData: boolean() | nil,
  headers: headers(),
  initialPriority: resource_priority(),
  isLinkPreload: boolean() | nil,
  isSameSite: boolean() | nil,
  method: String.t(),
  mixedContentType: CDPotion.Domain.Security.mixed_content_type() | nil,
  postData: String.t() | nil,
  postDataEntries: [post_data_entry()] | nil,
  referrerPolicy:
    :"unsafe-url"
    | :"no-referrer-when-downgrade"
    | :"no-referrer"
    | :origin
    | :"origin-when-cross-origin"
    | :"same-origin"
    | :"strict-origin"
    | :"strict-origin-when-cross-origin",
  trustTokenParams: trust_token_params() | nil,
  url: String.t(),
  urlFragment: String.t() | nil
}

HTTP request data.

Link to this type

request_id()

@type request_id() :: String.t()

Unique request identifier.

Link to this type

request_pattern()

@type request_pattern() :: %{
  interceptionStage: interception_stage() | nil,
  resourceType: resource_type() | nil,
  urlPattern: String.t() | nil
}

Request pattern for interception.

Link to this type

resource_priority()

@type resource_priority() :: :VeryLow | :Low | :Medium | :High | :VeryHigh

Loading priority of a resource request.

Link to this type

resource_timing()

@type resource_timing() :: %{
  connectEnd: number(),
  connectStart: number(),
  dnsEnd: number(),
  dnsStart: number(),
  proxyEnd: number(),
  proxyStart: number(),
  pushEnd: number(),
  pushStart: number(),
  receiveHeadersEnd: number(),
  receiveHeadersStart: number(),
  requestTime: number(),
  sendEnd: number(),
  sendStart: number(),
  sslEnd: number(),
  sslStart: number(),
  workerFetchStart: number(),
  workerReady: number(),
  workerRespondWithSettled: number(),
  workerStart: number()
}

Timing information for the request.

Link to this type

resource_type()

@type resource_type() ::
  :Document
  | :Stylesheet
  | :Image
  | :Media
  | :Font
  | :Script
  | :TextTrack
  | :XHR
  | :Fetch
  | :Prefetch
  | :EventSource
  | :WebSocket
  | :Manifest
  | :SignedExchange
  | :Ping
  | :CSPViolationReport
  | :Preflight
  | :Other

Resource type as it was perceived by the rendering engine.

@type response() :: %{
  alternateProtocolUsage: alternate_protocol_usage() | nil,
  cacheStorageCacheName: String.t() | nil,
  connectionId: number(),
  connectionReused: boolean(),
  encodedDataLength: number(),
  fromDiskCache: boolean() | nil,
  fromPrefetchCache: boolean() | nil,
  fromServiceWorker: boolean() | nil,
  headers: headers(),
  headersText: String.t() | nil,
  mimeType: String.t(),
  protocol: String.t() | nil,
  remoteIPAddress: String.t() | nil,
  remotePort: integer() | nil,
  requestHeaders: headers() | nil,
  requestHeadersText: String.t() | nil,
  responseTime: time_since_epoch() | nil,
  securityDetails: security_details() | nil,
  securityState: CDPotion.Domain.Security.security_state(),
  serviceWorkerResponseSource: service_worker_response_source() | nil,
  status: integer(),
  statusText: String.t(),
  timing: resource_timing() | nil,
  url: String.t()
}

HTTP response data.

Link to this type

security_details()

@type security_details() :: %{
  certificateId: CDPotion.Domain.Security.certificate_id(),
  certificateTransparencyCompliance: certificate_transparency_compliance(),
  cipher: String.t(),
  encryptedClientHello: boolean(),
  issuer: String.t(),
  keyExchange: String.t(),
  keyExchangeGroup: String.t() | nil,
  mac: String.t() | nil,
  protocol: String.t(),
  sanList: [String.t()],
  serverSignatureAlgorithm: integer() | nil,
  signedCertificateTimestampList: [signed_certificate_timestamp()],
  subjectName: String.t(),
  validFrom: time_since_epoch(),
  validTo: time_since_epoch()
}

Security details about a request.

Link to this type

security_isolation_status()

@type security_isolation_status() :: %{
  coep: cross_origin_embedder_policy_status() | nil,
  coop: cross_origin_opener_policy_status() | nil,
  csp: [content_security_policy_status()] | nil
}

description not provided :(

Link to this type

service_worker_response_source()

@type service_worker_response_source() ::
  :"cache-storage" | :"http-cache" | :"fallback-code" | :network

Source of serviceworker response.

Link to this type

signed_certificate_timestamp()

@type signed_certificate_timestamp() :: %{
  hashAlgorithm: String.t(),
  logDescription: String.t(),
  logId: String.t(),
  origin: String.t(),
  signatureAlgorithm: String.t(),
  signatureData: String.t(),
  status: String.t(),
  timestamp: number()
}

Details of a signed certificate timestamp (SCT).

Link to this type

signed_exchange_error()

@type signed_exchange_error() :: %{
  errorField: signed_exchange_error_field() | nil,
  message: String.t(),
  signatureIndex: integer() | nil
}

Information about a signed exchange response.

Link to this type

signed_exchange_error_field()

@type signed_exchange_error_field() ::
  :signatureSig
  | :signatureIntegrity
  | :signatureCertUrl
  | :signatureCertSha256
  | :signatureValidityUrl
  | :signatureTimestamps

Field type for a signed exchange related error.

Link to this type

signed_exchange_header()

@type signed_exchange_header() :: %{
  headerIntegrity: String.t(),
  requestUrl: String.t(),
  responseCode: integer(),
  responseHeaders: headers(),
  signatures: [signed_exchange_signature()]
}

Information about a signed exchange header. https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation

Link to this type

signed_exchange_info()

@type signed_exchange_info() :: %{
  errors: [signed_exchange_error()] | nil,
  header: signed_exchange_header() | nil,
  outerResponse: response(),
  securityDetails: security_details() | nil
}

Information about a signed exchange response.

Link to this type

signed_exchange_signature()

@type signed_exchange_signature() :: %{
  certSha256: String.t() | nil,
  certUrl: String.t() | nil,
  certificates: [String.t()] | nil,
  date: integer(),
  expires: integer(),
  integrity: String.t(),
  label: String.t(),
  signature: String.t(),
  validityUrl: String.t()
}

Information about a signed exchange signature. https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1

Link to this type

time_since_epoch()

@type time_since_epoch() :: number()

UTC time in seconds, counted from January 1, 1970.

Link to this type

trust_token_operation_type()

@type trust_token_operation_type() :: :Issuance | :Redemption | :Signing

description not provided :(

Link to this type

trust_token_params()

@type trust_token_params() :: %{
  issuers: [String.t()] | nil,
  operation: trust_token_operation_type(),
  refreshPolicy: :UseCached | :Refresh
}

Determines what type of Trust Token operation is executed and depending on the type, some additional parameters. The values are specified in third_party/blink/renderer/core/fetch/trust_token.idl.

Link to this type

web_socket_frame()

@type web_socket_frame() :: %{
  mask: boolean(),
  opcode: number(),
  payloadData: String.t()
}

WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests.

Link to this type

web_socket_request()

@type web_socket_request() :: %{headers: headers()}

WebSocket request data.

Link to this type

web_socket_response()

@type web_socket_response() :: %{
  headers: headers(),
  headersText: String.t() | nil,
  requestHeaders: headers() | nil,
  requestHeadersText: String.t() | nil,
  status: integer(),
  statusText: String.t()
}

WebSocket response data.

Functions

Link to this function

can_clear_browser_cache()

@spec can_clear_browser_cache() :: {String.t(), map()}

Tells whether clearing browser cache is supported.

Link to this function

can_clear_browser_cookies()

@spec can_clear_browser_cookies() :: {String.t(), map()}

Tells whether clearing browser cookies is supported.

Link to this function

can_emulate_network_conditions()

@spec can_emulate_network_conditions() :: {String.t(), map()}

Tells whether emulation of network conditions is supported.

Link to this function

clear_accepted_encodings_override()

@spec clear_accepted_encodings_override() :: {String.t(), map()}

Clears accepted encodings set by setAcceptedEncodings

Link to this function

clear_browser_cache()

@spec clear_browser_cache() :: {String.t(), map()}

Clears browser cache.

Link to this function

clear_browser_cookies()

@spec clear_browser_cookies() :: {String.t(), map()}

Clears browser cookies.

Link to this function

continue_intercepted_request(interception_id, error_reason \\ nil, raw_response \\ nil, url \\ nil, method \\ nil, post_data \\ nil, headers \\ nil, auth_challenge_response \\ nil)

@spec continue_intercepted_request(
  interception_id(),
  error_reason(),
  String.t(),
  String.t(),
  String.t(),
  String.t(),
  headers(),
  auth_challenge_response()
) :: {String.t(), map()}

Response to Network.requestIntercepted which either modifies the request to continue with any modifications, or blocks it, or completes it with the provided response bytes. If a network fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted event will be sent with the same InterceptionId. Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead.

Parameters:

  • (Required) interception_id: description not provided :(
  • (Optional) error_reason: If set this causes the request to fail with the given reason. Passing Aborted for requests marked with isNavigationRequest also cancels the navigation. Must not be set in response to an authChallenge.
  • (Optional) raw_response: If 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)
  • (Optional) url: If 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.
  • (Optional) method: If set this allows the request method to be overridden. Must not be set in response to an authChallenge.
  • (Optional) post_data: If set this allows postData to be set. Must not be set in response to an authChallenge.
  • (Optional) headers: If set this allows the request headers to be changed. Must not be set in response to an authChallenge.
  • (Optional) auth_challenge_response: Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
Link to this function

delete_cookies(name, url \\ nil, domain \\ nil, path \\ nil)

@spec delete_cookies(String.t(), String.t(), String.t(), String.t()) ::
  {String.t(), map()}

Deletes browser cookies with matching name and url or domain/path pair.

Parameters:

  • (Required) name: Name of the cookies to remove.
  • (Optional) url: If specified, deletes all the cookies with the given name where domain and path match provided URL.
  • (Optional) domain: If specified, deletes only cookies with the exact domain.
  • (Optional) path: If specified, deletes only cookies with the exact path.
@spec disable() :: {String.t(), map()}

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

Link to this function

emulate_network_conditions(offline, latency, download_throughput, upload_throughput, connection_type \\ nil)

@spec emulate_network_conditions(
  boolean(),
  number(),
  number(),
  number(),
  connection_type()
) :: {String.t(), map()}

Activates emulation of network conditions.

Parameters:

  • (Required) offline: True to emulate internet disconnection.
  • (Required) latency: Minimum latency from request sent to response headers received (ms).
  • (Required) download_throughput: Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
  • (Required) upload_throughput: Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.
  • (Optional) connection_type: Connection type if known.
Link to this function

enable(max_total_buffer_size \\ nil, max_resource_buffer_size \\ nil, max_post_data_size \\ nil)

@spec enable(integer(), integer(), integer()) :: {String.t(), map()}

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

Parameters:

  • (Optional) max_total_buffer_size: Buffer size in bytes to use when preserving network payloads (XHRs, etc).
  • (Optional) max_resource_buffer_size: Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
  • (Optional) max_post_data_size: Longest post body size (in bytes) that would be included in requestWillBeSent notification
Link to this function

enable_reporting_api(enable)

@spec enable_reporting_api(boolean()) :: {String.t(), map()}

Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client. Enabling triggers 'reportingApiReportAdded' for all existing reports.

Parameters:

  • (Required) enable: Whether to enable or disable events for the Reporting API
Link to this function

get_all_cookies()

@spec get_all_cookies() :: {String.t(), map()}

Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies field. Deprecated. Use Storage.getCookies instead.

Link to this function

get_certificate(origin)

@spec get_certificate(String.t()) :: {String.t(), map()}

Returns the DER-encoded certificate.

Parameters:

  • (Required) origin: Origin to get certificate for.
Link to this function

get_cookies(urls \\ nil)

@spec get_cookies([String.t()]) :: {String.t(), map()}

Returns all browser cookies for the current URL. Depending on the backend support, will return detailed cookie information in the cookies field.

Parameters:

  • (Optional) urls: The 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.
Link to this function

get_request_post_data(request_id)

@spec get_request_post_data(request_id()) :: {String.t(), map()}

Returns post data sent with the request. Returns an error when no data was sent with the request.

Parameters:

  • (Required) request_id: Identifier of the network request to get content for.
Link to this function

get_response_body(request_id)

@spec get_response_body(request_id()) :: {String.t(), map()}

Returns content served for the given request.

Parameters:

  • (Required) request_id: Identifier of the network request to get content for.
Link to this function

get_response_body_for_interception(interception_id)

@spec get_response_body_for_interception(interception_id()) :: {String.t(), map()}

Returns content served for the given currently intercepted request.

Parameters:

  • (Required) interception_id: Identifier for the intercepted request to get body for.
Link to this function

get_security_isolation_status(frame_id \\ nil)

@spec get_security_isolation_status(CDPotion.Domain.Page.frame_id()) ::
  {String.t(), map()}

Returns information about the COEP/COOP isolation status.

Parameters:

  • (Optional) frame_id: If no frameId is provided, the status of the target is provided.
Link to this function

load_network_resource(frame_id \\ nil, url, options)

@spec load_network_resource(
  CDPotion.Domain.Page.frame_id(),
  String.t(),
  load_network_resource_options()
) :: {String.t(), map()}

Fetches the resource and returns the content.

Parameters:

  • (Optional) frame_id: Frame id to get the resource for. Mandatory for frame targets, and should be omitted for worker targets.
  • (Required) url: URL of the resource to get content for.
  • (Required) options: Options for the request.
Link to this function

replay_xhr(request_id)

@spec replay_xhr(request_id()) :: {String.t(), map()}

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.

Parameters:

  • (Required) request_id: Identifier of XHR to replay.
Link to this function

search_in_response_body(request_id, query, case_sensitive \\ nil, is_regex \\ nil)

@spec search_in_response_body(
  request_id(),
  String.t(),
  boolean(),
  boolean()
) :: {String.t(), map()}

Searches for given string in response content.

Parameters:

  • (Required) request_id: Identifier of the network response to search.
  • (Required) query: String to search for.
  • (Optional) case_sensitive: If true, search is case sensitive.
  • (Optional) is_regex: If true, treats string parameter as regex.
Link to this function

set_accepted_encodings(encodings)

@spec set_accepted_encodings([content_encoding()]) :: {String.t(), map()}

Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted.

Parameters:

  • (Required) encodings: List of accepted content encodings.
Link to this function

set_attach_debug_stack(enabled)

@spec set_attach_debug_stack(boolean()) :: {String.t(), map()}

Specifies whether to attach a page script stack id in requests

Parameters:

  • (Required) enabled: Whether to attach a page script stack for debugging purpose.
Link to this function

set_blocked_ur_ls(urls)

@spec set_blocked_ur_ls([String.t()]) :: {String.t(), map()}

Blocks URLs from loading.

Parameters:

  • (Required) urls: URL patterns to block. Wildcards ('*') are allowed.
Link to this function

set_bypass_service_worker(bypass)

@spec set_bypass_service_worker(boolean()) :: {String.t(), map()}

Toggles ignoring of service worker for each request.

Parameters:

  • (Required) bypass: Bypass service worker and load from network.
Link to this function

set_cache_disabled(cache_disabled)

@spec set_cache_disabled(boolean()) :: {String.t(), map()}

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

Parameters:

  • (Required) cache_disabled: Cache disabled state.
Link to this function

set_cookie(name, value, url \\ nil, domain \\ nil, path \\ nil, secure \\ nil, http_only \\ nil, same_site \\ nil, expires \\ nil, priority \\ nil, same_party \\ nil, source_scheme \\ nil, source_port \\ nil, partition_key \\ nil)

Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.

Parameters:

  • (Required) name: Cookie name.
  • (Required) value: Cookie value.
  • (Optional) url: The 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.
  • (Optional) domain: Cookie domain.
  • (Optional) path: Cookie path.
  • (Optional) secure: True if cookie is secure.
  • (Optional) http_only: True if cookie is http-only.
  • (Optional) same_site: Cookie SameSite type.
  • (Optional) expires: Cookie expiration date, session cookie if not set
  • (Optional) priority: Cookie Priority type.
  • (Optional) same_party: True if cookie is SameParty.
  • (Optional) source_scheme: Cookie source scheme type.
  • (Optional) source_port: 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.
  • (Optional) partition_key: Cookie partition key. The site of the top-level URL the browser was visiting at the start of the request to the endpoint that set the cookie. If not set, the cookie will be set as not partitioned.
Link to this function

set_cookies(cookies)

@spec set_cookies([cookie_param()]) :: {String.t(), map()}

Sets given cookies.

Parameters:

  • (Required) cookies: Cookies to be set.
Link to this function

set_extra_http_headers(headers)

@spec set_extra_http_headers(headers()) :: {String.t(), map()}

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

Parameters:

  • (Required) headers: Map with extra HTTP headers.
Link to this function

set_request_interception(patterns)

@spec set_request_interception([request_pattern()]) :: {String.t(), map()}

Sets the requests to intercept that match the provided patterns and optionally resource types. Deprecated, please use Fetch.enable instead.

Parameters:

  • (Required) patterns: Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call.
Link to this function

set_user_agent_override(user_agent, accept_language \\ nil, platform \\ nil, user_agent_metadata \\ nil)

@spec set_user_agent_override(
  String.t(),
  String.t(),
  String.t(),
  CDPotion.Domain.Emulation.user_agent_metadata()
) :: {String.t(), map()}

Allows overriding user agent with the given string.

Parameters:

  • (Required) user_agent: User agent to use.
  • (Optional) accept_language: Browser langugage to emulate.
  • (Optional) platform: The platform navigator.platform should return.
  • (Optional) user_agent_metadata: To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
Link to this function

take_response_body_for_interception_as_stream(interception_id)

@spec take_response_body_for_interception_as_stream(interception_id()) ::
  {String.t(), map()}

Returns a handle to the stream representing the response body. Note that after this command, the intercepted request can't be continued as is -- you either need to cancel it or to provide the response body. The stream only supports sequential read, IO.read will fail if the position is specified.

Parameters:

  • (Required) interception_id: description not provided :(