Updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-08-21 06:56:21 +07:00
parent 7123283c3e
commit b2d9420f0c
23 changed files with 2169 additions and 668 deletions

77
cdp/audits/audits.go Normal file
View File

@ -0,0 +1,77 @@
// Package audits provides the Chrome Debugging Protocol
// commands, types, and events for the Audits domain.
//
// Audits domain allows investigation of page violations and possible
// improvements.
//
// Generated by the chromedp-gen command.
package audits
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/network"
)
// GetEncodedResponseParams returns the response body and size if it were
// re-encoded with the specified settings. Only applies to images.
type GetEncodedResponseParams struct {
RequestID network.RequestID `json:"requestId"` // Identifier of the network request to get content for.
Encoding GetEncodedResponseEncoding `json:"encoding"` // The encoding to use.
Quality float64 `json:"quality,omitempty"` // The quality of the encoding (0-1). (defaults to 1)
SizeOnly bool `json:"sizeOnly,omitempty"` // Whether to only return the size information (defaults to false).
}
// GetEncodedResponse returns the response body and size if it were
// re-encoded with the specified settings. Only applies to images.
//
// parameters:
// requestID - Identifier of the network request to get content for.
// encoding - The encoding to use.
func GetEncodedResponse(requestID network.RequestID, encoding GetEncodedResponseEncoding) *GetEncodedResponseParams {
return &GetEncodedResponseParams{
RequestID: requestID,
Encoding: encoding,
}
}
// WithQuality the quality of the encoding (0-1). (defaults to 1).
func (p GetEncodedResponseParams) WithQuality(quality float64) *GetEncodedResponseParams {
p.Quality = quality
return &p
}
// WithSizeOnly whether to only return the size information (defaults to
// false).
func (p GetEncodedResponseParams) WithSizeOnly(sizeOnly bool) *GetEncodedResponseParams {
p.SizeOnly = sizeOnly
return &p
}
// GetEncodedResponseReturns return values.
type GetEncodedResponseReturns struct {
Body string `json:"body,omitempty"` // The encoded body as a base64 string. Omitted if sizeOnly is true.
OriginalSize int64 `json:"originalSize,omitempty"` // Size before re-encoding.
EncodedSize int64 `json:"encodedSize,omitempty"` // Size after re-encoding.
}
// Do executes Audits.getEncodedResponse against the provided context and
// target handler.
//
// returns:
// body - The encoded body as a base64 string. Omitted if sizeOnly is true.
// originalSize - Size before re-encoding.
// encodedSize - Size after re-encoding.
func (p *GetEncodedResponseParams) Do(ctxt context.Context, h cdp.Handler) (body string, originalSize int64, encodedSize int64, err error) {
// execute
var res GetEncodedResponseReturns
err = h.Execute(ctxt, cdp.CommandAuditsGetEncodedResponse, p, &res)
if err != nil {
return "", 0, 0, err
}
return res.Body, res.OriginalSize, res.EncodedSize, nil
}

204
cdp/audits/easyjson.go Normal file
View File

@ -0,0 +1,204 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package audits
import (
json "encoding/json"
network "github.com/knq/chromedp/cdp/network"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jlexer.Lexer
_ *jwriter.Writer
_ easyjson.Marshaler
)
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAudits(in *jlexer.Lexer, out *GetEncodedResponseReturns) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "body":
out.Body = string(in.String())
case "originalSize":
out.OriginalSize = int64(in.Int64())
case "encodedSize":
out.EncodedSize = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAudits(out *jwriter.Writer, in GetEncodedResponseReturns) {
out.RawByte('{')
first := true
_ = first
if in.Body != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"body\":")
out.String(string(in.Body))
}
if in.OriginalSize != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"originalSize\":")
out.Int64(int64(in.OriginalSize))
}
if in.EncodedSize != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"encodedSize\":")
out.Int64(int64(in.EncodedSize))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetEncodedResponseReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAudits(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetEncodedResponseReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAudits(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetEncodedResponseReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAudits(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetEncodedResponseReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAudits(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAudits1(in *jlexer.Lexer, out *GetEncodedResponseParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "requestId":
out.RequestID = network.RequestID(in.String())
case "encoding":
(out.Encoding).UnmarshalEasyJSON(in)
case "quality":
out.Quality = float64(in.Float64())
case "sizeOnly":
out.SizeOnly = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAudits1(out *jwriter.Writer, in GetEncodedResponseParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"requestId\":")
out.String(string(in.RequestID))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"encoding\":")
(in.Encoding).MarshalEasyJSON(out)
if in.Quality != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"quality\":")
out.Float64(float64(in.Quality))
}
if in.SizeOnly {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"sizeOnly\":")
out.Bool(bool(in.SizeOnly))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetEncodedResponseParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAudits1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetEncodedResponseParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpAudits1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetEncodedResponseParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAudits1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetEncodedResponseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpAudits1(l, v)
}

56
cdp/audits/types.go Normal file
View File

@ -0,0 +1,56 @@
package audits
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// GetEncodedResponseEncoding the encoding to use.
type GetEncodedResponseEncoding string
// String returns the GetEncodedResponseEncoding as string value.
func (t GetEncodedResponseEncoding) String() string {
return string(t)
}
// GetEncodedResponseEncoding values.
const (
GetEncodedResponseEncodingWebp GetEncodedResponseEncoding = "webp"
GetEncodedResponseEncodingJpeg GetEncodedResponseEncoding = "jpeg"
GetEncodedResponseEncodingPng GetEncodedResponseEncoding = "png"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t GetEncodedResponseEncoding) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t GetEncodedResponseEncoding) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *GetEncodedResponseEncoding) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch GetEncodedResponseEncoding(in.String()) {
case GetEncodedResponseEncodingWebp:
*t = GetEncodedResponseEncodingWebp
case GetEncodedResponseEncodingJpeg:
*t = GetEncodedResponseEncodingJpeg
case GetEncodedResponseEncodingPng:
*t = GetEncodedResponseEncodingPng
default:
in.AddError(errors.New("unknown GetEncodedResponseEncoding value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *GetEncodedResponseEncoding) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -56,6 +56,7 @@ const (
CommandMemoryGetDOMCounters MethodType = "Memory.getDOMCounters"
CommandMemorySetPressureNotificationsSuppressed MethodType = "Memory.setPressureNotificationsSuppressed"
CommandMemorySimulatePressureNotification MethodType = "Memory.simulatePressureNotification"
EventPerformanceMetrics MethodType = "Performance.metrics"
CommandPerformanceEnable MethodType = "Performance.enable"
CommandPerformanceDisable MethodType = "Performance.disable"
CommandPerformanceGetMetrics MethodType = "Performance.getMetrics"
@ -141,6 +142,7 @@ const (
CommandSecurityDisable MethodType = "Security.disable"
CommandSecurityHandleCertificateError MethodType = "Security.handleCertificateError"
CommandSecuritySetOverrideCertificateErrors MethodType = "Security.setOverrideCertificateErrors"
CommandAuditsGetEncodedResponse MethodType = "Audits.getEncodedResponse"
EventNetworkResourceChangedPriority MethodType = "Network.resourceChangedPriority"
EventNetworkRequestWillBeSent MethodType = "Network.requestWillBeSent"
EventNetworkRequestServedFromCache MethodType = "Network.requestServedFromCache"
@ -170,8 +172,9 @@ const (
CommandNetworkClearBrowserCookies MethodType = "Network.clearBrowserCookies"
CommandNetworkGetCookies MethodType = "Network.getCookies"
CommandNetworkGetAllCookies MethodType = "Network.getAllCookies"
CommandNetworkDeleteCookie MethodType = "Network.deleteCookie"
CommandNetworkDeleteCookies MethodType = "Network.deleteCookies"
CommandNetworkSetCookie MethodType = "Network.setCookie"
CommandNetworkSetCookies MethodType = "Network.setCookies"
CommandNetworkCanEmulateNetworkConditions MethodType = "Network.canEmulateNetworkConditions"
CommandNetworkEmulateNetworkConditions MethodType = "Network.emulateNetworkConditions"
CommandNetworkSetCacheDisabled MethodType = "Network.setCacheDisabled"
@ -379,8 +382,12 @@ const (
CommandAnimationReleaseAnimations MethodType = "Animation.releaseAnimations"
CommandAnimationResolveAnimation MethodType = "Animation.resolveAnimation"
CommandAccessibilityGetPartialAXTree MethodType = "Accessibility.getPartialAXTree"
EventStorageCacheStorageListUpdated MethodType = "Storage.cacheStorageListUpdated"
EventStorageCacheStorageContentUpdated MethodType = "Storage.cacheStorageContentUpdated"
CommandStorageClearDataForOrigin MethodType = "Storage.clearDataForOrigin"
CommandStorageGetUsageAndQuota MethodType = "Storage.getUsageAndQuota"
CommandStorageTrackCacheStorageForOrigin MethodType = "Storage.trackCacheStorageForOrigin"
CommandStorageUntrackCacheStorageForOrigin MethodType = "Storage.untrackCacheStorageForOrigin"
EventLogEntryAdded MethodType = "Log.entryAdded"
CommandLogEnable MethodType = "Log.enable"
CommandLogDisable MethodType = "Log.disable"
@ -502,6 +509,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandMemorySetPressureNotificationsSuppressed
case CommandMemorySimulatePressureNotification:
*t = CommandMemorySimulatePressureNotification
case EventPerformanceMetrics:
*t = EventPerformanceMetrics
case CommandPerformanceEnable:
*t = CommandPerformanceEnable
case CommandPerformanceDisable:
@ -672,6 +681,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandSecurityHandleCertificateError
case CommandSecuritySetOverrideCertificateErrors:
*t = CommandSecuritySetOverrideCertificateErrors
case CommandAuditsGetEncodedResponse:
*t = CommandAuditsGetEncodedResponse
case EventNetworkResourceChangedPriority:
*t = EventNetworkResourceChangedPriority
case EventNetworkRequestWillBeSent:
@ -730,10 +741,12 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandNetworkGetCookies
case CommandNetworkGetAllCookies:
*t = CommandNetworkGetAllCookies
case CommandNetworkDeleteCookie:
*t = CommandNetworkDeleteCookie
case CommandNetworkDeleteCookies:
*t = CommandNetworkDeleteCookies
case CommandNetworkSetCookie:
*t = CommandNetworkSetCookie
case CommandNetworkSetCookies:
*t = CommandNetworkSetCookies
case CommandNetworkCanEmulateNetworkConditions:
*t = CommandNetworkCanEmulateNetworkConditions
case CommandNetworkEmulateNetworkConditions:
@ -1148,10 +1161,18 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandAnimationResolveAnimation
case CommandAccessibilityGetPartialAXTree:
*t = CommandAccessibilityGetPartialAXTree
case EventStorageCacheStorageListUpdated:
*t = EventStorageCacheStorageListUpdated
case EventStorageCacheStorageContentUpdated:
*t = EventStorageCacheStorageContentUpdated
case CommandStorageClearDataForOrigin:
*t = CommandStorageClearDataForOrigin
case CommandStorageGetUsageAndQuota:
*t = CommandStorageGetUsageAndQuota
case CommandStorageTrackCacheStorageForOrigin:
*t = CommandStorageTrackCacheStorageForOrigin
case CommandStorageUntrackCacheStorageForOrigin:
*t = CommandStorageUntrackCacheStorageForOrigin
case EventLogEntryAdded:
*t = EventLogEntryAdded
case CommandLogEnable:

View File

@ -9,6 +9,7 @@ import (
"github.com/knq/chromedp/cdp/accessibility"
"github.com/knq/chromedp/cdp/animation"
"github.com/knq/chromedp/cdp/applicationcache"
"github.com/knq/chromedp/cdp/audits"
"github.com/knq/chromedp/cdp/browser"
"github.com/knq/chromedp/cdp/cachestorage"
"github.com/knq/chromedp/cdp/css"
@ -81,6 +82,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandPerformanceGetMetrics:
v = new(performance.GetMetricsReturns)
case cdp.EventPerformanceMetrics:
v = new(performance.EventMetrics)
case cdp.CommandPageEnable:
return emptyVal, nil
@ -327,6 +331,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.EventSecurityCertificateError:
v = new(security.EventCertificateError)
case cdp.CommandAuditsGetEncodedResponse:
v = new(audits.GetEncodedResponseReturns)
case cdp.CommandNetworkEnable:
return emptyVal, nil
@ -366,12 +373,15 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandNetworkGetAllCookies:
v = new(network.GetAllCookiesReturns)
case cdp.CommandNetworkDeleteCookie:
case cdp.CommandNetworkDeleteCookies:
return emptyVal, nil
case cdp.CommandNetworkSetCookie:
v = new(network.SetCookieReturns)
case cdp.CommandNetworkSetCookies:
return emptyVal, nil
case cdp.CommandNetworkCanEmulateNetworkConditions:
v = new(network.CanEmulateNetworkConditionsReturns)
@ -1047,6 +1057,18 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandStorageGetUsageAndQuota:
v = new(storage.GetUsageAndQuotaReturns)
case cdp.CommandStorageTrackCacheStorageForOrigin:
return emptyVal, nil
case cdp.CommandStorageUntrackCacheStorageForOrigin:
return emptyVal, nil
case cdp.EventStorageCacheStorageListUpdated:
v = new(storage.EventCacheStorageListUpdated)
case cdp.EventStorageCacheStorageContentUpdated:
v = new(storage.EventCacheStorageContentUpdated)
case cdp.CommandLogEnable:
return emptyVal, nil

View File

@ -488,17 +488,34 @@ func (p *RemoveAttributeParams) Do(ctxt context.Context, h cdp.Handler) (err err
// GetOuterHTMLParams returns node's HTML markup.
type GetOuterHTMLParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node to get markup for.
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Identifier of the node.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Identifier of the backend node.
ObjectID runtime.RemoteObjectID `json:"objectId,omitempty"` // JavaScript object id of the node wrapper.
}
// GetOuterHTML returns node's HTML markup.
//
// parameters:
// nodeID - Id of the node to get markup for.
func GetOuterHTML(nodeID cdp.NodeID) *GetOuterHTMLParams {
return &GetOuterHTMLParams{
NodeID: nodeID,
}
func GetOuterHTML() *GetOuterHTMLParams {
return &GetOuterHTMLParams{}
}
// WithNodeID identifier of the node.
func (p GetOuterHTMLParams) WithNodeID(nodeID cdp.NodeID) *GetOuterHTMLParams {
p.NodeID = nodeID
return &p
}
// WithBackendNodeID identifier of the backend node.
func (p GetOuterHTMLParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *GetOuterHTMLParams {
p.BackendNodeID = backendNodeID
return &p
}
// WithObjectID javaScript object id of the node wrapper.
func (p GetOuterHTMLParams) WithObjectID(objectID runtime.RemoteObjectID) *GetOuterHTMLParams {
p.ObjectID = objectID
return &p
}
// GetOuterHTMLReturns return values.

View File

@ -3035,6 +3035,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDom37(in *jlexer.Lexer, out *G
switch key {
case "nodeId":
(out.NodeID).UnmarshalEasyJSON(in)
case "backendNodeId":
(out.BackendNodeID).UnmarshalEasyJSON(in)
case "objectId":
out.ObjectID = runtime.RemoteObjectID(in.String())
default:
in.SkipRecursive()
}
@ -3049,12 +3053,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDom37(out *jwriter.Writer, in
out.RawByte('{')
first := true
_ = first
if in.NodeID != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"nodeId\":")
out.Int64(int64(in.NodeID))
}
if in.BackendNodeID != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"backendNodeId\":")
out.Int64(int64(in.BackendNodeID))
}
if in.ObjectID != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"objectId\":")
out.String(string(in.ObjectID))
}
out.RawByte('}')
}

View File

@ -36,8 +36,6 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput(in *jlexer.Lexer, out *T
continue
}
switch key {
case "state":
(out.State).UnmarshalEasyJSON(in)
case "x":
out.X = int64(in.Int64())
case "y":
@ -70,12 +68,6 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput(out *jwriter.Writer, in
out.RawByte(',')
}
first = false
out.RawString("\"state\":")
(in.State).MarshalEasyJSON(out)
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"x\":")
out.Int64(int64(in.X))
if !first {
@ -943,6 +935,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInput7(in *jlexer.Lexer, out *
(out.Button).UnmarshalEasyJSON(in)
case "clickCount":
out.ClickCount = int64(in.Int64())
case "deltaX":
out.DeltaX = float64(in.Float64())
case "deltaY":
out.DeltaY = float64(in.Float64())
default:
in.SkipRecursive()
}
@ -1011,6 +1007,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInput7(out *jwriter.Writer, in
out.RawString("\"clickCount\":")
out.Int64(int64(in.ClickCount))
}
if in.DeltaX != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"deltaX\":")
out.Float64(float64(in.DeltaX))
}
if in.DeltaY != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"deltaY\":")
out.Float64(float64(in.DeltaY))
}
out.RawByte('}')
}

View File

@ -158,6 +158,8 @@ type DispatchMouseEventParams struct {
Timestamp *TimeSinceEpoch `json:"timestamp,omitempty"` // Time at which the event occurred.
Button ButtonType `json:"button,omitempty"` // Mouse button (default: "none").
ClickCount int64 `json:"clickCount,omitempty"` // Number of times the mouse button was clicked (default: 0).
DeltaX float64 `json:"deltaX,omitempty"` // X delta in CSS pixels for mouse wheel event (default: 0).
DeltaY float64 `json:"deltaY,omitempty"` // Y delta in CSS pixels for mouse wheel event (default: 0).
}
// DispatchMouseEvent dispatches a mouse event to the page.
@ -199,6 +201,18 @@ func (p DispatchMouseEventParams) WithClickCount(clickCount int64) *DispatchMous
return &p
}
// WithDeltaX x delta in CSS pixels for mouse wheel event (default: 0).
func (p DispatchMouseEventParams) WithDeltaX(deltaX float64) *DispatchMouseEventParams {
p.DeltaX = deltaX
return &p
}
// WithDeltaY y delta in CSS pixels for mouse wheel event (default: 0).
func (p DispatchMouseEventParams) WithDeltaY(deltaY float64) *DispatchMouseEventParams {
p.DeltaY = deltaY
return &p
}
// Do executes Input.dispatchMouseEvent against the provided context and
// target handler.
func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
@ -207,8 +221,8 @@ func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err
// DispatchTouchEventParams dispatches a touch event to the page.
type DispatchTouchEventParams struct {
Type TouchType `json:"type"` // Type of the touch event.
TouchPoints []*TouchPoint `json:"touchPoints"` // Touch points.
Type TouchType `json:"type"` // Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.
TouchPoints []*TouchPoint `json:"touchPoints"` // Active touch points on the touch device. One event per any changed point (compared to previous touch event in a sequence) is generated, emulating pressing/moving/releasing points one by one.
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
Timestamp *TimeSinceEpoch `json:"timestamp,omitempty"` // Time at which the event occurred.
}
@ -216,8 +230,8 @@ type DispatchTouchEventParams struct {
// DispatchTouchEvent dispatches a touch event to the page.
//
// parameters:
// type - Type of the touch event.
// touchPoints - Touch points.
// type - Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.
// touchPoints - Active touch points on the touch device. One event per any changed point (compared to previous touch event in a sequence) is generated, emulating pressing/moving/releasing points one by one.
func DispatchTouchEvent(typeVal TouchType, touchPoints []*TouchPoint) *DispatchTouchEventParams {
return &DispatchTouchEventParams{
Type: typeVal,

View File

@ -15,9 +15,8 @@ import (
// TouchPoint [no description].
type TouchPoint struct {
State TouchState `json:"state"` // State of the touch point.
X int64 `json:"x"` // X coordinate of the event relative to the main frame's viewport.
Y int64 `json:"y"` // Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
X int64 `json:"x"` // X coordinate of the event relative to the main frame's viewport in CSS pixels.
Y int64 `json:"y"` // Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
RadiusX int64 `json:"radiusX,omitempty"` // X radius of the touch area (default: 1).
RadiusY int64 `json:"radiusY,omitempty"` // Y radius of the touch area (default: 1).
RotationAngle float64 `json:"rotationAngle,omitempty"` // Rotation angle (default: 0.0).
@ -173,57 +172,6 @@ func (t *Modifier) UnmarshalJSON(buf []byte) error {
// ModifierCommand is an alias for ModifierMeta.
const ModifierCommand Modifier = ModifierMeta
// TouchState state of the touch point.
type TouchState string
// String returns the TouchState as string value.
func (t TouchState) String() string {
return string(t)
}
// TouchState values.
const (
TouchPressed TouchState = "touchPressed"
TouchReleased TouchState = "touchReleased"
TouchMoved TouchState = "touchMoved"
TouchStationary TouchState = "touchStationary"
TouchCanceled TouchState = "touchCancelled"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t TouchState) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t TouchState) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *TouchState) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch TouchState(in.String()) {
case TouchPressed:
*t = TouchPressed
case TouchReleased:
*t = TouchReleased
case TouchMoved:
*t = TouchMoved
case TouchStationary:
*t = TouchStationary
case TouchCanceled:
*t = TouchCanceled
default:
in.AddError(errors.New("unknown TouchState value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *TouchState) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// KeyType type of the key event.
type KeyType string
@ -368,7 +316,9 @@ func (t *ButtonType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// TouchType type of the touch event.
// TouchType type of the touch event. TouchEnd and TouchCancel must not
// contain any touch points, while TouchStart and TouchMove must contains at
// least one.
type TouchType string
// String returns the TouchType as string value.
@ -381,6 +331,7 @@ const (
TouchStart TouchType = "touchStart"
TouchEnd TouchType = "touchEnd"
TouchMove TouchType = "touchMove"
TouchCancel TouchType = "touchCancel"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
@ -402,6 +353,8 @@ func (t *TouchType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = TouchEnd
case TouchMove:
*t = TouchMove
case TouchCancel:
*t = TouchCancel
default:
in.AddError(errors.New("unknown TouchType value"))

File diff suppressed because it is too large Load Diff

View File

@ -371,93 +371,118 @@ func (p *GetAllCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies [
return res.Cookies, nil
}
// DeleteCookieParams deletes browser cookie with given name, domain and
// path.
type DeleteCookieParams struct {
CookieName string `json:"cookieName"` // Name of the cookie to remove.
URL string `json:"url"` // URL to match cooke domain and path.
// DeleteCookiesParams deletes browser cookies with matching name and url or
// domain/path pair.
type DeleteCookiesParams struct {
Name string `json:"name"` // Name of the cookies to remove.
URL string `json:"url,omitempty"` // If specified, deletes all the cookies with the given name where domain and path match provided URL.
Domain string `json:"domain,omitempty"` // If specified, deletes only cookies with the exact domain.
Path string `json:"path,omitempty"` // If specified, deletes only cookies with the exact path.
}
// DeleteCookie deletes browser cookie with given name, domain and path.
// DeleteCookies deletes browser cookies with matching name and url or
// domain/path pair.
//
// parameters:
// cookieName - Name of the cookie to remove.
// url - URL to match cooke domain and path.
func DeleteCookie(cookieName string, url string) *DeleteCookieParams {
return &DeleteCookieParams{
CookieName: cookieName,
URL: url,
// name - Name of the cookies to remove.
func DeleteCookies(name string) *DeleteCookiesParams {
return &DeleteCookiesParams{
Name: name,
}
}
// Do executes Network.deleteCookie against the provided context and
// WithURL if specified, deletes all the cookies with the given name where
// domain and path match provided URL.
func (p DeleteCookiesParams) WithURL(url string) *DeleteCookiesParams {
p.URL = url
return &p
}
// WithDomain if specified, deletes only cookies with the exact domain.
func (p DeleteCookiesParams) WithDomain(domain string) *DeleteCookiesParams {
p.Domain = domain
return &p
}
// WithPath if specified, deletes only cookies with the exact path.
func (p DeleteCookiesParams) WithPath(path string) *DeleteCookiesParams {
p.Path = path
return &p
}
// Do executes Network.deleteCookies against the provided context and
// target handler.
func (p *DeleteCookieParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkDeleteCookie, p, nil)
func (p *DeleteCookiesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkDeleteCookies, p, nil)
}
// SetCookieParams sets a cookie with the given cookie data; may overwrite
// equivalent cookies if they exist.
type SetCookieParams struct {
URL string `json:"url"` // The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie.
Name string `json:"name"` // The name of the cookie.
Value string `json:"value"` // The value of the cookie.
Domain string `json:"domain,omitempty"` // If omitted, the cookie becomes a host-only cookie.
Path string `json:"path,omitempty"` // Defaults to the path portion of the url parameter.
Secure bool `json:"secure,omitempty"` // Defaults ot false.
HTTPOnly bool `json:"httpOnly,omitempty"` // Defaults to false.
SameSite CookieSameSite `json:"sameSite,omitempty"` // Defaults to browser default behavior.
ExpirationDate *cdp.TimeSinceEpoch `json:"expirationDate,omitempty"` // If omitted, the cookie becomes a session cookie.
Name string `json:"name"` // Cookie name.
Value string `json:"value"` // Cookie value.
URL string `json:"url,omitempty"` // The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie.
Domain string `json:"domain,omitempty"` // Cookie domain.
Path string `json:"path,omitempty"` // Cookie path.
Secure bool `json:"secure,omitempty"` // True if cookie is secure.
HTTPOnly bool `json:"httpOnly,omitempty"` // True if cookie is http-only.
SameSite CookieSameSite `json:"sameSite,omitempty"` // Cookie SameSite type.
Expires *cdp.TimeSinceEpoch `json:"expires,omitempty"` // Cookie expiration date, session cookie if not set
}
// SetCookie sets a cookie with the given cookie data; may overwrite
// equivalent cookies if they exist.
//
// parameters:
// url - The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie.
// name - The name of the cookie.
// value - The value of the cookie.
func SetCookie(url string, name string, value string) *SetCookieParams {
// name - Cookie name.
// value - Cookie value.
func SetCookie(name string, value string) *SetCookieParams {
return &SetCookieParams{
URL: url,
Name: name,
Value: value,
}
}
// WithDomain if omitted, the cookie becomes a host-only cookie.
// WithURL the request-URI to associate with the setting of the cookie. This
// value can affect the default domain and path values of the created cookie.
func (p SetCookieParams) WithURL(url string) *SetCookieParams {
p.URL = url
return &p
}
// WithDomain cookie domain.
func (p SetCookieParams) WithDomain(domain string) *SetCookieParams {
p.Domain = domain
return &p
}
// WithPath defaults to the path portion of the url parameter.
// WithPath cookie path.
func (p SetCookieParams) WithPath(path string) *SetCookieParams {
p.Path = path
return &p
}
// WithSecure defaults ot false.
// WithSecure true if cookie is secure.
func (p SetCookieParams) WithSecure(secure bool) *SetCookieParams {
p.Secure = secure
return &p
}
// WithHTTPOnly defaults to false.
// WithHTTPOnly true if cookie is http-only.
func (p SetCookieParams) WithHTTPOnly(httpOnly bool) *SetCookieParams {
p.HTTPOnly = httpOnly
return &p
}
// WithSameSite defaults to browser default behavior.
// WithSameSite cookie SameSite type.
func (p SetCookieParams) WithSameSite(sameSite CookieSameSite) *SetCookieParams {
p.SameSite = sameSite
return &p
}
// WithExpirationDate if omitted, the cookie becomes a session cookie.
func (p SetCookieParams) WithExpirationDate(expirationDate *cdp.TimeSinceEpoch) *SetCookieParams {
p.ExpirationDate = expirationDate
// WithExpires cookie expiration date, session cookie if not set.
func (p SetCookieParams) WithExpires(expires *cdp.TimeSinceEpoch) *SetCookieParams {
p.Expires = expires
return &p
}
@ -482,6 +507,27 @@ func (p *SetCookieParams) Do(ctxt context.Context, h cdp.Handler) (success bool,
return res.Success, nil
}
// SetCookiesParams sets given cookies.
type SetCookiesParams struct {
Cookies []*CookieParam `json:"cookies"` // Cookies to be set.
}
// SetCookies sets given cookies.
//
// parameters:
// cookies - Cookies to be set.
func SetCookies(cookies []*CookieParam) *SetCookiesParams {
return &SetCookiesParams{
Cookies: cookies,
}
}
// Do executes Network.setCookies against the provided context and
// target handler.
func (p *SetCookiesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkSetCookies, p, nil)
}
// CanEmulateNetworkConditionsParams tells whether emulation of network
// conditions is supported.
type CanEmulateNetworkConditionsParams struct{}

View File

@ -452,6 +452,19 @@ type Cookie struct {
SameSite CookieSameSite `json:"sameSite,omitempty"` // Cookie SameSite type.
}
// CookieParam cookie parameter object.
type CookieParam struct {
Name string `json:"name"` // Cookie name.
Value string `json:"value"` // Cookie value.
URL string `json:"url,omitempty"` // The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie.
Domain string `json:"domain,omitempty"` // Cookie domain.
Path string `json:"path,omitempty"` // Cookie path.
Secure bool `json:"secure,omitempty"` // True if cookie is secure.
HTTPOnly bool `json:"httpOnly,omitempty"` // True if cookie is http-only.
SameSite CookieSameSite `json:"sameSite,omitempty"` // Cookie SameSite type.
Expires *cdp.TimeSinceEpoch `json:"expires,omitempty"` // Cookie expiration date, session cookie if not set
}
// AuthChallenge authorization challenge for HTTP status code 401 or 407.
type AuthChallenge struct {
Source AuthChallengeSource `json:"source,omitempty"` // Source of the authentication challenge.

View File

@ -1178,6 +1178,16 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpOverlay12(in *jlexer.Lexer, ou
}
case "selectorList":
out.SelectorList = string(in.String())
case "cssGridColor":
if in.IsNull() {
in.Skip()
out.CSSGridColor = nil
} else {
if out.CSSGridColor == nil {
out.CSSGridColor = new(cdp.RGBA)
}
(*out.CSSGridColor).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
@ -1316,6 +1326,18 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpOverlay12(out *jwriter.Writer,
out.RawString("\"selectorList\":")
out.String(string(in.SelectorList))
}
if in.CSSGridColor != nil {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"cssGridColor\":")
if in.CSSGridColor == nil {
out.RawString("null")
} else {
(*in.CSSGridColor).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}

View File

@ -25,6 +25,7 @@ type HighlightConfig struct {
ShapeColor *cdp.RGBA `json:"shapeColor,omitempty"` // The shape outside fill color (default: transparent).
ShapeMarginColor *cdp.RGBA `json:"shapeMarginColor,omitempty"` // The shape margin fill color (default: transparent).
SelectorList string `json:"selectorList,omitempty"` // Selectors to highlight relevant nodes.
CSSGridColor *cdp.RGBA `json:"cssGridColor,omitempty"` // The grid layout color (default: transparent).
}
// InspectMode [no description].

View File

@ -264,7 +264,126 @@ func (v *GetMetricsParams) UnmarshalJSON(data []byte) error {
func (v *GetMetricsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(in *jlexer.Lexer, out *EnableParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(in *jlexer.Lexer, out *EventMetrics) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "metrics":
if in.IsNull() {
in.Skip()
out.Metrics = nil
} else {
in.Delim('[')
if out.Metrics == nil {
if !in.IsDelim(']') {
out.Metrics = make([]*Metric, 0, 8)
} else {
out.Metrics = []*Metric{}
}
} else {
out.Metrics = (out.Metrics)[:0]
}
for !in.IsDelim(']') {
var v4 *Metric
if in.IsNull() {
in.Skip()
v4 = nil
} else {
if v4 == nil {
v4 = new(Metric)
}
(*v4).UnmarshalEasyJSON(in)
}
out.Metrics = append(out.Metrics, v4)
in.WantComma()
}
in.Delim(']')
}
case "title":
out.Title = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(out *jwriter.Writer, in EventMetrics) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"metrics\":")
if in.Metrics == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v5, v6 := range in.Metrics {
if v5 > 0 {
out.RawByte(',')
}
if v6 == nil {
out.RawString("null")
} else {
(*v6).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"title\":")
out.String(string(in.Title))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventMetrics) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventMetrics) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventMetrics) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventMetrics) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(in *jlexer.Lexer, out *EnableParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -293,7 +412,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(out *jwriter.Writer, in EnableParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
@ -303,27 +422,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(out *jwriter.Writ
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(in *jlexer.Lexer, out *DisableParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance5(in *jlexer.Lexer, out *DisableParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -352,7 +471,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(out *jwriter.Writer, in DisableParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance5(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
@ -362,23 +481,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(out *jwriter.Writ
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance5(l, v)
}

18
cdp/performance/events.go Normal file
View File

@ -0,0 +1,18 @@
package performance
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventMetrics current values of the metrics.
type EventMetrics struct {
Metrics []*Metric `json:"metrics"` // Current values of the metrics.
Title string `json:"title"` // Timestamp title.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventPerformanceMetrics,
}

View File

@ -29,7 +29,7 @@ type EvaluateParams struct {
ReturnByValue bool `json:"returnByValue,omitempty"` // Whether the result is expected to be a JSON object that should be sent by value.
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
UserGesture bool `json:"userGesture,omitempty"` // Whether execution should be treated as initiated by user in the UI.
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error.
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should await for resulting value and return once awaited promise is resolved.
}
// Evaluate evaluates expression on global object.
@ -91,8 +91,8 @@ func (p EvaluateParams) WithUserGesture(userGesture bool) *EvaluateParams {
return &p
}
// WithAwaitPromise whether execution should wait for promise to be resolved.
// If the result of evaluation is not a Promise, it's considered to be an error.
// WithAwaitPromise whether execution should await for resulting value and
// return once awaited promise is resolved.
func (p EvaluateParams) WithAwaitPromise(awaitPromise bool) *EvaluateParams {
p.AwaitPromise = awaitPromise
return &p
@ -184,7 +184,7 @@ type CallFunctionOnParams struct {
ReturnByValue bool `json:"returnByValue,omitempty"` // Whether the result is expected to be a JSON object which should be sent by value.
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
UserGesture bool `json:"userGesture,omitempty"` // Whether execution should be treated as initiated by user in the UI.
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error.
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should await for resulting value and return once awaited promise is resolved.
}
// CallFunctionOn calls function with given declaration on the given object.
@ -234,8 +234,8 @@ func (p CallFunctionOnParams) WithUserGesture(userGesture bool) *CallFunctionOnP
return &p
}
// WithAwaitPromise whether execution should wait for promise to be resolved.
// If the result of evaluation is not a Promise, it's considered to be an error.
// WithAwaitPromise whether execution should await for resulting value and
// return once awaited promise is resolved.
func (p CallFunctionOnParams) WithAwaitPromise(awaitPromise bool) *CallFunctionOnParams {
p.AwaitPromise = awaitPromise
return &p
@ -519,7 +519,7 @@ type RunScriptParams struct {
IncludeCommandLineAPI bool `json:"includeCommandLineAPI,omitempty"` // Determines whether Command Line API should be available during the evaluation.
ReturnByValue bool `json:"returnByValue,omitempty"` // Whether the result is expected to be a JSON object which should be sent by value.
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error.
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should await for resulting value and return once awaited promise is resolved.
}
// RunScript runs script with given id in a given context.
@ -574,8 +574,8 @@ func (p RunScriptParams) WithGeneratePreview(generatePreview bool) *RunScriptPar
return &p
}
// WithAwaitPromise whether execution should wait for promise to be resolved.
// If the result of evaluation is not a Promise, it's considered to be an error.
// WithAwaitPromise whether execution should await for resulting value and
// return once awaited promise is resolved.
func (p RunScriptParams) WithAwaitPromise(awaitPromise bool) *RunScriptParams {
p.AwaitPromise = awaitPromise
return &p

View File

@ -92,7 +92,141 @@ func (v *UsageForType) UnmarshalJSON(data []byte) error {
func (v *UsageForType) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(in *jlexer.Lexer, out *GetUsageAndQuotaReturns) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(in *jlexer.Lexer, out *UntrackCacheStorageForOriginParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "origin":
out.Origin = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(out *jwriter.Writer, in UntrackCacheStorageForOriginParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"origin\":")
out.String(string(in.Origin))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v UntrackCacheStorageForOriginParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v UntrackCacheStorageForOriginParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *UntrackCacheStorageForOriginParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *UntrackCacheStorageForOriginParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(in *jlexer.Lexer, out *TrackCacheStorageForOriginParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "origin":
out.Origin = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(out *jwriter.Writer, in TrackCacheStorageForOriginParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"origin\":")
out.String(string(in.Origin))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v TrackCacheStorageForOriginParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v TrackCacheStorageForOriginParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *TrackCacheStorageForOriginParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *TrackCacheStorageForOriginParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage3(in *jlexer.Lexer, out *GetUsageAndQuotaReturns) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -156,7 +290,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(in *jlexer.Lexer, out
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(out *jwriter.Writer, in GetUsageAndQuotaReturns) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage3(out *jwriter.Writer, in GetUsageAndQuotaReturns) {
out.RawByte('{')
first := true
_ = first
@ -205,27 +339,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(out *jwriter.Writer,
// MarshalJSON supports json.Marshaler interface
func (v GetUsageAndQuotaReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetUsageAndQuotaReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage1(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetUsageAndQuotaReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetUsageAndQuotaReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage1(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(in *jlexer.Lexer, out *GetUsageAndQuotaParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage4(in *jlexer.Lexer, out *GetUsageAndQuotaParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -256,7 +390,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(in *jlexer.Lexer, out
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(out *jwriter.Writer, in GetUsageAndQuotaParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage4(out *jwriter.Writer, in GetUsageAndQuotaParams) {
out.RawByte('{')
first := true
_ = first
@ -272,27 +406,169 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(out *jwriter.Writer,
// MarshalJSON supports json.Marshaler interface
func (v GetUsageAndQuotaParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetUsageAndQuotaParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage2(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetUsageAndQuotaParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetUsageAndQuotaParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage2(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage4(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage3(in *jlexer.Lexer, out *ClearDataForOriginParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage5(in *jlexer.Lexer, out *EventCacheStorageListUpdated) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "origin":
out.Origin = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage5(out *jwriter.Writer, in EventCacheStorageListUpdated) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"origin\":")
out.String(string(in.Origin))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventCacheStorageListUpdated) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventCacheStorageListUpdated) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventCacheStorageListUpdated) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventCacheStorageListUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage6(in *jlexer.Lexer, out *EventCacheStorageContentUpdated) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "origin":
out.Origin = string(in.String())
case "cacheName":
out.CacheName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage6(out *jwriter.Writer, in EventCacheStorageContentUpdated) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"origin\":")
out.String(string(in.Origin))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"cacheName\":")
out.String(string(in.CacheName))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventCacheStorageContentUpdated) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventCacheStorageContentUpdated) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventCacheStorageContentUpdated) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventCacheStorageContentUpdated) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage6(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage7(in *jlexer.Lexer, out *ClearDataForOriginParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -325,7 +601,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage3(in *jlexer.Lexer, out
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage3(out *jwriter.Writer, in ClearDataForOriginParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage7(out *jwriter.Writer, in ClearDataForOriginParams) {
out.RawByte('{')
first := true
_ = first
@ -347,23 +623,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage3(out *jwriter.Writer,
// MarshalJSON supports json.Marshaler interface
func (v ClearDataForOriginParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage3(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearDataForOriginParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage3(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpStorage7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearDataForOriginParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage3(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearDataForOriginParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage3(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpStorage7(l, v)
}

24
cdp/storage/events.go Normal file
View File

@ -0,0 +1,24 @@
package storage
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventCacheStorageListUpdated a cache has been added/deleted.
type EventCacheStorageListUpdated struct {
Origin string `json:"origin"` // Origin to update.
}
// EventCacheStorageContentUpdated a cache's contents have been modified.
type EventCacheStorageContentUpdated struct {
Origin string `json:"origin"` // Origin to update.
CacheName string `json:"cacheName"` // Name of cache in origin.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventStorageCacheStorageListUpdated,
cdp.EventStorageCacheStorageContentUpdated,
}

View File

@ -75,3 +75,49 @@ func (p *GetUsageAndQuotaParams) Do(ctxt context.Context, h cdp.Handler) (usage
return res.Usage, res.Quota, res.UsageBreakdown, nil
}
// TrackCacheStorageForOriginParams registers origin to be notified when an
// update occurs to its cache storage list.
type TrackCacheStorageForOriginParams struct {
Origin string `json:"origin"` // Security origin.
}
// TrackCacheStorageForOrigin registers origin to be notified when an update
// occurs to its cache storage list.
//
// parameters:
// origin - Security origin.
func TrackCacheStorageForOrigin(origin string) *TrackCacheStorageForOriginParams {
return &TrackCacheStorageForOriginParams{
Origin: origin,
}
}
// Do executes Storage.trackCacheStorageForOrigin against the provided context and
// target handler.
func (p *TrackCacheStorageForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandStorageTrackCacheStorageForOrigin, p, nil)
}
// UntrackCacheStorageForOriginParams unregisters origin from receiving
// notifications for cache storage.
type UntrackCacheStorageForOriginParams struct {
Origin string `json:"origin"` // Security origin.
}
// UntrackCacheStorageForOrigin unregisters origin from receiving
// notifications for cache storage.
//
// parameters:
// origin - Security origin.
func UntrackCacheStorageForOrigin(origin string) *UntrackCacheStorageForOriginParams {
return &UntrackCacheStorageForOriginParams{
Origin: origin,
}
}
// Do executes Storage.untrackCacheStorageForOrigin against the provided context and
// target handler.
func (p *UntrackCacheStorageForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandStorageUntrackCacheStorageForOrigin, p, nil)
}

View File

@ -15,6 +15,7 @@ const (
DomainAccessibility DomainType = "Accessibility"
DomainAnimation DomainType = "Animation"
DomainApplicationCache DomainType = "ApplicationCache"
DomainAudits DomainType = "Audits"
DomainBrowser DomainType = "Browser"
DomainCSS DomainType = "CSS"
DomainCacheStorage DomainType = "CacheStorage"
@ -76,6 +77,8 @@ func (dt *DomainType) UnmarshalJSON(buf []byte) error {
*dt = DomainAnimation
case DomainApplicationCache:
*dt = DomainApplicationCache
case DomainAudits:
*dt = DomainAudits
case DomainBrowser:
*dt = DomainBrowser
case DomainCSS:

View File

@ -137,6 +137,27 @@
],
"description": "Retrieve current values of run-time metrics."
}
],
"events": [
{
"name": "metrics",
"description": "Current values of the metrics.",
"parameters": [
{
"name": "metrics",
"type": "array",
"items": {
"$ref": "Metric"
},
"description": "Current values of the metrics."
},
{
"name": "title",
"type": "string",
"description": "Timestamp title."
}
]
}
]
},
{
@ -1645,6 +1666,12 @@
"type": "string",
"optional": true,
"description": "Selectors to highlight relevant nodes."
},
{
"name": "cssGridColor",
"$ref": "DOM.RGBA",
"optional": true,
"description": "The grid layout color (default: transparent)."
}
],
"description": "Configuration data for the highlighting of page elements."
@ -2457,6 +2484,67 @@
}
]
},
{
"domain": "Audits",
"description": "Audits domain allows investigation of page violations and possible improvements.",
"dependencies": [
"Network"
],
"experimental": true,
"commands": [
{
"name": "getEncodedResponse",
"description": "Returns the response body and size if it were re-encoded with the specified settings. Only applies to images.",
"parameters": [
{
"name": "requestId",
"$ref": "Network.RequestId",
"description": "Identifier of the network request to get content for."
},
{
"name": "encoding",
"type": "string",
"enum": [
"webp",
"jpeg",
"png"
],
"description": "The encoding to use."
},
{
"name": "quality",
"type": "number",
"optional": true,
"description": "The quality of the encoding (0-1). (defaults to 1)"
},
{
"name": "sizeOnly",
"type": "boolean",
"optional": true,
"description": "Whether to only return the size information (defaults to false)."
}
],
"returns": [
{
"name": "body",
"type": "string",
"optional": true,
"description": "The encoded body as a base64 string. Omitted if sizeOnly is true."
},
{
"name": "originalSize",
"type": "integer",
"description": "Size before re-encoding."
},
{
"name": "encodedSize",
"type": "integer",
"description": "Size after re-encoding."
}
]
}
]
},
{
"domain": "Network",
"description": "Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.",
@ -3153,6 +3241,66 @@
],
"experimental": true
},
{
"id": "CookieParam",
"type": "object",
"description": "Cookie parameter object",
"properties": [
{
"name": "name",
"type": "string",
"description": "Cookie name."
},
{
"name": "value",
"type": "string",
"description": "Cookie value."
},
{
"name": "url",
"type": "string",
"optional": true,
"description": "The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie."
},
{
"name": "domain",
"type": "string",
"optional": true,
"description": "Cookie domain."
},
{
"name": "path",
"type": "string",
"optional": true,
"description": "Cookie path."
},
{
"name": "secure",
"type": "boolean",
"optional": true,
"description": "True if cookie is secure."
},
{
"name": "httpOnly",
"type": "boolean",
"optional": true,
"description": "True if cookie is http-only."
},
{
"name": "sameSite",
"$ref": "CookieSameSite",
"optional": true,
"description": "Cookie SameSite type."
},
{
"name": "expires",
"$ref": "TimeSinceEpoch",
"optional": true,
"description": "Cookie expiration date, session cookie if not set"
}
],
"experimental": true
},
{
"id": "AuthChallenge",
"type": "object",
@ -3386,75 +3534,89 @@
"experimental": true
},
{
"name": "deleteCookie",
"name": "deleteCookies",
"parameters": [
{
"name": "cookieName",
"name": "name",
"type": "string",
"description": "Name of the cookie to remove."
"description": "Name of the cookies to remove."
},
{
"name": "url",
"type": "string",
"description": "URL to match cooke domain and path."
"optional": true,
"description": "If specified, deletes all the cookies with the given name where domain and path match provided URL."
},
{
"name": "domain",
"type": "string",
"optional": true,
"description": "If specified, deletes only cookies with the exact domain."
},
{
"name": "path",
"type": "string",
"optional": true,
"description": "If specified, deletes only cookies with the exact path."
}
],
"description": "Deletes browser cookie with given name, domain and path.",
"description": "Deletes browser cookies with matching name and url or domain/path pair.",
"experimental": true
},
{
"name": "setCookie",
"parameters": [
{
"name": "url",
"type": "string",
"description": "The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie."
},
{
"name": "name",
"type": "string",
"description": "The name of the cookie."
"description": "Cookie name."
},
{
"name": "value",
"type": "string",
"description": "The value of the cookie."
"description": "Cookie value."
},
{
"name": "url",
"type": "string",
"optional": true,
"description": "The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie."
},
{
"name": "domain",
"type": "string",
"optional": true,
"description": "If omitted, the cookie becomes a host-only cookie."
"description": "Cookie domain."
},
{
"name": "path",
"type": "string",
"optional": true,
"description": "Defaults to the path portion of the url parameter."
"description": "Cookie path."
},
{
"name": "secure",
"type": "boolean",
"optional": true,
"description": "Defaults ot false."
"description": "True if cookie is secure."
},
{
"name": "httpOnly",
"type": "boolean",
"optional": true,
"description": "Defaults to false."
"description": "True if cookie is http-only."
},
{
"name": "sameSite",
"$ref": "CookieSameSite",
"optional": true,
"description": "Defaults to browser default behavior."
"description": "Cookie SameSite type."
},
{
"name": "expirationDate",
"name": "expires",
"$ref": "TimeSinceEpoch",
"optional": true,
"description": "If omitted, the cookie becomes a session cookie."
"description": "Cookie expiration date, session cookie if not set"
}
],
"returns": [
@ -3467,6 +3629,21 @@
"description": "Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.",
"experimental": true
},
{
"name": "setCookies",
"parameters": [
{
"name": "cookies",
"type": "array",
"items": {
"$ref": "CookieParam"
},
"description": "Cookies to be set."
}
],
"description": "Sets given cookies.",
"experimental": true
},
{
"name": "canEmulateNetworkConditions",
"description": "Tells whether emulation of network conditions is supported.",
@ -5797,7 +5974,20 @@
{
"name": "nodeId",
"$ref": "NodeId",
"description": "Id of the node to get markup for."
"optional": true,
"description": "Identifier of the node."
},
{
"name": "backendNodeId",
"$ref": "BackendNodeId",
"optional": true,
"description": "Identifier of the backend node."
},
{
"name": "objectId",
"$ref": "Runtime.RemoteObjectId",
"optional": true,
"description": "JavaScript object id of the node wrapper."
}
],
"returns": [
@ -8912,27 +9102,15 @@
"type": "object",
"experimental": true,
"properties": [
{
"name": "state",
"type": "string",
"enum": [
"touchPressed",
"touchReleased",
"touchMoved",
"touchStationary",
"touchCancelled"
],
"description": "State of the touch point."
},
{
"name": "x",
"type": "integer",
"description": "X coordinate of the event relative to the main frame's viewport."
"description": "X coordinate of the event relative to the main frame's viewport in CSS pixels."
},
{
"name": "y",
"type": "integer",
"description": "Y coordinate of the event relative to the main frame's viewport. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport."
"description": "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport."
},
{
"name": "radiusX",
@ -9092,7 +9270,8 @@
"enum": [
"mousePressed",
"mouseReleased",
"mouseMoved"
"mouseMoved",
"mouseWheel"
],
"description": "Type of the mouse event."
},
@ -9135,6 +9314,18 @@
"type": "integer",
"optional": true,
"description": "Number of times the mouse button was clicked (default: 0)."
},
{
"name": "deltaX",
"type": "number",
"optional": true,
"description": "X delta in CSS pixels for mouse wheel event (default: 0)."
},
{
"name": "deltaY",
"type": "number",
"optional": true,
"description": "Y delta in CSS pixels for mouse wheel event (default: 0)."
}
],
"description": "Dispatches a mouse event to the page."
@ -9149,9 +9340,10 @@
"enum": [
"touchStart",
"touchEnd",
"touchMove"
"touchMove",
"touchCancel"
],
"description": "Type of the touch event."
"description": "Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one."
},
{
"name": "touchPoints",
@ -9159,7 +9351,7 @@
"items": {
"$ref": "TouchPoint"
},
"description": "Touch points."
"description": "Active touch points on the touch device. One event per any changed point (compared to previous touch event in a sequence) is generated, emulating pressing/moving/releasing points one by one."
},
{
"name": "modifiers",
@ -10869,6 +11061,57 @@
}
],
"description": "Returns usage and quota in bytes."
},
{
"name": "trackCacheStorageForOrigin",
"parameters": [
{
"name": "origin",
"type": "string",
"description": "Security origin."
}
],
"description": "Registers origin to be notified when an update occurs to its cache storage list."
},
{
"name": "untrackCacheStorageForOrigin",
"parameters": [
{
"name": "origin",
"type": "string",
"description": "Security origin."
}
],
"description": "Unregisters origin from receiving notifications for cache storage."
}
],
"events": [
{
"name": "cacheStorageListUpdated",
"parameters": [
{
"name": "origin",
"type": "string",
"description": "Origin to update."
}
],
"description": "A cache has been added/deleted."
},
{
"name": "cacheStorageContentUpdated",
"parameters": [
{
"name": "origin",
"type": "string",
"description": "Origin to update."
},
{
"name": "cacheName",
"type": "string",
"description": "Name of cache in origin."
}
],
"description": "A cache's contents have been modified."
}
]
},
@ -11980,7 +12223,7 @@
"name": "awaitPromise",
"type": "boolean",
"optional": true,
"description": "Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error."
"description": "Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved."
}
],
"returns": [
@ -12087,7 +12330,7 @@
"name": "awaitPromise",
"type": "boolean",
"optional": true,
"description": "Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error."
"description": "Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved."
}
],
"returns": [
@ -12298,7 +12541,7 @@
"name": "awaitPromise",
"type": "boolean",
"optional": true,
"description": "Whether execution should wait for promise to be resolved. If the result of evaluation is not a Promise, it's considered to be an error."
"description": "Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved."
}
],
"returns": [