Splitting repositories

This commit is contained in:
Kenneth Shaw 2017-12-27 09:30:28 +07:00
parent 9424dc57d6
commit b0c2445e67
219 changed files with 345 additions and 120677 deletions

View File

@ -1,31 +1,32 @@
# About chromedp [![Build Status](https://travis-ci.org/knq/chromedp.svg)](https://travis-ci.org/knq/chromedp) [![Coverage Status](https://coveralls.io/repos/knq/chromedp/badge.svg?branch=master&service=github)](https://coveralls.io/github/knq/chromedp?branch=master) # # About chromedp [![Build Status][1]][2] [![Coverage Status][3]][4]
Package chromedp is a faster, simpler way to drive browsers in Go using the Package chromedp is a faster, simpler way to drive browsers in Go using the
[Chrome Debugging Protocol](https://developer.chrome.com/devtools/docs/debugger-protocol) [Chrome Debugging Protocol][5] (for Chrome, Edge, Safari, etc) without external
(for Chrome, Edge, Safari, etc) without external dependencies (ie, Selenium, PhantomJS, etc). dependencies (ie, Selenium, PhantomJS, etc).
**NOTE:** chromedp's API is currently unstable, and may change at a moments **NOTE:** chromedp's API is currently unstable, and may change at a moments
notice. There are likely extremely bad bugs lurking in this code. **CAVEAT USER**. notice. There are likely extremely bad bugs lurking in this code. **CAVEAT USER**.
## Installation ## Installing
Install in the usual way: Install in the usual way:
```sh ```sh
go get -u github.com/knq/chromedp go get -u github.com/chromedp/chromedp
``` ```
## Usage ## Using
Below is a simple Google search performed using chromedp (taken from Below is a simple Google search performed using chromedp (taken from
[examples/simple](examples/simple/main.go)): [examples/simple][6]):
This example shows logic for a simple search for a known website, clicking on This example shows logic for a simple search for a known website, clicking on
the right link, and then taking a screenshot of a specific element on the the right link, and then taking a screenshot of a specific element on the
loaded page and saving that to a local file on disk. loaded page and saving that to a local file on disk.
```go ```go
// examples/simple/main.go // Command simple is a chromedp example demonstrating how to do a simple google
// search.
package main package main
import ( import (
@ -35,8 +36,8 @@ import (
"log" "log"
"time" "time"
cdp "github.com/knq/chromedp" "github.com/chromedp/cdproto/cdp"
cdptypes "github.com/knq/chromedp/cdp" "github.com/chromedp/chromedp"
) )
func main() { func main() {
@ -47,7 +48,7 @@ func main() {
defer cancel() defer cancel()
// create chrome instance // create chrome instance
c, err := cdp.New(ctxt, cdp.WithLog(log.Printf)) c, err := chromedp.New(ctxt, chromedp.WithLog(log.Printf))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -74,40 +75,53 @@ func main() {
log.Printf("saved screenshot from search result listing `%s` (%s)", res, site) log.Printf("saved screenshot from search result listing `%s` (%s)", res, site)
} }
func googleSearch(q, text string, site, res *string) cdp.Tasks { func googleSearch(q, text string, site, res *string) chromedp.Tasks {
var buf []byte var buf []byte
sel := fmt.Sprintf(`//a[text()[contains(., '%s')]]`, text) sel := fmt.Sprintf(`//a[text()[contains(., '%s')]]`, text)
return cdp.Tasks{ return chromedp.Tasks{
cdp.Navigate(`https://www.google.com`), chromedp.Navigate(`https://www.google.com`),
cdp.WaitVisible(`#hplogo`, cdp.ByID), chromedp.WaitVisible(`#hplogo`, chromedp.ByID),
cdp.SendKeys(`#lst-ib`, q+"\n", cdp.ByID), chromedp.SendKeys(`#lst-ib`, q+"\n", chromedp.ByID),
cdp.WaitVisible(`#res`, cdp.ByID), chromedp.WaitVisible(`#res`, chromedp.ByID),
cdp.Text(sel, res), chromedp.Text(sel, res),
cdp.Click(sel), chromedp.Click(sel),
cdp.WaitVisible(`a[href="/brankas-for-business"]`, cdp.ByQuery), chromedp.WaitNotVisible(`.preloader-content`, chromedp.ByQuery),
cdp.WaitNotVisible(`.preloader-content`, cdp.ByQuery), chromedp.WaitVisible(`a[href*="twitter"]`, chromedp.ByQuery),
cdp.Location(site), chromedp.Location(site),
cdp.ScrollIntoView(`.banner-section.third-section`, cdp.ByQuery), chromedp.ScrollIntoView(`.banner-section.third-section`, chromedp.ByQuery),
cdp.Sleep(2 * time.Second), // wait for animation to finish chromedp.Sleep(2 * time.Second), // wait for animation to finish
cdp.Screenshot(`.banner-section.third-section`, &buf, cdp.ByQuery), chromedp.Screenshot(`.banner-section.third-section`, &buf, chromedp.ByQuery),
cdp.ActionFunc(func(context.Context, cdptypes.Handler) error { chromedp.ActionFunc(func(context.Context, cdp.Executor) error {
return ioutil.WriteFile("screenshot.png", buf, 0644) return ioutil.WriteFile("screenshot.png", buf, 0644)
}), }),
} }
} }
``` ```
Please see the [examples](examples/) directory for some more examples, and Please see the [examples][6] project for more examples. Please refer to the
please refer to the [GoDoc API listing](https://godoc.org/github.com/knq/chromedp) [GoDoc API listing][7] for a summary of the API and Actions.
for a summary of the API and Actions.
## Links + Resources ## Resources
* [chromedp: A New Way to Drive the Web (GopherCon SG 2017)](https://www.youtube.com/watch?v=_7pWCg94sKw)
* [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/) * [chromedp: A New Way to Drive the Web][8] - GopherCon 2017 talk by Kenneth Shaw
* [Chrome DevTools Protocol][5] - Chrome Debugging Protocol Domain documentation
* [chromedp examples][6] - various `chromedp` examples
* [`github.com/chromedp/cdproto`] - GoDoc listing for
* [`github.com/chromedp/chromedp-gen`][9] - tool used to generate
## TODO ## TODO
* Move timeouts to context (defaults) * Move timeouts to context (defaults)
* Implement more query selector options (allow over riding context timeouts) * Implement more query selector options (allow over riding context timeouts)
* Contextual actions for "dry run" (or via an accumulator?) * Contextual actions for "dry run" (or via an accumulator?)
* Network loader / manager * Network loader / manager
* Profiler * Profiler
[1]: https://travis-ci.org/chromedp/chromedp.svg
[2]: https://travis-ci.org/chromedp/chromedp
[3]: https://coveralls.io/repos/chromedp/chromedp/badge.svg?branch=master&service=github
[4]: https://coveralls.io/github/chromedp/chromedp?branch=master
[5]: https://chromedevtools.github.io/devtools-protocol/
[6]: https://github.com/chromedp/examples
[7]: https://godoc.org/github.com/chromedp/chromedp
[8]: https://www.youtube.com/watch?v=_7pWCg94sKw

View File

@ -4,21 +4,21 @@ import (
"context" "context"
"time" "time"
"github.com/knq/chromedp/cdp" "github.com/chromedp/cdproto/cdp"
) )
// Action is the common interface for an action that will be executed against a // Action is the common interface for an action that will be executed against a
// context and frame handler. // context and frame handler.
type Action interface { type Action interface {
// Do executes the action using the provided context and frame handler. // Do executes the action using the provided context and frame handler.
Do(context.Context, cdp.Handler) error Do(context.Context, cdp.Executor) error
} }
// ActionFunc is a adapter to allow the use of ordinary func's as an Action. // ActionFunc is a adapter to allow the use of ordinary func's as an Action.
type ActionFunc func(context.Context, cdp.Handler) error type ActionFunc func(context.Context, cdp.Executor) error
// Do executes the func f using the provided context and frame handler. // Do executes the func f using the provided context and frame handler.
func (f ActionFunc) Do(ctxt context.Context, h cdp.Handler) error { func (f ActionFunc) Do(ctxt context.Context, h cdp.Executor) error {
return f(ctxt, h) return f(ctxt, h)
} }
@ -27,7 +27,7 @@ type Tasks []Action
// Do executes the list of Actions sequentially, using the provided context and // Do executes the list of Actions sequentially, using the provided context and
// frame handler. // frame handler.
func (t Tasks) Do(ctxt context.Context, h cdp.Handler) error { func (t Tasks) Do(ctxt context.Context, h cdp.Executor) error {
// TODO: put individual task timeouts from context here // TODO: put individual task timeouts from context here
for _, a := range t { for _, a := range t {
// ctxt, cancel = context.WithTimeout(ctxt, timeout) // ctxt, cancel = context.WithTimeout(ctxt, timeout)
@ -46,7 +46,7 @@ func (t Tasks) Do(ctxt context.Context, h cdp.Handler) error {
// be marked for deprecation in the future, after the remaining Actions have // be marked for deprecation in the future, after the remaining Actions have
// been able to be written/tested. // been able to be written/tested.
func Sleep(d time.Duration) Action { func Sleep(d time.Duration) Action {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error { return ActionFunc(func(ctxt context.Context, h cdp.Executor) error {
select { select {
case <-time.After(d): case <-time.After(d):

View File

@ -1,59 +0,0 @@
// Package accessibility provides the Chrome Debugging Protocol
// commands, types, and events for the Accessibility domain.
//
// Generated by the chromedp-gen command.
package accessibility
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// GetPartialAXTreeParams fetches the accessibility node and partial
// accessibility tree for this DOM node, if it exists.
type GetPartialAXTreeParams struct {
NodeID cdp.NodeID `json:"nodeId"` // ID of node to get the partial accessibility tree for.
FetchRelatives bool `json:"fetchRelatives,omitempty"` // Whether to fetch this nodes ancestors, siblings and children. Defaults to true.
}
// GetPartialAXTree fetches the accessibility node and partial accessibility
// tree for this DOM node, if it exists.
//
// parameters:
// nodeID - ID of node to get the partial accessibility tree for.
func GetPartialAXTree(nodeID cdp.NodeID) *GetPartialAXTreeParams {
return &GetPartialAXTreeParams{
NodeID: nodeID,
}
}
// WithFetchRelatives whether to fetch this nodes ancestors, siblings and
// children. Defaults to true.
func (p GetPartialAXTreeParams) WithFetchRelatives(fetchRelatives bool) *GetPartialAXTreeParams {
p.FetchRelatives = fetchRelatives
return &p
}
// GetPartialAXTreeReturns return values.
type GetPartialAXTreeReturns struct {
Nodes []*AXNode `json:"nodes,omitempty"` // The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
}
// Do executes Accessibility.getPartialAXTree against the provided context and
// target handler.
//
// returns:
// nodes - The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h cdp.Handler) (nodes []*AXNode, err error) {
// execute
var res GetPartialAXTreeReturns
err = h.Execute(ctxt, cdp.CommandAccessibilityGetPartialAXTree, p, &res)
if err != nil {
return nil, err
}
return res.Nodes, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,416 +0,0 @@
package accessibility
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// AXNodeID unique accessibility node identifier.
type AXNodeID string
// String returns the AXNodeID as string value.
func (t AXNodeID) String() string {
return string(t)
}
// AXValueType enum of possible property types.
type AXValueType string
// String returns the AXValueType as string value.
func (t AXValueType) String() string {
return string(t)
}
// AXValueType values.
const (
AXValueTypeBoolean AXValueType = "boolean"
AXValueTypeTristate AXValueType = "tristate"
AXValueTypeBooleanOrUndefined AXValueType = "booleanOrUndefined"
AXValueTypeIdref AXValueType = "idref"
AXValueTypeIdrefList AXValueType = "idrefList"
AXValueTypeInteger AXValueType = "integer"
AXValueTypeNode AXValueType = "node"
AXValueTypeNodeList AXValueType = "nodeList"
AXValueTypeNumber AXValueType = "number"
AXValueTypeString AXValueType = "string"
AXValueTypeComputedString AXValueType = "computedString"
AXValueTypeToken AXValueType = "token"
AXValueTypeTokenList AXValueType = "tokenList"
AXValueTypeDomRelation AXValueType = "domRelation"
AXValueTypeRole AXValueType = "role"
AXValueTypeInternalRole AXValueType = "internalRole"
AXValueTypeValueUndefined AXValueType = "valueUndefined"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AXValueType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AXValueType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AXValueType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AXValueType(in.String()) {
case AXValueTypeBoolean:
*t = AXValueTypeBoolean
case AXValueTypeTristate:
*t = AXValueTypeTristate
case AXValueTypeBooleanOrUndefined:
*t = AXValueTypeBooleanOrUndefined
case AXValueTypeIdref:
*t = AXValueTypeIdref
case AXValueTypeIdrefList:
*t = AXValueTypeIdrefList
case AXValueTypeInteger:
*t = AXValueTypeInteger
case AXValueTypeNode:
*t = AXValueTypeNode
case AXValueTypeNodeList:
*t = AXValueTypeNodeList
case AXValueTypeNumber:
*t = AXValueTypeNumber
case AXValueTypeString:
*t = AXValueTypeString
case AXValueTypeComputedString:
*t = AXValueTypeComputedString
case AXValueTypeToken:
*t = AXValueTypeToken
case AXValueTypeTokenList:
*t = AXValueTypeTokenList
case AXValueTypeDomRelation:
*t = AXValueTypeDomRelation
case AXValueTypeRole:
*t = AXValueTypeRole
case AXValueTypeInternalRole:
*t = AXValueTypeInternalRole
case AXValueTypeValueUndefined:
*t = AXValueTypeValueUndefined
default:
in.AddError(errors.New("unknown AXValueType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AXValueType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// AXValueSourceType enum of possible property sources.
type AXValueSourceType string
// String returns the AXValueSourceType as string value.
func (t AXValueSourceType) String() string {
return string(t)
}
// AXValueSourceType values.
const (
AXValueSourceTypeAttribute AXValueSourceType = "attribute"
AXValueSourceTypeImplicit AXValueSourceType = "implicit"
AXValueSourceTypeStyle AXValueSourceType = "style"
AXValueSourceTypeContents AXValueSourceType = "contents"
AXValueSourceTypePlaceholder AXValueSourceType = "placeholder"
AXValueSourceTypeRelatedElement AXValueSourceType = "relatedElement"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AXValueSourceType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AXValueSourceType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AXValueSourceType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AXValueSourceType(in.String()) {
case AXValueSourceTypeAttribute:
*t = AXValueSourceTypeAttribute
case AXValueSourceTypeImplicit:
*t = AXValueSourceTypeImplicit
case AXValueSourceTypeStyle:
*t = AXValueSourceTypeStyle
case AXValueSourceTypeContents:
*t = AXValueSourceTypeContents
case AXValueSourceTypePlaceholder:
*t = AXValueSourceTypePlaceholder
case AXValueSourceTypeRelatedElement:
*t = AXValueSourceTypeRelatedElement
default:
in.AddError(errors.New("unknown AXValueSourceType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AXValueSourceType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// AXValueNativeSourceType enum of possible native property sources (as a
// subtype of a particular AXValueSourceType).
type AXValueNativeSourceType string
// String returns the AXValueNativeSourceType as string value.
func (t AXValueNativeSourceType) String() string {
return string(t)
}
// AXValueNativeSourceType values.
const (
AXValueNativeSourceTypeFigcaption AXValueNativeSourceType = "figcaption"
AXValueNativeSourceTypeLabel AXValueNativeSourceType = "label"
AXValueNativeSourceTypeLabelfor AXValueNativeSourceType = "labelfor"
AXValueNativeSourceTypeLabelwrapped AXValueNativeSourceType = "labelwrapped"
AXValueNativeSourceTypeLegend AXValueNativeSourceType = "legend"
AXValueNativeSourceTypeTablecaption AXValueNativeSourceType = "tablecaption"
AXValueNativeSourceTypeTitle AXValueNativeSourceType = "title"
AXValueNativeSourceTypeOther AXValueNativeSourceType = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AXValueNativeSourceType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AXValueNativeSourceType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AXValueNativeSourceType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AXValueNativeSourceType(in.String()) {
case AXValueNativeSourceTypeFigcaption:
*t = AXValueNativeSourceTypeFigcaption
case AXValueNativeSourceTypeLabel:
*t = AXValueNativeSourceTypeLabel
case AXValueNativeSourceTypeLabelfor:
*t = AXValueNativeSourceTypeLabelfor
case AXValueNativeSourceTypeLabelwrapped:
*t = AXValueNativeSourceTypeLabelwrapped
case AXValueNativeSourceTypeLegend:
*t = AXValueNativeSourceTypeLegend
case AXValueNativeSourceTypeTablecaption:
*t = AXValueNativeSourceTypeTablecaption
case AXValueNativeSourceTypeTitle:
*t = AXValueNativeSourceTypeTitle
case AXValueNativeSourceTypeOther:
*t = AXValueNativeSourceTypeOther
default:
in.AddError(errors.New("unknown AXValueNativeSourceType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AXValueNativeSourceType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// AXValueSource a single source for a computed AX property.
type AXValueSource struct {
Type AXValueSourceType `json:"type"` // What type of source this is.
Value *AXValue `json:"value,omitempty"` // The value of this property source.
Attribute string `json:"attribute,omitempty"` // The name of the relevant attribute, if any.
AttributeValue *AXValue `json:"attributeValue,omitempty"` // The value of the relevant attribute, if any.
Superseded bool `json:"superseded,omitempty"` // Whether this source is superseded by a higher priority source.
NativeSource AXValueNativeSourceType `json:"nativeSource,omitempty"` // The native markup source for this value, e.g. a <label> element.
NativeSourceValue *AXValue `json:"nativeSourceValue,omitempty"` // The value, such as a node or node list, of the native source.
Invalid bool `json:"invalid,omitempty"` // Whether the value for this property is invalid.
InvalidReason string `json:"invalidReason,omitempty"` // Reason for the value being invalid, if it is.
}
// AXRelatedNode [no description].
type AXRelatedNode struct {
BackendDOMNodeID cdp.BackendNodeID `json:"backendDOMNodeId"` // The BackendNodeId of the related DOM node.
Idref string `json:"idref,omitempty"` // The IDRef value provided, if any.
Text string `json:"text,omitempty"` // The text alternative of this node in the current context.
}
// AXProperty [no description].
type AXProperty struct {
Name AXPropertyName `json:"name"` // The name of this property.
Value *AXValue `json:"value"` // The value of this property.
}
// AXValue a single computed AX property.
type AXValue struct {
Type AXValueType `json:"type"` // The type of this value.
Value easyjson.RawMessage `json:"value,omitempty"` // The computed value of this property.
RelatedNodes []*AXRelatedNode `json:"relatedNodes,omitempty"` // One or more related nodes, if applicable.
Sources []*AXValueSource `json:"sources,omitempty"` // The sources which contributed to the computation of this property.
}
// AXPropertyName values of AXProperty name: from 'busy' to 'roledescription'
// - states which apply to every AX node, from 'live' to 'root' - attributes
// which apply to nodes in live regions, from 'autocomplete' to 'valuetext' -
// attributes which apply to widgets, from 'checked' to 'selected' - states
// which apply to widgets, from 'activedescendant' to 'owns' - relationships
// between elements other than parent/child/sibling.
type AXPropertyName string
// String returns the AXPropertyName as string value.
func (t AXPropertyName) String() string {
return string(t)
}
// AXPropertyName values.
const (
AXPropertyNameBusy AXPropertyName = "busy"
AXPropertyNameDisabled AXPropertyName = "disabled"
AXPropertyNameHidden AXPropertyName = "hidden"
AXPropertyNameHiddenRoot AXPropertyName = "hiddenRoot"
AXPropertyNameInvalid AXPropertyName = "invalid"
AXPropertyNameKeyshortcuts AXPropertyName = "keyshortcuts"
AXPropertyNameRoledescription AXPropertyName = "roledescription"
AXPropertyNameLive AXPropertyName = "live"
AXPropertyNameAtomic AXPropertyName = "atomic"
AXPropertyNameRelevant AXPropertyName = "relevant"
AXPropertyNameRoot AXPropertyName = "root"
AXPropertyNameAutocomplete AXPropertyName = "autocomplete"
AXPropertyNameHaspopup AXPropertyName = "haspopup"
AXPropertyNameLevel AXPropertyName = "level"
AXPropertyNameMultiselectable AXPropertyName = "multiselectable"
AXPropertyNameOrientation AXPropertyName = "orientation"
AXPropertyNameMultiline AXPropertyName = "multiline"
AXPropertyNameReadonly AXPropertyName = "readonly"
AXPropertyNameRequired AXPropertyName = "required"
AXPropertyNameValuemin AXPropertyName = "valuemin"
AXPropertyNameValuemax AXPropertyName = "valuemax"
AXPropertyNameValuetext AXPropertyName = "valuetext"
AXPropertyNameChecked AXPropertyName = "checked"
AXPropertyNameExpanded AXPropertyName = "expanded"
AXPropertyNameModal AXPropertyName = "modal"
AXPropertyNamePressed AXPropertyName = "pressed"
AXPropertyNameSelected AXPropertyName = "selected"
AXPropertyNameActivedescendant AXPropertyName = "activedescendant"
AXPropertyNameControls AXPropertyName = "controls"
AXPropertyNameDescribedby AXPropertyName = "describedby"
AXPropertyNameDetails AXPropertyName = "details"
AXPropertyNameErrormessage AXPropertyName = "errormessage"
AXPropertyNameFlowto AXPropertyName = "flowto"
AXPropertyNameLabelledby AXPropertyName = "labelledby"
AXPropertyNameOwns AXPropertyName = "owns"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AXPropertyName) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AXPropertyName) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AXPropertyName) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AXPropertyName(in.String()) {
case AXPropertyNameBusy:
*t = AXPropertyNameBusy
case AXPropertyNameDisabled:
*t = AXPropertyNameDisabled
case AXPropertyNameHidden:
*t = AXPropertyNameHidden
case AXPropertyNameHiddenRoot:
*t = AXPropertyNameHiddenRoot
case AXPropertyNameInvalid:
*t = AXPropertyNameInvalid
case AXPropertyNameKeyshortcuts:
*t = AXPropertyNameKeyshortcuts
case AXPropertyNameRoledescription:
*t = AXPropertyNameRoledescription
case AXPropertyNameLive:
*t = AXPropertyNameLive
case AXPropertyNameAtomic:
*t = AXPropertyNameAtomic
case AXPropertyNameRelevant:
*t = AXPropertyNameRelevant
case AXPropertyNameRoot:
*t = AXPropertyNameRoot
case AXPropertyNameAutocomplete:
*t = AXPropertyNameAutocomplete
case AXPropertyNameHaspopup:
*t = AXPropertyNameHaspopup
case AXPropertyNameLevel:
*t = AXPropertyNameLevel
case AXPropertyNameMultiselectable:
*t = AXPropertyNameMultiselectable
case AXPropertyNameOrientation:
*t = AXPropertyNameOrientation
case AXPropertyNameMultiline:
*t = AXPropertyNameMultiline
case AXPropertyNameReadonly:
*t = AXPropertyNameReadonly
case AXPropertyNameRequired:
*t = AXPropertyNameRequired
case AXPropertyNameValuemin:
*t = AXPropertyNameValuemin
case AXPropertyNameValuemax:
*t = AXPropertyNameValuemax
case AXPropertyNameValuetext:
*t = AXPropertyNameValuetext
case AXPropertyNameChecked:
*t = AXPropertyNameChecked
case AXPropertyNameExpanded:
*t = AXPropertyNameExpanded
case AXPropertyNameModal:
*t = AXPropertyNameModal
case AXPropertyNamePressed:
*t = AXPropertyNamePressed
case AXPropertyNameSelected:
*t = AXPropertyNameSelected
case AXPropertyNameActivedescendant:
*t = AXPropertyNameActivedescendant
case AXPropertyNameControls:
*t = AXPropertyNameControls
case AXPropertyNameDescribedby:
*t = AXPropertyNameDescribedby
case AXPropertyNameDetails:
*t = AXPropertyNameDetails
case AXPropertyNameErrormessage:
*t = AXPropertyNameErrormessage
case AXPropertyNameFlowto:
*t = AXPropertyNameFlowto
case AXPropertyNameLabelledby:
*t = AXPropertyNameLabelledby
case AXPropertyNameOwns:
*t = AXPropertyNameOwns
default:
in.AddError(errors.New("unknown AXPropertyName value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AXPropertyName) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// AXNode a node in the accessibility tree.
type AXNode struct {
NodeID AXNodeID `json:"nodeId"` // Unique identifier for this node.
Ignored bool `json:"ignored"` // Whether this node is ignored for accessibility
IgnoredReasons []*AXProperty `json:"ignoredReasons,omitempty"` // Collection of reasons why this node is hidden.
Role *AXValue `json:"role,omitempty"` // This Node's role, whether explicit or implicit.
Name *AXValue `json:"name,omitempty"` // The accessible name for this Node.
Description *AXValue `json:"description,omitempty"` // The accessible description for this Node.
Value *AXValue `json:"value,omitempty"` // The value for this Node.
Properties []*AXProperty `json:"properties,omitempty"` // All other properties
ChildIds []AXNodeID `json:"childIds,omitempty"` // IDs for each of this node's child nodes.
BackendDOMNodeID cdp.BackendNodeID `json:"backendDOMNodeId,omitempty"` // The backend ID for the associated DOM node, if any.
}

View File

@ -1,264 +0,0 @@
// Package animation provides the Chrome Debugging Protocol
// commands, types, and events for the Animation domain.
//
// Generated by the chromedp-gen command.
package animation
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
)
// DisableParams disables animation domain notifications.
type DisableParams struct{}
// Disable disables animation domain notifications.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Animation.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandAnimationDisable, nil, nil)
}
// EnableParams enables animation domain notifications.
type EnableParams struct{}
// Enable enables animation domain notifications.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Animation.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandAnimationEnable, nil, nil)
}
// GetCurrentTimeParams returns the current time of the an animation.
type GetCurrentTimeParams struct {
ID string `json:"id"` // Id of animation.
}
// GetCurrentTime returns the current time of the an animation.
//
// parameters:
// id - Id of animation.
func GetCurrentTime(id string) *GetCurrentTimeParams {
return &GetCurrentTimeParams{
ID: id,
}
}
// GetCurrentTimeReturns return values.
type GetCurrentTimeReturns struct {
CurrentTime float64 `json:"currentTime,omitempty"` // Current time of the page.
}
// Do executes Animation.getCurrentTime against the provided context and
// target handler.
//
// returns:
// currentTime - Current time of the page.
func (p *GetCurrentTimeParams) Do(ctxt context.Context, h cdp.Handler) (currentTime float64, err error) {
// execute
var res GetCurrentTimeReturns
err = h.Execute(ctxt, cdp.CommandAnimationGetCurrentTime, p, &res)
if err != nil {
return 0, err
}
return res.CurrentTime, nil
}
// GetPlaybackRateParams gets the playback rate of the document timeline.
type GetPlaybackRateParams struct{}
// GetPlaybackRate gets the playback rate of the document timeline.
func GetPlaybackRate() *GetPlaybackRateParams {
return &GetPlaybackRateParams{}
}
// GetPlaybackRateReturns return values.
type GetPlaybackRateReturns struct {
PlaybackRate float64 `json:"playbackRate,omitempty"` // Playback rate for animations on page.
}
// Do executes Animation.getPlaybackRate against the provided context and
// target handler.
//
// returns:
// playbackRate - Playback rate for animations on page.
func (p *GetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (playbackRate float64, err error) {
// execute
var res GetPlaybackRateReturns
err = h.Execute(ctxt, cdp.CommandAnimationGetPlaybackRate, nil, &res)
if err != nil {
return 0, err
}
return res.PlaybackRate, nil
}
// ReleaseAnimationsParams releases a set of animations to no longer be
// manipulated.
type ReleaseAnimationsParams struct {
Animations []string `json:"animations"` // List of animation ids to seek.
}
// ReleaseAnimations releases a set of animations to no longer be
// manipulated.
//
// parameters:
// animations - List of animation ids to seek.
func ReleaseAnimations(animations []string) *ReleaseAnimationsParams {
return &ReleaseAnimationsParams{
Animations: animations,
}
}
// Do executes Animation.releaseAnimations against the provided context and
// target handler.
func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandAnimationReleaseAnimations, p, nil)
}
// ResolveAnimationParams gets the remote object of the Animation.
type ResolveAnimationParams struct {
AnimationID string `json:"animationId"` // Animation id.
}
// ResolveAnimation gets the remote object of the Animation.
//
// parameters:
// animationID - Animation id.
func ResolveAnimation(animationID string) *ResolveAnimationParams {
return &ResolveAnimationParams{
AnimationID: animationID,
}
}
// ResolveAnimationReturns return values.
type ResolveAnimationReturns struct {
RemoteObject *runtime.RemoteObject `json:"remoteObject,omitempty"` // Corresponding remote object.
}
// Do executes Animation.resolveAnimation against the provided context and
// target handler.
//
// returns:
// remoteObject - Corresponding remote object.
func (p *ResolveAnimationParams) Do(ctxt context.Context, h cdp.Handler) (remoteObject *runtime.RemoteObject, err error) {
// execute
var res ResolveAnimationReturns
err = h.Execute(ctxt, cdp.CommandAnimationResolveAnimation, p, &res)
if err != nil {
return nil, err
}
return res.RemoteObject, nil
}
// SeekAnimationsParams seek a set of animations to a particular time within
// each animation.
type SeekAnimationsParams struct {
Animations []string `json:"animations"` // List of animation ids to seek.
CurrentTime float64 `json:"currentTime"` // Set the current time of each animation.
}
// SeekAnimations seek a set of animations to a particular time within each
// animation.
//
// parameters:
// animations - List of animation ids to seek.
// currentTime - Set the current time of each animation.
func SeekAnimations(animations []string, currentTime float64) *SeekAnimationsParams {
return &SeekAnimationsParams{
Animations: animations,
CurrentTime: currentTime,
}
}
// Do executes Animation.seekAnimations against the provided context and
// target handler.
func (p *SeekAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandAnimationSeekAnimations, p, nil)
}
// SetPausedParams sets the paused state of a set of animations.
type SetPausedParams struct {
Animations []string `json:"animations"` // Animations to set the pause state of.
Paused bool `json:"paused"` // Paused state to set to.
}
// SetPaused sets the paused state of a set of animations.
//
// parameters:
// animations - Animations to set the pause state of.
// paused - Paused state to set to.
func SetPaused(animations []string, paused bool) *SetPausedParams {
return &SetPausedParams{
Animations: animations,
Paused: paused,
}
}
// Do executes Animation.setPaused against the provided context and
// target handler.
func (p *SetPausedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandAnimationSetPaused, p, nil)
}
// SetPlaybackRateParams sets the playback rate of the document timeline.
type SetPlaybackRateParams struct {
PlaybackRate float64 `json:"playbackRate"` // Playback rate for animations on page
}
// SetPlaybackRate sets the playback rate of the document timeline.
//
// parameters:
// playbackRate - Playback rate for animations on page
func SetPlaybackRate(playbackRate float64) *SetPlaybackRateParams {
return &SetPlaybackRateParams{
PlaybackRate: playbackRate,
}
}
// Do executes Animation.setPlaybackRate against the provided context and
// target handler.
func (p *SetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandAnimationSetPlaybackRate, p, nil)
}
// SetTimingParams sets the timing of an animation node.
type SetTimingParams struct {
AnimationID string `json:"animationId"` // Animation id.
Duration float64 `json:"duration"` // Duration of the animation.
Delay float64 `json:"delay"` // Delay of the animation.
}
// SetTiming sets the timing of an animation node.
//
// parameters:
// animationID - Animation id.
// duration - Duration of the animation.
// delay - Delay of the animation.
func SetTiming(animationID string, duration float64, delay float64) *SetTimingParams {
return &SetTimingParams{
AnimationID: animationID,
Duration: duration,
Delay: delay,
}
}
// Do executes Animation.setTiming against the provided context and
// target handler.
func (p *SetTimingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandAnimationSetTiming, p, nil)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
package animation
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventAnimationCanceled event for when an animation has been cancelled.
type EventAnimationCanceled struct {
ID string `json:"id"` // Id of the animation that was cancelled.
}
// EventAnimationCreated event for each animation that has been created.
type EventAnimationCreated struct {
ID string `json:"id"` // Id of the animation that was created.
}
// EventAnimationStarted event for animation that has been started.
type EventAnimationStarted struct {
Animation *Animation `json:"animation"` // Animation that was started.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventAnimationAnimationCanceled,
cdp.EventAnimationAnimationCreated,
cdp.EventAnimationAnimationStarted,
}

View File

@ -1,97 +0,0 @@
package animation
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Animation animation instance.
type Animation struct {
ID string `json:"id"` // Animation's id.
Name string `json:"name"` // Animation's name.
PausedState bool `json:"pausedState"` // Animation's internal paused state.
PlayState string `json:"playState"` // Animation's play state.
PlaybackRate float64 `json:"playbackRate"` // Animation's playback rate.
StartTime float64 `json:"startTime"` // Animation's start time.
CurrentTime float64 `json:"currentTime"` // Animation's current time.
Type Type `json:"type"` // Animation type of Animation.
Source *Effect `json:"source,omitempty"` // Animation's source animation node.
CSSID string `json:"cssId,omitempty"` // A unique ID for Animation representing the sources that triggered this CSS animation/transition.
}
// Effect animationEffect instance.
type Effect struct {
Delay float64 `json:"delay"` // AnimationEffect's delay.
EndDelay float64 `json:"endDelay"` // AnimationEffect's end delay.
IterationStart float64 `json:"iterationStart"` // AnimationEffect's iteration start.
Iterations float64 `json:"iterations"` // AnimationEffect's iterations.
Duration float64 `json:"duration"` // AnimationEffect's iteration duration.
Direction string `json:"direction"` // AnimationEffect's playback direction.
Fill string `json:"fill"` // AnimationEffect's fill mode.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // AnimationEffect's target node.
KeyframesRule *KeyframesRule `json:"keyframesRule,omitempty"` // AnimationEffect's keyframes.
Easing string `json:"easing"` // AnimationEffect's timing function.
}
// KeyframesRule keyframes Rule.
type KeyframesRule struct {
Name string `json:"name,omitempty"` // CSS keyframed animation's name.
Keyframes []*KeyframeStyle `json:"keyframes"` // List of animation keyframes.
}
// KeyframeStyle keyframe Style.
type KeyframeStyle struct {
Offset string `json:"offset"` // Keyframe's time offset.
Easing string `json:"easing"` // AnimationEffect's timing function.
}
// Type animation type of Animation.
type Type string
// String returns the Type as string value.
func (t Type) String() string {
return string(t)
}
// Type values.
const (
TypeCSSTransition Type = "CSSTransition"
TypeCSSAnimation Type = "CSSAnimation"
TypeWebAnimation Type = "WebAnimation"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Type) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t Type) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Type) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch Type(in.String()) {
case TypeCSSTransition:
*t = TypeCSSTransition
case TypeCSSAnimation:
*t = TypeCSSAnimation
case TypeWebAnimation:
*t = TypeWebAnimation
default:
in.AddError(errors.New("unknown Type value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Type) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -1,135 +0,0 @@
// Package applicationcache provides the Chrome Debugging Protocol
// commands, types, and events for the ApplicationCache domain.
//
// Generated by the chromedp-gen command.
package applicationcache
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// EnableParams enables application cache domain notifications.
type EnableParams struct{}
// Enable enables application cache domain notifications.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes ApplicationCache.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandApplicationCacheEnable, nil, nil)
}
// GetApplicationCacheForFrameParams returns relevant application cache data
// for the document in given frame.
type GetApplicationCacheForFrameParams struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose application cache is retrieved.
}
// GetApplicationCacheForFrame returns relevant application cache data for
// the document in given frame.
//
// parameters:
// frameID - Identifier of the frame containing document whose application cache is retrieved.
func GetApplicationCacheForFrame(frameID cdp.FrameID) *GetApplicationCacheForFrameParams {
return &GetApplicationCacheForFrameParams{
FrameID: frameID,
}
}
// GetApplicationCacheForFrameReturns return values.
type GetApplicationCacheForFrameReturns struct {
ApplicationCache *ApplicationCache `json:"applicationCache,omitempty"` // Relevant application cache data for the document in given frame.
}
// Do executes ApplicationCache.getApplicationCacheForFrame against the provided context and
// target handler.
//
// returns:
// applicationCache - Relevant application cache data for the document in given frame.
func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h cdp.Handler) (applicationCache *ApplicationCache, err error) {
// execute
var res GetApplicationCacheForFrameReturns
err = h.Execute(ctxt, cdp.CommandApplicationCacheGetApplicationCacheForFrame, p, &res)
if err != nil {
return nil, err
}
return res.ApplicationCache, nil
}
// GetFramesWithManifestsParams returns array of frame identifiers with
// manifest urls for each frame containing a document associated with some
// application cache.
type GetFramesWithManifestsParams struct{}
// GetFramesWithManifests returns array of frame identifiers with manifest
// urls for each frame containing a document associated with some application
// cache.
func GetFramesWithManifests() *GetFramesWithManifestsParams {
return &GetFramesWithManifestsParams{}
}
// GetFramesWithManifestsReturns return values.
type GetFramesWithManifestsReturns struct {
FrameIds []*FrameWithManifest `json:"frameIds,omitempty"` // Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
}
// Do executes ApplicationCache.getFramesWithManifests against the provided context and
// target handler.
//
// returns:
// frameIds - Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
func (p *GetFramesWithManifestsParams) Do(ctxt context.Context, h cdp.Handler) (frameIds []*FrameWithManifest, err error) {
// execute
var res GetFramesWithManifestsReturns
err = h.Execute(ctxt, cdp.CommandApplicationCacheGetFramesWithManifests, nil, &res)
if err != nil {
return nil, err
}
return res.FrameIds, nil
}
// GetManifestForFrameParams returns manifest URL for document in the given
// frame.
type GetManifestForFrameParams struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose manifest is retrieved.
}
// GetManifestForFrame returns manifest URL for document in the given frame.
//
// parameters:
// frameID - Identifier of the frame containing document whose manifest is retrieved.
func GetManifestForFrame(frameID cdp.FrameID) *GetManifestForFrameParams {
return &GetManifestForFrameParams{
FrameID: frameID,
}
}
// GetManifestForFrameReturns return values.
type GetManifestForFrameReturns struct {
ManifestURL string `json:"manifestURL,omitempty"` // Manifest URL for document in the given frame.
}
// Do executes ApplicationCache.getManifestForFrame against the provided context and
// target handler.
//
// returns:
// manifestURL - Manifest URL for document in the given frame.
func (p *GetManifestForFrameParams) Do(ctxt context.Context, h cdp.Handler) (manifestURL string, err error) {
// execute
var res GetManifestForFrameReturns
err = h.Execute(ctxt, cdp.CommandApplicationCacheGetManifestForFrame, p, &res)
if err != nil {
return "", err
}
return res.ManifestURL, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
package applicationcache
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventApplicationCacheStatusUpdated [no description].
type EventApplicationCacheStatusUpdated struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame containing document whose application cache updated status.
ManifestURL string `json:"manifestURL"` // Manifest URL.
Status int64 `json:"status"` // Updated application cache status.
}
// EventNetworkStateUpdated [no description].
type EventNetworkStateUpdated struct {
IsNowOnline bool `json:"isNowOnline"`
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventApplicationCacheApplicationCacheStatusUpdated,
cdp.EventApplicationCacheNetworkStateUpdated,
}

View File

@ -1,30 +0,0 @@
package applicationcache
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// Resource detailed application cache resource information.
type Resource struct {
URL string `json:"url"` // Resource url.
Size int64 `json:"size"` // Resource size.
Type string `json:"type"` // Resource type.
}
// ApplicationCache detailed application cache information.
type ApplicationCache struct {
ManifestURL string `json:"manifestURL"` // Manifest URL.
Size float64 `json:"size"` // Application cache size.
CreationTime float64 `json:"creationTime"` // Application cache creation time.
UpdateTime float64 `json:"updateTime"` // Application cache update time.
Resources []*Resource `json:"resources"` // Application cache resources.
}
// FrameWithManifest frame identifier - manifest URL pair.
type FrameWithManifest struct {
FrameID cdp.FrameID `json:"frameId"` // Frame identifier.
ManifestURL string `json:"manifestURL"` // Manifest URL.
Status int64 `json:"status"` // Application cache status.
}

View File

@ -1,77 +0,0 @@
// 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
}

View File

@ -1,222 +0,0 @@
// 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 != "" {
const prefix string = ",\"body\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Body))
}
if in.OriginalSize != 0 {
const prefix string = ",\"originalSize\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.OriginalSize))
}
if in.EncodedSize != 0 {
const prefix string = ",\"encodedSize\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
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
{
const prefix string = ",\"requestId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.RequestID))
}
{
const prefix string = ",\"encoding\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.Encoding).MarshalEasyJSON(out)
}
if in.Quality != 0 {
const prefix string = ",\"quality\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Float64(float64(in.Quality))
}
if in.SizeOnly {
const prefix string = ",\"sizeOnly\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
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)
}

View File

@ -1,56 +0,0 @@
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

@ -1,167 +0,0 @@
// Package browser provides the Chrome Debugging Protocol
// commands, types, and events for the Browser domain.
//
// The Browser domain defines methods and events for browser managing.
//
// Generated by the chromedp-gen command.
package browser
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/target"
)
// CloseParams close browser gracefully.
type CloseParams struct{}
// Close close browser gracefully.
func Close() *CloseParams {
return &CloseParams{}
}
// Do executes Browser.close against the provided context and
// target handler.
func (p *CloseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandBrowserClose, nil, nil)
}
// GetVersionParams returns version information.
type GetVersionParams struct{}
// GetVersion returns version information.
func GetVersion() *GetVersionParams {
return &GetVersionParams{}
}
// GetVersionReturns return values.
type GetVersionReturns struct {
ProtocolVersion string `json:"protocolVersion,omitempty"` // Protocol version.
Product string `json:"product,omitempty"` // Product name.
Revision string `json:"revision,omitempty"` // Product revision.
UserAgent string `json:"userAgent,omitempty"` // User-Agent.
JsVersion string `json:"jsVersion,omitempty"` // V8 version.
}
// Do executes Browser.getVersion against the provided context and
// target handler.
//
// returns:
// protocolVersion - Protocol version.
// product - Product name.
// revision - Product revision.
// userAgent - User-Agent.
// jsVersion - V8 version.
func (p *GetVersionParams) Do(ctxt context.Context, h cdp.Handler) (protocolVersion string, product string, revision string, userAgent string, jsVersion string, err error) {
// execute
var res GetVersionReturns
err = h.Execute(ctxt, cdp.CommandBrowserGetVersion, nil, &res)
if err != nil {
return "", "", "", "", "", err
}
return res.ProtocolVersion, res.Product, res.Revision, res.UserAgent, res.JsVersion, nil
}
// GetWindowBoundsParams get position and size of the browser window.
type GetWindowBoundsParams struct {
WindowID WindowID `json:"windowId"` // Browser window id.
}
// GetWindowBounds get position and size of the browser window.
//
// parameters:
// windowID - Browser window id.
func GetWindowBounds(windowID WindowID) *GetWindowBoundsParams {
return &GetWindowBoundsParams{
WindowID: windowID,
}
}
// GetWindowBoundsReturns return values.
type GetWindowBoundsReturns struct {
Bounds *Bounds `json:"bounds,omitempty"` // Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
}
// Do executes Browser.getWindowBounds against the provided context and
// target handler.
//
// returns:
// bounds - Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
func (p *GetWindowBoundsParams) Do(ctxt context.Context, h cdp.Handler) (bounds *Bounds, err error) {
// execute
var res GetWindowBoundsReturns
err = h.Execute(ctxt, cdp.CommandBrowserGetWindowBounds, p, &res)
if err != nil {
return nil, err
}
return res.Bounds, nil
}
// GetWindowForTargetParams get the browser window that contains the devtools
// target.
type GetWindowForTargetParams struct {
TargetID target.ID `json:"targetId"` // Devtools agent host id.
}
// GetWindowForTarget get the browser window that contains the devtools
// target.
//
// parameters:
// targetID - Devtools agent host id.
func GetWindowForTarget(targetID target.ID) *GetWindowForTargetParams {
return &GetWindowForTargetParams{
TargetID: targetID,
}
}
// GetWindowForTargetReturns return values.
type GetWindowForTargetReturns struct {
WindowID WindowID `json:"windowId,omitempty"` // Browser window id.
Bounds *Bounds `json:"bounds,omitempty"` // Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
}
// Do executes Browser.getWindowForTarget against the provided context and
// target handler.
//
// returns:
// windowID - Browser window id.
// bounds - Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
func (p *GetWindowForTargetParams) Do(ctxt context.Context, h cdp.Handler) (windowID WindowID, bounds *Bounds, err error) {
// execute
var res GetWindowForTargetReturns
err = h.Execute(ctxt, cdp.CommandBrowserGetWindowForTarget, p, &res)
if err != nil {
return 0, nil, err
}
return res.WindowID, res.Bounds, nil
}
// SetWindowBoundsParams set position and/or size of the browser window.
type SetWindowBoundsParams struct {
WindowID WindowID `json:"windowId"` // Browser window id.
Bounds *Bounds `json:"bounds"` // New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
}
// SetWindowBounds set position and/or size of the browser window.
//
// parameters:
// windowID - Browser window id.
// bounds - New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
func SetWindowBounds(windowID WindowID, bounds *Bounds) *SetWindowBoundsParams {
return &SetWindowBoundsParams{
WindowID: windowID,
Bounds: bounds,
}
}
// Do executes Browser.setWindowBounds against the provided context and
// target handler.
func (p *SetWindowBoundsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandBrowserSetWindowBounds, p, nil)
}

View File

@ -1,783 +0,0 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package browser
import (
json "encoding/json"
target "github.com/knq/chromedp/cdp/target"
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 easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser(in *jlexer.Lexer, out *SetWindowBoundsParams) {
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 "windowId":
out.WindowID = WindowID(in.Int64())
case "bounds":
if in.IsNull() {
in.Skip()
out.Bounds = nil
} else {
if out.Bounds == nil {
out.Bounds = new(Bounds)
}
(*out.Bounds).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser(out *jwriter.Writer, in SetWindowBoundsParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"windowId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.WindowID))
}
{
const prefix string = ",\"bounds\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
if in.Bounds == nil {
out.RawString("null")
} else {
(*in.Bounds).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetWindowBoundsParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetWindowBoundsParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetWindowBoundsParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetWindowBoundsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser1(in *jlexer.Lexer, out *GetWindowForTargetReturns) {
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 "windowId":
out.WindowID = WindowID(in.Int64())
case "bounds":
if in.IsNull() {
in.Skip()
out.Bounds = nil
} else {
if out.Bounds == nil {
out.Bounds = new(Bounds)
}
(*out.Bounds).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser1(out *jwriter.Writer, in GetWindowForTargetReturns) {
out.RawByte('{')
first := true
_ = first
if in.WindowID != 0 {
const prefix string = ",\"windowId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.WindowID))
}
if in.Bounds != nil {
const prefix string = ",\"bounds\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.Bounds).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetWindowForTargetReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetWindowForTargetReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetWindowForTargetReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetWindowForTargetReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser2(in *jlexer.Lexer, out *GetWindowForTargetParams) {
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 "targetId":
out.TargetID = target.ID(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser2(out *jwriter.Writer, in GetWindowForTargetParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"targetId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.TargetID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetWindowForTargetParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetWindowForTargetParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetWindowForTargetParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetWindowForTargetParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser3(in *jlexer.Lexer, out *GetWindowBoundsReturns) {
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 "bounds":
if in.IsNull() {
in.Skip()
out.Bounds = nil
} else {
if out.Bounds == nil {
out.Bounds = new(Bounds)
}
(*out.Bounds).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser3(out *jwriter.Writer, in GetWindowBoundsReturns) {
out.RawByte('{')
first := true
_ = first
if in.Bounds != nil {
const prefix string = ",\"bounds\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.Bounds).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetWindowBoundsReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetWindowBoundsReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetWindowBoundsReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetWindowBoundsReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser4(in *jlexer.Lexer, out *GetWindowBoundsParams) {
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 "windowId":
out.WindowID = WindowID(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser4(out *jwriter.Writer, in GetWindowBoundsParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"windowId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.WindowID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetWindowBoundsParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetWindowBoundsParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetWindowBoundsParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetWindowBoundsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser4(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser5(in *jlexer.Lexer, out *GetVersionReturns) {
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 "protocolVersion":
out.ProtocolVersion = string(in.String())
case "product":
out.Product = string(in.String())
case "revision":
out.Revision = string(in.String())
case "userAgent":
out.UserAgent = string(in.String())
case "jsVersion":
out.JsVersion = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser5(out *jwriter.Writer, in GetVersionReturns) {
out.RawByte('{')
first := true
_ = first
if in.ProtocolVersion != "" {
const prefix string = ",\"protocolVersion\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.ProtocolVersion))
}
if in.Product != "" {
const prefix string = ",\"product\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Product))
}
if in.Revision != "" {
const prefix string = ",\"revision\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Revision))
}
if in.UserAgent != "" {
const prefix string = ",\"userAgent\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.UserAgent))
}
if in.JsVersion != "" {
const prefix string = ",\"jsVersion\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.JsVersion))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetVersionReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetVersionReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetVersionReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetVersionReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser6(in *jlexer.Lexer, out *GetVersionParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser6(out *jwriter.Writer, in GetVersionParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetVersionParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetVersionParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetVersionParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetVersionParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser6(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser7(in *jlexer.Lexer, out *CloseParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser7(out *jwriter.Writer, in CloseParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v CloseParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CloseParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CloseParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CloseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser7(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser8(in *jlexer.Lexer, out *Bounds) {
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 "left":
out.Left = int64(in.Int64())
case "top":
out.Top = int64(in.Int64())
case "width":
out.Width = int64(in.Int64())
case "height":
out.Height = int64(in.Int64())
case "windowState":
(out.WindowState).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser8(out *jwriter.Writer, in Bounds) {
out.RawByte('{')
first := true
_ = first
if in.Left != 0 {
const prefix string = ",\"left\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Left))
}
if in.Top != 0 {
const prefix string = ",\"top\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Top))
}
if in.Width != 0 {
const prefix string = ",\"width\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Width))
}
if in.Height != 0 {
const prefix string = ",\"height\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Height))
}
if in.WindowState != "" {
const prefix string = ",\"windowState\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.WindowState).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Bounds) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Bounds) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpBrowser8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Bounds) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Bounds) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpBrowser8(l, v)
}

View File

@ -1,76 +0,0 @@
package browser
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// WindowID [no description].
type WindowID int64
// Int64 returns the WindowID as int64 value.
func (t WindowID) Int64() int64 {
return int64(t)
}
// WindowState the state of the browser window.
type WindowState string
// String returns the WindowState as string value.
func (t WindowState) String() string {
return string(t)
}
// WindowState values.
const (
WindowStateNormal WindowState = "normal"
WindowStateMinimized WindowState = "minimized"
WindowStateMaximized WindowState = "maximized"
WindowStateFullscreen WindowState = "fullscreen"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t WindowState) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t WindowState) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *WindowState) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch WindowState(in.String()) {
case WindowStateNormal:
*t = WindowStateNormal
case WindowStateMinimized:
*t = WindowStateMinimized
case WindowStateMaximized:
*t = WindowStateMaximized
case WindowStateFullscreen:
*t = WindowStateFullscreen
default:
in.AddError(errors.New("unknown WindowState value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *WindowState) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Bounds browser window bounds information.
type Bounds struct {
Left int64 `json:"left,omitempty"` // The offset from the left edge of the screen to the window in pixels.
Top int64 `json:"top,omitempty"` // The offset from the top edge of the screen to the window in pixels.
Width int64 `json:"width,omitempty"` // The window width in pixels.
Height int64 `json:"height,omitempty"` // The window height in pixels.
WindowState WindowState `json:"windowState,omitempty"` // The window state. Default to normal.
}

View File

@ -1,177 +0,0 @@
// Package cachestorage provides the Chrome Debugging Protocol
// commands, types, and events for the CacheStorage domain.
//
// Generated by the chromedp-gen command.
package cachestorage
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// DeleteCacheParams deletes a cache.
type DeleteCacheParams struct {
CacheID CacheID `json:"cacheId"` // Id of cache for deletion.
}
// DeleteCache deletes a cache.
//
// parameters:
// cacheID - Id of cache for deletion.
func DeleteCache(cacheID CacheID) *DeleteCacheParams {
return &DeleteCacheParams{
CacheID: cacheID,
}
}
// Do executes CacheStorage.deleteCache against the provided context and
// target handler.
func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteCache, p, nil)
}
// DeleteEntryParams deletes a cache entry.
type DeleteEntryParams struct {
CacheID CacheID `json:"cacheId"` // Id of cache where the entry will be deleted.
Request string `json:"request"` // URL spec of the request.
}
// DeleteEntry deletes a cache entry.
//
// parameters:
// cacheID - Id of cache where the entry will be deleted.
// request - URL spec of the request.
func DeleteEntry(cacheID CacheID, request string) *DeleteEntryParams {
return &DeleteEntryParams{
CacheID: cacheID,
Request: request,
}
}
// Do executes CacheStorage.deleteEntry against the provided context and
// target handler.
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCacheStorageDeleteEntry, p, nil)
}
// RequestCacheNamesParams requests cache names.
type RequestCacheNamesParams struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin.
}
// RequestCacheNames requests cache names.
//
// parameters:
// securityOrigin - Security origin.
func RequestCacheNames(securityOrigin string) *RequestCacheNamesParams {
return &RequestCacheNamesParams{
SecurityOrigin: securityOrigin,
}
}
// RequestCacheNamesReturns return values.
type RequestCacheNamesReturns struct {
Caches []*Cache `json:"caches,omitempty"` // Caches for the security origin.
}
// Do executes CacheStorage.requestCacheNames against the provided context and
// target handler.
//
// returns:
// caches - Caches for the security origin.
func (p *RequestCacheNamesParams) Do(ctxt context.Context, h cdp.Handler) (caches []*Cache, err error) {
// execute
var res RequestCacheNamesReturns
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestCacheNames, p, &res)
if err != nil {
return nil, err
}
return res.Caches, nil
}
// RequestCachedResponseParams fetches cache entry.
type RequestCachedResponseParams struct {
CacheID CacheID `json:"cacheId"` // Id of cache that contains the enty.
RequestURL string `json:"requestURL"` // URL spec of the request.
}
// RequestCachedResponse fetches cache entry.
//
// parameters:
// cacheID - Id of cache that contains the enty.
// requestURL - URL spec of the request.
func RequestCachedResponse(cacheID CacheID, requestURL string) *RequestCachedResponseParams {
return &RequestCachedResponseParams{
CacheID: cacheID,
RequestURL: requestURL,
}
}
// RequestCachedResponseReturns return values.
type RequestCachedResponseReturns struct {
Response *CachedResponse `json:"response,omitempty"` // Response read from the cache.
}
// Do executes CacheStorage.requestCachedResponse against the provided context and
// target handler.
//
// returns:
// response - Response read from the cache.
func (p *RequestCachedResponseParams) Do(ctxt context.Context, h cdp.Handler) (response *CachedResponse, err error) {
// execute
var res RequestCachedResponseReturns
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestCachedResponse, p, &res)
if err != nil {
return nil, err
}
return res.Response, nil
}
// RequestEntriesParams requests data from cache.
type RequestEntriesParams struct {
CacheID CacheID `json:"cacheId"` // ID of cache to get entries from.
SkipCount int64 `json:"skipCount"` // Number of records to skip.
PageSize int64 `json:"pageSize"` // Number of records to fetch.
}
// RequestEntries requests data from cache.
//
// parameters:
// cacheID - ID of cache to get entries from.
// skipCount - Number of records to skip.
// pageSize - Number of records to fetch.
func RequestEntries(cacheID CacheID, skipCount int64, pageSize int64) *RequestEntriesParams {
return &RequestEntriesParams{
CacheID: cacheID,
SkipCount: skipCount,
PageSize: pageSize,
}
}
// RequestEntriesReturns return values.
type RequestEntriesReturns struct {
CacheDataEntries []*DataEntry `json:"cacheDataEntries,omitempty"` // Array of object store data entries.
HasMore bool `json:"hasMore,omitempty"` // If true, there are more entries to fetch in the given range.
}
// Do executes CacheStorage.requestEntries against the provided context and
// target handler.
//
// returns:
// cacheDataEntries - Array of object store data entries.
// hasMore - If true, there are more entries to fetch in the given range.
func (p *RequestEntriesParams) Do(ctxt context.Context, h cdp.Handler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
// execute
var res RequestEntriesReturns
err = h.Execute(ctxt, cdp.CommandCacheStorageRequestEntries, p, &res)
if err != nil {
return nil, false, err
}
return res.CacheDataEntries, res.HasMore, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
package cachestorage
// Code generated by chromedp-gen. DO NOT EDIT.
// CacheID unique identifier of the Cache object.
type CacheID string
// String returns the CacheID as string value.
func (t CacheID) String() string {
return string(t)
}
// DataEntry data entry.
type DataEntry struct {
RequestURL string `json:"requestURL"` // Request URL.
RequestMethod string `json:"requestMethod"` // Request method.
RequestHeaders []*Header `json:"requestHeaders"` // Request headers
ResponseTime float64 `json:"responseTime"` // Number of seconds since epoch.
ResponseStatus int64 `json:"responseStatus"` // HTTP response status code.
ResponseStatusText string `json:"responseStatusText"` // HTTP response status text.
ResponseHeaders []*Header `json:"responseHeaders"` // Response headers
}
// Cache cache identifier.
type Cache struct {
CacheID CacheID `json:"cacheId"` // An opaque unique id of the cache.
SecurityOrigin string `json:"securityOrigin"` // Security origin of the cache.
CacheName string `json:"cacheName"` // The name of the cache.
}
// Header [no description].
type Header struct {
Name string `json:"name"`
Value string `json:"value"`
}
// CachedResponse cached response.
type CachedResponse struct {
Body string `json:"body"` // Entry content, base64-encoded.
}

2140
cdp/cdp.go

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,782 +0,0 @@
// Package css provides the Chrome Debugging Protocol
// commands, types, and events for the CSS domain.
//
// This domain exposes CSS read/write operations. All CSS objects
// (stylesheets, rules, and styles) have an associated id used in subsequent
// operations on the related object. Each object type has a specific id
// structure, and those are not interchangeable between objects of different
// kinds. CSS objects can be loaded using the get*ForNode() calls (which accept
// a DOM node id). A client can also keep track of stylesheets via the
// styleSheetAdded/styleSheetRemoved events and subsequently load the required
// stylesheet contents using the getStyleSheet[Text]() methods.
//
// Generated by the chromedp-gen command.
package css
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// AddRuleParams inserts a new rule with the given ruleText in a stylesheet
// with given styleSheetId, at the position specified by location.
type AddRuleParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The css style sheet identifier where a new rule should be inserted.
RuleText string `json:"ruleText"` // The text of a new rule.
Location *SourceRange `json:"location"` // Text position of a new rule in the target style sheet.
}
// AddRule inserts a new rule with the given ruleText in a stylesheet with
// given styleSheetId, at the position specified by location.
//
// parameters:
// styleSheetID - The css style sheet identifier where a new rule should be inserted.
// ruleText - The text of a new rule.
// location - Text position of a new rule in the target style sheet.
func AddRule(styleSheetID StyleSheetID, ruleText string, location *SourceRange) *AddRuleParams {
return &AddRuleParams{
StyleSheetID: styleSheetID,
RuleText: ruleText,
Location: location,
}
}
// AddRuleReturns return values.
type AddRuleReturns struct {
Rule *Rule `json:"rule,omitempty"` // The newly created rule.
}
// Do executes CSS.addRule against the provided context and
// target handler.
//
// returns:
// rule - The newly created rule.
func (p *AddRuleParams) Do(ctxt context.Context, h cdp.Handler) (rule *Rule, err error) {
// execute
var res AddRuleReturns
err = h.Execute(ctxt, cdp.CommandCSSAddRule, p, &res)
if err != nil {
return nil, err
}
return res.Rule, nil
}
// CollectClassNamesParams returns all class names from specified stylesheet.
type CollectClassNamesParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
}
// CollectClassNames returns all class names from specified stylesheet.
//
// parameters:
// styleSheetID
func CollectClassNames(styleSheetID StyleSheetID) *CollectClassNamesParams {
return &CollectClassNamesParams{
StyleSheetID: styleSheetID,
}
}
// CollectClassNamesReturns return values.
type CollectClassNamesReturns struct {
ClassNames []string `json:"classNames,omitempty"` // Class name list.
}
// Do executes CSS.collectClassNames against the provided context and
// target handler.
//
// returns:
// classNames - Class name list.
func (p *CollectClassNamesParams) Do(ctxt context.Context, h cdp.Handler) (classNames []string, err error) {
// execute
var res CollectClassNamesReturns
err = h.Execute(ctxt, cdp.CommandCSSCollectClassNames, p, &res)
if err != nil {
return nil, err
}
return res.ClassNames, nil
}
// CreateStyleSheetParams creates a new special "via-inspector" stylesheet in
// the frame with given frameId.
type CreateStyleSheetParams struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame where "via-inspector" stylesheet should be created.
}
// CreateStyleSheet creates a new special "via-inspector" stylesheet in the
// frame with given frameId.
//
// parameters:
// frameID - Identifier of the frame where "via-inspector" stylesheet should be created.
func CreateStyleSheet(frameID cdp.FrameID) *CreateStyleSheetParams {
return &CreateStyleSheetParams{
FrameID: frameID,
}
}
// CreateStyleSheetReturns return values.
type CreateStyleSheetReturns struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // Identifier of the created "via-inspector" stylesheet.
}
// Do executes CSS.createStyleSheet against the provided context and
// target handler.
//
// returns:
// styleSheetID - Identifier of the created "via-inspector" stylesheet.
func (p *CreateStyleSheetParams) Do(ctxt context.Context, h cdp.Handler) (styleSheetID StyleSheetID, err error) {
// execute
var res CreateStyleSheetReturns
err = h.Execute(ctxt, cdp.CommandCSSCreateStyleSheet, p, &res)
if err != nil {
return "", err
}
return res.StyleSheetID, nil
}
// DisableParams disables the CSS agent for the given page.
type DisableParams struct{}
// Disable disables the CSS agent for the given page.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes CSS.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCSSDisable, nil, nil)
}
// EnableParams enables the CSS agent for the given page. Clients should not
// assume that the CSS agent has been enabled until the result of this command
// is received.
type EnableParams struct{}
// Enable enables the CSS agent for the given page. Clients should not assume
// that the CSS agent has been enabled until the result of this command is
// received.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes CSS.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCSSEnable, nil, nil)
}
// ForcePseudoStateParams ensures that the given node will have specified
// pseudo-classes whenever its style is computed by the browser.
type ForcePseudoStateParams struct {
NodeID cdp.NodeID `json:"nodeId"` // The element id for which to force the pseudo state.
ForcedPseudoClasses []string `json:"forcedPseudoClasses"` // Element pseudo classes to force when computing the element's style.
}
// ForcePseudoState ensures that the given node will have specified
// pseudo-classes whenever its style is computed by the browser.
//
// parameters:
// nodeID - The element id for which to force the pseudo state.
// forcedPseudoClasses - Element pseudo classes to force when computing the element's style.
func ForcePseudoState(nodeID cdp.NodeID, forcedPseudoClasses []string) *ForcePseudoStateParams {
return &ForcePseudoStateParams{
NodeID: nodeID,
ForcedPseudoClasses: forcedPseudoClasses,
}
}
// Do executes CSS.forcePseudoState against the provided context and
// target handler.
func (p *ForcePseudoStateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCSSForcePseudoState, p, nil)
}
// GetBackgroundColorsParams [no description].
type GetBackgroundColorsParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node to get background colors for.
}
// GetBackgroundColors [no description].
//
// parameters:
// nodeID - Id of the node to get background colors for.
func GetBackgroundColors(nodeID cdp.NodeID) *GetBackgroundColorsParams {
return &GetBackgroundColorsParams{
NodeID: nodeID,
}
}
// GetBackgroundColorsReturns return values.
type GetBackgroundColorsReturns struct {
BackgroundColors []string `json:"backgroundColors,omitempty"` // The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).
ComputedFontSize string `json:"computedFontSize,omitempty"` // The computed font size for this node, as a CSS computed value string (e.g. '12px').
ComputedFontWeight string `json:"computedFontWeight,omitempty"` // The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
ComputedBodyFontSize string `json:"computedBodyFontSize,omitempty"` // The computed font size for the document body, as a computed CSS value string (e.g. '16px').
}
// Do executes CSS.getBackgroundColors against the provided context and
// target handler.
//
// returns:
// backgroundColors - The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).
// computedFontSize - The computed font size for this node, as a CSS computed value string (e.g. '12px').
// computedFontWeight - The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
// computedBodyFontSize - The computed font size for the document body, as a computed CSS value string (e.g. '16px').
func (p *GetBackgroundColorsParams) Do(ctxt context.Context, h cdp.Handler) (backgroundColors []string, computedFontSize string, computedFontWeight string, computedBodyFontSize string, err error) {
// execute
var res GetBackgroundColorsReturns
err = h.Execute(ctxt, cdp.CommandCSSGetBackgroundColors, p, &res)
if err != nil {
return nil, "", "", "", err
}
return res.BackgroundColors, res.ComputedFontSize, res.ComputedFontWeight, res.ComputedBodyFontSize, nil
}
// GetComputedStyleForNodeParams returns the computed style for a DOM node
// identified by nodeId.
type GetComputedStyleForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// GetComputedStyleForNode returns the computed style for a DOM node
// identified by nodeId.
//
// parameters:
// nodeID
func GetComputedStyleForNode(nodeID cdp.NodeID) *GetComputedStyleForNodeParams {
return &GetComputedStyleForNodeParams{
NodeID: nodeID,
}
}
// GetComputedStyleForNodeReturns return values.
type GetComputedStyleForNodeReturns struct {
ComputedStyle []*ComputedProperty `json:"computedStyle,omitempty"` // Computed style for the specified DOM node.
}
// Do executes CSS.getComputedStyleForNode against the provided context and
// target handler.
//
// returns:
// computedStyle - Computed style for the specified DOM node.
func (p *GetComputedStyleForNodeParams) Do(ctxt context.Context, h cdp.Handler) (computedStyle []*ComputedProperty, err error) {
// execute
var res GetComputedStyleForNodeReturns
err = h.Execute(ctxt, cdp.CommandCSSGetComputedStyleForNode, p, &res)
if err != nil {
return nil, err
}
return res.ComputedStyle, nil
}
// GetInlineStylesForNodeParams returns the styles defined inline (explicitly
// in the "style" attribute and implicitly, using DOM attributes) for a DOM node
// identified by nodeId.
type GetInlineStylesForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// GetInlineStylesForNode returns the styles defined inline (explicitly in
// the "style" attribute and implicitly, using DOM attributes) for a DOM node
// identified by nodeId.
//
// parameters:
// nodeID
func GetInlineStylesForNode(nodeID cdp.NodeID) *GetInlineStylesForNodeParams {
return &GetInlineStylesForNodeParams{
NodeID: nodeID,
}
}
// GetInlineStylesForNodeReturns return values.
type GetInlineStylesForNodeReturns struct {
InlineStyle *Style `json:"inlineStyle,omitempty"` // Inline style for the specified DOM node.
AttributesStyle *Style `json:"attributesStyle,omitempty"` // Attribute-defined element style (e.g. resulting from "width=20 height=100%").
}
// Do executes CSS.getInlineStylesForNode against the provided context and
// target handler.
//
// returns:
// inlineStyle - Inline style for the specified DOM node.
// attributesStyle - Attribute-defined element style (e.g. resulting from "width=20 height=100%").
func (p *GetInlineStylesForNodeParams) Do(ctxt context.Context, h cdp.Handler) (inlineStyle *Style, attributesStyle *Style, err error) {
// execute
var res GetInlineStylesForNodeReturns
err = h.Execute(ctxt, cdp.CommandCSSGetInlineStylesForNode, p, &res)
if err != nil {
return nil, nil, err
}
return res.InlineStyle, res.AttributesStyle, nil
}
// GetMatchedStylesForNodeParams returns requested styles for a DOM node
// identified by nodeId.
type GetMatchedStylesForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// GetMatchedStylesForNode returns requested styles for a DOM node identified
// by nodeId.
//
// parameters:
// nodeID
func GetMatchedStylesForNode(nodeID cdp.NodeID) *GetMatchedStylesForNodeParams {
return &GetMatchedStylesForNodeParams{
NodeID: nodeID,
}
}
// GetMatchedStylesForNodeReturns return values.
type GetMatchedStylesForNodeReturns struct {
InlineStyle *Style `json:"inlineStyle,omitempty"` // Inline style for the specified DOM node.
AttributesStyle *Style `json:"attributesStyle,omitempty"` // Attribute-defined element style (e.g. resulting from "width=20 height=100%").
MatchedCSSRules []*RuleMatch `json:"matchedCSSRules,omitempty"` // CSS rules matching this node, from all applicable stylesheets.
PseudoElements []*PseudoElementMatches `json:"pseudoElements,omitempty"` // Pseudo style matches for this node.
Inherited []*InheritedStyleEntry `json:"inherited,omitempty"` // A chain of inherited styles (from the immediate node parent up to the DOM tree root).
CSSKeyframesRules []*KeyframesRule `json:"cssKeyframesRules,omitempty"` // A list of CSS keyframed animations matching this node.
}
// Do executes CSS.getMatchedStylesForNode against the provided context and
// target handler.
//
// returns:
// inlineStyle - Inline style for the specified DOM node.
// attributesStyle - Attribute-defined element style (e.g. resulting from "width=20 height=100%").
// matchedCSSRules - CSS rules matching this node, from all applicable stylesheets.
// pseudoElements - Pseudo style matches for this node.
// inherited - A chain of inherited styles (from the immediate node parent up to the DOM tree root).
// cssKeyframesRules - A list of CSS keyframed animations matching this node.
func (p *GetMatchedStylesForNodeParams) Do(ctxt context.Context, h cdp.Handler) (inlineStyle *Style, attributesStyle *Style, matchedCSSRules []*RuleMatch, pseudoElements []*PseudoElementMatches, inherited []*InheritedStyleEntry, cssKeyframesRules []*KeyframesRule, err error) {
// execute
var res GetMatchedStylesForNodeReturns
err = h.Execute(ctxt, cdp.CommandCSSGetMatchedStylesForNode, p, &res)
if err != nil {
return nil, nil, nil, nil, nil, nil, err
}
return res.InlineStyle, res.AttributesStyle, res.MatchedCSSRules, res.PseudoElements, res.Inherited, res.CSSKeyframesRules, nil
}
// GetMediaQueriesParams returns all media queries parsed by the rendering
// engine.
type GetMediaQueriesParams struct{}
// GetMediaQueries returns all media queries parsed by the rendering engine.
func GetMediaQueries() *GetMediaQueriesParams {
return &GetMediaQueriesParams{}
}
// GetMediaQueriesReturns return values.
type GetMediaQueriesReturns struct {
Medias []*Media `json:"medias,omitempty"`
}
// Do executes CSS.getMediaQueries against the provided context and
// target handler.
//
// returns:
// medias
func (p *GetMediaQueriesParams) Do(ctxt context.Context, h cdp.Handler) (medias []*Media, err error) {
// execute
var res GetMediaQueriesReturns
err = h.Execute(ctxt, cdp.CommandCSSGetMediaQueries, nil, &res)
if err != nil {
return nil, err
}
return res.Medias, nil
}
// GetPlatformFontsForNodeParams requests information about platform fonts
// which we used to render child TextNodes in the given node.
type GetPlatformFontsForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// GetPlatformFontsForNode requests information about platform fonts which we
// used to render child TextNodes in the given node.
//
// parameters:
// nodeID
func GetPlatformFontsForNode(nodeID cdp.NodeID) *GetPlatformFontsForNodeParams {
return &GetPlatformFontsForNodeParams{
NodeID: nodeID,
}
}
// GetPlatformFontsForNodeReturns return values.
type GetPlatformFontsForNodeReturns struct {
Fonts []*PlatformFontUsage `json:"fonts,omitempty"` // Usage statistics for every employed platform font.
}
// Do executes CSS.getPlatformFontsForNode against the provided context and
// target handler.
//
// returns:
// fonts - Usage statistics for every employed platform font.
func (p *GetPlatformFontsForNodeParams) Do(ctxt context.Context, h cdp.Handler) (fonts []*PlatformFontUsage, err error) {
// execute
var res GetPlatformFontsForNodeReturns
err = h.Execute(ctxt, cdp.CommandCSSGetPlatformFontsForNode, p, &res)
if err != nil {
return nil, err
}
return res.Fonts, nil
}
// GetStyleSheetTextParams returns the current textual content and the URL
// for a stylesheet.
type GetStyleSheetTextParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
}
// GetStyleSheetText returns the current textual content and the URL for a
// stylesheet.
//
// parameters:
// styleSheetID
func GetStyleSheetText(styleSheetID StyleSheetID) *GetStyleSheetTextParams {
return &GetStyleSheetTextParams{
StyleSheetID: styleSheetID,
}
}
// GetStyleSheetTextReturns return values.
type GetStyleSheetTextReturns struct {
Text string `json:"text,omitempty"` // The stylesheet text.
}
// Do executes CSS.getStyleSheetText against the provided context and
// target handler.
//
// returns:
// text - The stylesheet text.
func (p *GetStyleSheetTextParams) Do(ctxt context.Context, h cdp.Handler) (text string, err error) {
// execute
var res GetStyleSheetTextReturns
err = h.Execute(ctxt, cdp.CommandCSSGetStyleSheetText, p, &res)
if err != nil {
return "", err
}
return res.Text, nil
}
// SetEffectivePropertyValueForNodeParams find a rule with the given active
// property for the given node and set the new value for this property.
type SetEffectivePropertyValueForNodeParams struct {
NodeID cdp.NodeID `json:"nodeId"` // The element id for which to set property.
PropertyName string `json:"propertyName"`
Value string `json:"value"`
}
// SetEffectivePropertyValueForNode find a rule with the given active
// property for the given node and set the new value for this property.
//
// parameters:
// nodeID - The element id for which to set property.
// propertyName
// value
func SetEffectivePropertyValueForNode(nodeID cdp.NodeID, propertyName string, value string) *SetEffectivePropertyValueForNodeParams {
return &SetEffectivePropertyValueForNodeParams{
NodeID: nodeID,
PropertyName: propertyName,
Value: value,
}
}
// Do executes CSS.setEffectivePropertyValueForNode against the provided context and
// target handler.
func (p *SetEffectivePropertyValueForNodeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCSSSetEffectivePropertyValueForNode, p, nil)
}
// SetKeyframeKeyParams modifies the keyframe rule key text.
type SetKeyframeKeyParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
Range *SourceRange `json:"range"`
KeyText string `json:"keyText"`
}
// SetKeyframeKey modifies the keyframe rule key text.
//
// parameters:
// styleSheetID
// range
// keyText
func SetKeyframeKey(styleSheetID StyleSheetID, rangeVal *SourceRange, keyText string) *SetKeyframeKeyParams {
return &SetKeyframeKeyParams{
StyleSheetID: styleSheetID,
Range: rangeVal,
KeyText: keyText,
}
}
// SetKeyframeKeyReturns return values.
type SetKeyframeKeyReturns struct {
KeyText *Value `json:"keyText,omitempty"` // The resulting key text after modification.
}
// Do executes CSS.setKeyframeKey against the provided context and
// target handler.
//
// returns:
// keyText - The resulting key text after modification.
func (p *SetKeyframeKeyParams) Do(ctxt context.Context, h cdp.Handler) (keyText *Value, err error) {
// execute
var res SetKeyframeKeyReturns
err = h.Execute(ctxt, cdp.CommandCSSSetKeyframeKey, p, &res)
if err != nil {
return nil, err
}
return res.KeyText, nil
}
// SetMediaTextParams modifies the rule selector.
type SetMediaTextParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
Range *SourceRange `json:"range"`
Text string `json:"text"`
}
// SetMediaText modifies the rule selector.
//
// parameters:
// styleSheetID
// range
// text
func SetMediaText(styleSheetID StyleSheetID, rangeVal *SourceRange, text string) *SetMediaTextParams {
return &SetMediaTextParams{
StyleSheetID: styleSheetID,
Range: rangeVal,
Text: text,
}
}
// SetMediaTextReturns return values.
type SetMediaTextReturns struct {
Media *Media `json:"media,omitempty"` // The resulting CSS media rule after modification.
}
// Do executes CSS.setMediaText against the provided context and
// target handler.
//
// returns:
// media - The resulting CSS media rule after modification.
func (p *SetMediaTextParams) Do(ctxt context.Context, h cdp.Handler) (media *Media, err error) {
// execute
var res SetMediaTextReturns
err = h.Execute(ctxt, cdp.CommandCSSSetMediaText, p, &res)
if err != nil {
return nil, err
}
return res.Media, nil
}
// SetRuleSelectorParams modifies the rule selector.
type SetRuleSelectorParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
Range *SourceRange `json:"range"`
Selector string `json:"selector"`
}
// SetRuleSelector modifies the rule selector.
//
// parameters:
// styleSheetID
// range
// selector
func SetRuleSelector(styleSheetID StyleSheetID, rangeVal *SourceRange, selector string) *SetRuleSelectorParams {
return &SetRuleSelectorParams{
StyleSheetID: styleSheetID,
Range: rangeVal,
Selector: selector,
}
}
// SetRuleSelectorReturns return values.
type SetRuleSelectorReturns struct {
SelectorList *SelectorList `json:"selectorList,omitempty"` // The resulting selector list after modification.
}
// Do executes CSS.setRuleSelector against the provided context and
// target handler.
//
// returns:
// selectorList - The resulting selector list after modification.
func (p *SetRuleSelectorParams) Do(ctxt context.Context, h cdp.Handler) (selectorList *SelectorList, err error) {
// execute
var res SetRuleSelectorReturns
err = h.Execute(ctxt, cdp.CommandCSSSetRuleSelector, p, &res)
if err != nil {
return nil, err
}
return res.SelectorList, nil
}
// SetStyleSheetTextParams sets the new stylesheet text.
type SetStyleSheetTextParams struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
Text string `json:"text"`
}
// SetStyleSheetText sets the new stylesheet text.
//
// parameters:
// styleSheetID
// text
func SetStyleSheetText(styleSheetID StyleSheetID, text string) *SetStyleSheetTextParams {
return &SetStyleSheetTextParams{
StyleSheetID: styleSheetID,
Text: text,
}
}
// SetStyleSheetTextReturns return values.
type SetStyleSheetTextReturns struct {
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with script (if any).
}
// Do executes CSS.setStyleSheetText against the provided context and
// target handler.
//
// returns:
// sourceMapURL - URL of source map associated with script (if any).
func (p *SetStyleSheetTextParams) Do(ctxt context.Context, h cdp.Handler) (sourceMapURL string, err error) {
// execute
var res SetStyleSheetTextReturns
err = h.Execute(ctxt, cdp.CommandCSSSetStyleSheetText, p, &res)
if err != nil {
return "", err
}
return res.SourceMapURL, nil
}
// SetStyleTextsParams applies specified style edits one after another in the
// given order.
type SetStyleTextsParams struct {
Edits []*StyleDeclarationEdit `json:"edits"`
}
// SetStyleTexts applies specified style edits one after another in the given
// order.
//
// parameters:
// edits
func SetStyleTexts(edits []*StyleDeclarationEdit) *SetStyleTextsParams {
return &SetStyleTextsParams{
Edits: edits,
}
}
// SetStyleTextsReturns return values.
type SetStyleTextsReturns struct {
Styles []*Style `json:"styles,omitempty"` // The resulting styles after modification.
}
// Do executes CSS.setStyleTexts against the provided context and
// target handler.
//
// returns:
// styles - The resulting styles after modification.
func (p *SetStyleTextsParams) Do(ctxt context.Context, h cdp.Handler) (styles []*Style, err error) {
// execute
var res SetStyleTextsReturns
err = h.Execute(ctxt, cdp.CommandCSSSetStyleTexts, p, &res)
if err != nil {
return nil, err
}
return res.Styles, nil
}
// StartRuleUsageTrackingParams enables the selector recording.
type StartRuleUsageTrackingParams struct{}
// StartRuleUsageTracking enables the selector recording.
func StartRuleUsageTracking() *StartRuleUsageTrackingParams {
return &StartRuleUsageTrackingParams{}
}
// Do executes CSS.startRuleUsageTracking against the provided context and
// target handler.
func (p *StartRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandCSSStartRuleUsageTracking, nil, nil)
}
// StopRuleUsageTrackingParams the list of rules with an indication of
// whether these were used.
type StopRuleUsageTrackingParams struct{}
// StopRuleUsageTracking the list of rules with an indication of whether
// these were used.
func StopRuleUsageTracking() *StopRuleUsageTrackingParams {
return &StopRuleUsageTrackingParams{}
}
// StopRuleUsageTrackingReturns return values.
type StopRuleUsageTrackingReturns struct {
RuleUsage []*RuleUsage `json:"ruleUsage,omitempty"`
}
// Do executes CSS.stopRuleUsageTracking against the provided context and
// target handler.
//
// returns:
// ruleUsage
func (p *StopRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.Handler) (ruleUsage []*RuleUsage, err error) {
// execute
var res StopRuleUsageTrackingReturns
err = h.Execute(ctxt, cdp.CommandCSSStopRuleUsageTracking, nil, &res)
if err != nil {
return nil, err
}
return res.RuleUsage, nil
}
// TakeCoverageDeltaParams obtain list of rules that became used since last
// call to this method (or since start of coverage instrumentation).
type TakeCoverageDeltaParams struct{}
// TakeCoverageDelta obtain list of rules that became used since last call to
// this method (or since start of coverage instrumentation).
func TakeCoverageDelta() *TakeCoverageDeltaParams {
return &TakeCoverageDeltaParams{}
}
// TakeCoverageDeltaReturns return values.
type TakeCoverageDeltaReturns struct {
Coverage []*RuleUsage `json:"coverage,omitempty"`
}
// Do executes CSS.takeCoverageDelta against the provided context and
// target handler.
//
// returns:
// coverage
func (p *TakeCoverageDeltaParams) Do(ctxt context.Context, h cdp.Handler) (coverage []*RuleUsage, err error) {
// execute
var res TakeCoverageDeltaReturns
err = h.Execute(ctxt, cdp.CommandCSSTakeCoverageDelta, nil, &res)
if err != nil {
return nil, err
}
return res.Coverage, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,42 +0,0 @@
package css
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventFontsUpdated fires whenever a web font gets loaded.
type EventFontsUpdated struct{}
// EventMediaQueryResultChanged fires whenever a MediaQuery result changes
// (for example, after a browser window has been resized.) The current
// implementation considers only viewport-dependent media features.
type EventMediaQueryResultChanged struct{}
// EventStyleSheetAdded fired whenever an active document stylesheet is
// added.
type EventStyleSheetAdded struct {
Header *StyleSheetHeader `json:"header"` // Added stylesheet metainfo.
}
// EventStyleSheetChanged fired whenever a stylesheet is changed as a result
// of the client operation.
type EventStyleSheetChanged struct {
StyleSheetID StyleSheetID `json:"styleSheetId"`
}
// EventStyleSheetRemoved fired whenever an active document stylesheet is
// removed.
type EventStyleSheetRemoved struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // Identifier of the removed stylesheet.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventCSSFontsUpdated,
cdp.EventCSSMediaQueryResultChanged,
cdp.EventCSSStyleSheetAdded,
cdp.EventCSSStyleSheetChanged,
cdp.EventCSSStyleSheetRemoved,
}

View File

@ -1,285 +0,0 @@
package css
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// StyleSheetID [no description].
type StyleSheetID string
// String returns the StyleSheetID as string value.
func (t StyleSheetID) String() string {
return string(t)
}
// StyleSheetOrigin stylesheet type: "injected" for stylesheets injected via
// extension, "user-agent" for user-agent stylesheets, "inspector" for
// stylesheets created by the inspector (i.e. those holding the "via inspector"
// rules), "regular" for regular stylesheets.
type StyleSheetOrigin string
// String returns the StyleSheetOrigin as string value.
func (t StyleSheetOrigin) String() string {
return string(t)
}
// StyleSheetOrigin values.
const (
StyleSheetOriginInjected StyleSheetOrigin = "injected"
StyleSheetOriginUserAgent StyleSheetOrigin = "user-agent"
StyleSheetOriginInspector StyleSheetOrigin = "inspector"
StyleSheetOriginRegular StyleSheetOrigin = "regular"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t StyleSheetOrigin) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t StyleSheetOrigin) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *StyleSheetOrigin) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch StyleSheetOrigin(in.String()) {
case StyleSheetOriginInjected:
*t = StyleSheetOriginInjected
case StyleSheetOriginUserAgent:
*t = StyleSheetOriginUserAgent
case StyleSheetOriginInspector:
*t = StyleSheetOriginInspector
case StyleSheetOriginRegular:
*t = StyleSheetOriginRegular
default:
in.AddError(errors.New("unknown StyleSheetOrigin value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *StyleSheetOrigin) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// PseudoElementMatches CSS rule collection for a single pseudo style.
type PseudoElementMatches struct {
PseudoType cdp.PseudoType `json:"pseudoType"` // Pseudo element type.
Matches []*RuleMatch `json:"matches"` // Matches of CSS rules applicable to the pseudo style.
}
// InheritedStyleEntry inherited CSS rule collection from ancestor node.
type InheritedStyleEntry struct {
InlineStyle *Style `json:"inlineStyle,omitempty"` // The ancestor node's inline style, if any, in the style inheritance chain.
MatchedCSSRules []*RuleMatch `json:"matchedCSSRules"` // Matches of CSS rules matching the ancestor node in the style inheritance chain.
}
// RuleMatch match data for a CSS rule.
type RuleMatch struct {
Rule *Rule `json:"rule"` // CSS rule in the match.
MatchingSelectors []int64 `json:"matchingSelectors"` // Matching selector indices in the rule's selectorList selectors (0-based).
}
// Value data for a simple selector (these are delimited by commas in a
// selector list).
type Value struct {
Text string `json:"text"` // Value text.
Range *SourceRange `json:"range,omitempty"` // Value range in the underlying resource (if available).
}
// SelectorList selector list data.
type SelectorList struct {
Selectors []*Value `json:"selectors"` // Selectors in the list.
Text string `json:"text"` // Rule selector text.
}
// StyleSheetHeader CSS stylesheet metainformation.
type StyleSheetHeader struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The stylesheet identifier.
FrameID cdp.FrameID `json:"frameId"` // Owner frame identifier.
SourceURL string `json:"sourceURL"` // Stylesheet resource URL.
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with the stylesheet (if any).
Origin StyleSheetOrigin `json:"origin"` // Stylesheet origin.
Title string `json:"title"` // Stylesheet title.
OwnerNode cdp.BackendNodeID `json:"ownerNode,omitempty"` // The backend id for the owner node of the stylesheet.
Disabled bool `json:"disabled"` // Denotes whether the stylesheet is disabled.
HasSourceURL bool `json:"hasSourceURL,omitempty"` // Whether the sourceURL field value comes from the sourceURL comment.
IsInline bool `json:"isInline"` // Whether this stylesheet is created for STYLE tag by parser. This flag is not set for document.written STYLE tags.
StartLine float64 `json:"startLine"` // Line offset of the stylesheet within the resource (zero based).
StartColumn float64 `json:"startColumn"` // Column offset of the stylesheet within the resource (zero based).
Length float64 `json:"length"` // Size of the content (in characters).
}
// Rule CSS rule representation.
type Rule struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
SelectorList *SelectorList `json:"selectorList"` // Rule selector data.
Origin StyleSheetOrigin `json:"origin"` // Parent stylesheet's origin.
Style *Style `json:"style"` // Associated style declaration.
Media []*Media `json:"media,omitempty"` // Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards.
}
// RuleUsage CSS coverage information.
type RuleUsage struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
StartOffset float64 `json:"startOffset"` // Offset of the start of the rule (including selector) from the beginning of the stylesheet.
EndOffset float64 `json:"endOffset"` // Offset of the end of the rule body from the beginning of the stylesheet.
Used bool `json:"used"` // Indicates whether the rule was actually used by some element in the page.
}
// SourceRange text range within a resource. All numbers are zero-based.
type SourceRange struct {
StartLine int64 `json:"startLine"` // Start line of range.
StartColumn int64 `json:"startColumn"` // Start column of range (inclusive).
EndLine int64 `json:"endLine"` // End line of range
EndColumn int64 `json:"endColumn"` // End column of range (exclusive).
}
// ShorthandEntry [no description].
type ShorthandEntry struct {
Name string `json:"name"` // Shorthand name.
Value string `json:"value"` // Shorthand value.
Important bool `json:"important,omitempty"` // Whether the property has "!important" annotation (implies false if absent).
}
// ComputedProperty [no description].
type ComputedProperty struct {
Name string `json:"name"` // Computed style property name.
Value string `json:"value"` // Computed style property value.
}
// Style CSS style representation.
type Style struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
CSSProperties []*Property `json:"cssProperties"` // CSS properties in the style.
ShorthandEntries []*ShorthandEntry `json:"shorthandEntries"` // Computed values for all shorthands found in the style.
CSSText string `json:"cssText,omitempty"` // Style declaration text (if available).
Range *SourceRange `json:"range,omitempty"` // Style declaration range in the enclosing stylesheet (if available).
}
// Property CSS property declaration data.
type Property struct {
Name string `json:"name"` // The property name.
Value string `json:"value"` // The property value.
Important bool `json:"important,omitempty"` // Whether the property has "!important" annotation (implies false if absent).
Implicit bool `json:"implicit,omitempty"` // Whether the property is implicit (implies false if absent).
Text string `json:"text,omitempty"` // The full property text as specified in the style.
ParsedOk bool `json:"parsedOk,omitempty"` // Whether the property is understood by the browser (implies true if absent).
Disabled bool `json:"disabled,omitempty"` // Whether the property is disabled by the user (present for source-based properties only).
Range *SourceRange `json:"range,omitempty"` // The entire property range in the enclosing style declaration (if available).
}
// Media CSS media rule descriptor.
type Media struct {
Text string `json:"text"` // Media query text.
Source MediaSource `json:"source"` // Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline stylesheet's STYLE tag.
SourceURL string `json:"sourceURL,omitempty"` // URL of the document containing the media query description.
Range *SourceRange `json:"range,omitempty"` // The associated rule (@media or @import) header range in the enclosing stylesheet (if available).
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // Identifier of the stylesheet containing this object (if exists).
MediaList []*MediaQuery `json:"mediaList,omitempty"` // Array of media queries.
}
// MediaQuery media query descriptor.
type MediaQuery struct {
Expressions []*MediaQueryExpression `json:"expressions"` // Array of media query expressions.
Active bool `json:"active"` // Whether the media query condition is satisfied.
}
// MediaQueryExpression media query expression descriptor.
type MediaQueryExpression struct {
Value float64 `json:"value"` // Media query expression value.
Unit string `json:"unit"` // Media query expression units.
Feature string `json:"feature"` // Media query expression feature.
ValueRange *SourceRange `json:"valueRange,omitempty"` // The associated range of the value text in the enclosing stylesheet (if available).
ComputedLength float64 `json:"computedLength,omitempty"` // Computed length of media query expression (if applicable).
}
// PlatformFontUsage information about amount of glyphs that were rendered
// with given font.
type PlatformFontUsage struct {
FamilyName string `json:"familyName"` // Font's family name reported by platform.
IsCustomFont bool `json:"isCustomFont"` // Indicates if the font was downloaded or resolved locally.
GlyphCount float64 `json:"glyphCount"` // Amount of glyphs that were rendered with this font.
}
// KeyframesRule CSS keyframes rule representation.
type KeyframesRule struct {
AnimationName *Value `json:"animationName"` // Animation name.
Keyframes []*KeyframeRule `json:"keyframes"` // List of keyframes.
}
// KeyframeRule CSS keyframe rule representation.
type KeyframeRule struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.
Origin StyleSheetOrigin `json:"origin"` // Parent stylesheet's origin.
KeyText *Value `json:"keyText"` // Associated key text.
Style *Style `json:"style"` // Associated style declaration.
}
// StyleDeclarationEdit a descriptor of operation to mutate style declaration
// text.
type StyleDeclarationEdit struct {
StyleSheetID StyleSheetID `json:"styleSheetId"` // The css style sheet identifier.
Range *SourceRange `json:"range"` // The range of the style text in the enclosing stylesheet.
Text string `json:"text"` // New style text.
}
// MediaSource source of the media query: "mediaRule" if specified by a
// @media rule, "importRule" if specified by an @import rule, "linkedSheet" if
// specified by a "media" attribute in a linked stylesheet's LINK tag,
// "inlineSheet" if specified by a "media" attribute in an inline stylesheet's
// STYLE tag.
type MediaSource string
// String returns the MediaSource as string value.
func (t MediaSource) String() string {
return string(t)
}
// MediaSource values.
const (
MediaSourceMediaRule MediaSource = "mediaRule"
MediaSourceImportRule MediaSource = "importRule"
MediaSourceLinkedSheet MediaSource = "linkedSheet"
MediaSourceInlineSheet MediaSource = "inlineSheet"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t MediaSource) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t MediaSource) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *MediaSource) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch MediaSource(in.String()) {
case MediaSourceMediaRule:
*t = MediaSourceMediaRule
case MediaSourceImportRule:
*t = MediaSourceImportRule
case MediaSourceLinkedSheet:
*t = MediaSourceLinkedSheet
case MediaSourceInlineSheet:
*t = MediaSourceInlineSheet
default:
in.AddError(errors.New("unknown MediaSource value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *MediaSource) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -1,125 +0,0 @@
// Package database provides the Chrome Debugging Protocol
// commands, types, and events for the Database domain.
//
// Generated by the chromedp-gen command.
package database
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
)
// DisableParams disables database tracking, prevents database events from
// being sent to the client.
type DisableParams struct{}
// Disable disables database tracking, prevents database events from being
// sent to the client.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Database.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDatabaseDisable, nil, nil)
}
// EnableParams enables database tracking, database events will now be
// delivered to the client.
type EnableParams struct{}
// Enable enables database tracking, database events will now be delivered to
// the client.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Database.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDatabaseEnable, nil, nil)
}
// ExecuteSQLParams [no description].
type ExecuteSQLParams struct {
DatabaseID ID `json:"databaseId"`
Query string `json:"query"`
}
// ExecuteSQL [no description].
//
// parameters:
// databaseID
// query
func ExecuteSQL(databaseID ID, query string) *ExecuteSQLParams {
return &ExecuteSQLParams{
DatabaseID: databaseID,
Query: query,
}
}
// ExecuteSQLReturns return values.
type ExecuteSQLReturns struct {
ColumnNames []string `json:"columnNames,omitempty"`
Values []easyjson.RawMessage `json:"values,omitempty"`
SQLError *Error `json:"sqlError,omitempty"`
}
// Do executes Database.executeSQL against the provided context and
// target handler.
//
// returns:
// columnNames
// values
// sqlError
func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.Handler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
// execute
var res ExecuteSQLReturns
err = h.Execute(ctxt, cdp.CommandDatabaseExecuteSQL, p, &res)
if err != nil {
return nil, nil, nil, err
}
return res.ColumnNames, res.Values, res.SQLError, nil
}
// GetDatabaseTableNamesParams [no description].
type GetDatabaseTableNamesParams struct {
DatabaseID ID `json:"databaseId"`
}
// GetDatabaseTableNames [no description].
//
// parameters:
// databaseID
func GetDatabaseTableNames(databaseID ID) *GetDatabaseTableNamesParams {
return &GetDatabaseTableNamesParams{
DatabaseID: databaseID,
}
}
// GetDatabaseTableNamesReturns return values.
type GetDatabaseTableNamesReturns struct {
TableNames []string `json:"tableNames,omitempty"`
}
// Do executes Database.getDatabaseTableNames against the provided context and
// target handler.
//
// returns:
// tableNames
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
// execute
var res GetDatabaseTableNamesReturns
err = h.Execute(ctxt, cdp.CommandDatabaseGetDatabaseTableNames, p, &res)
if err != nil {
return nil, err
}
return res.TableNames, nil
}

View File

@ -1,828 +0,0 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package database
import (
json "encoding/json"
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 easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(in *jlexer.Lexer, out *GetDatabaseTableNamesReturns) {
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 "tableNames":
if in.IsNull() {
in.Skip()
out.TableNames = nil
} else {
in.Delim('[')
if out.TableNames == nil {
if !in.IsDelim(']') {
out.TableNames = make([]string, 0, 4)
} else {
out.TableNames = []string{}
}
} else {
out.TableNames = (out.TableNames)[:0]
}
for !in.IsDelim(']') {
var v1 string
v1 = string(in.String())
out.TableNames = append(out.TableNames, v1)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(out *jwriter.Writer, in GetDatabaseTableNamesReturns) {
out.RawByte('{')
first := true
_ = first
if len(in.TableNames) != 0 {
const prefix string = ",\"tableNames\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
{
out.RawByte('[')
for v2, v3 := range in.TableNames {
if v2 > 0 {
out.RawByte(',')
}
out.String(string(v3))
}
out.RawByte(']')
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetDatabaseTableNamesReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetDatabaseTableNamesReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetDatabaseTableNamesReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetDatabaseTableNamesReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(in *jlexer.Lexer, out *GetDatabaseTableNamesParams) {
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 "databaseId":
out.DatabaseID = ID(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(out *jwriter.Writer, in GetDatabaseTableNamesParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"databaseId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.DatabaseID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetDatabaseTableNamesParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetDatabaseTableNamesParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetDatabaseTableNamesParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetDatabaseTableNamesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(in *jlexer.Lexer, out *ExecuteSQLReturns) {
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 "columnNames":
if in.IsNull() {
in.Skip()
out.ColumnNames = nil
} else {
in.Delim('[')
if out.ColumnNames == nil {
if !in.IsDelim(']') {
out.ColumnNames = make([]string, 0, 4)
} else {
out.ColumnNames = []string{}
}
} else {
out.ColumnNames = (out.ColumnNames)[:0]
}
for !in.IsDelim(']') {
var v4 string
v4 = string(in.String())
out.ColumnNames = append(out.ColumnNames, v4)
in.WantComma()
}
in.Delim(']')
}
case "values":
if in.IsNull() {
in.Skip()
out.Values = nil
} else {
in.Delim('[')
if out.Values == nil {
if !in.IsDelim(']') {
out.Values = make([]easyjson.RawMessage, 0, 2)
} else {
out.Values = []easyjson.RawMessage{}
}
} else {
out.Values = (out.Values)[:0]
}
for !in.IsDelim(']') {
var v5 easyjson.RawMessage
(v5).UnmarshalEasyJSON(in)
out.Values = append(out.Values, v5)
in.WantComma()
}
in.Delim(']')
}
case "sqlError":
if in.IsNull() {
in.Skip()
out.SQLError = nil
} else {
if out.SQLError == nil {
out.SQLError = new(Error)
}
(*out.SQLError).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(out *jwriter.Writer, in ExecuteSQLReturns) {
out.RawByte('{')
first := true
_ = first
if len(in.ColumnNames) != 0 {
const prefix string = ",\"columnNames\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
{
out.RawByte('[')
for v6, v7 := range in.ColumnNames {
if v6 > 0 {
out.RawByte(',')
}
out.String(string(v7))
}
out.RawByte(']')
}
}
if len(in.Values) != 0 {
const prefix string = ",\"values\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
{
out.RawByte('[')
for v8, v9 := range in.Values {
if v8 > 0 {
out.RawByte(',')
}
(v9).MarshalEasyJSON(out)
}
out.RawByte(']')
}
}
if in.SQLError != nil {
const prefix string = ",\"sqlError\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.SQLError).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ExecuteSQLReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ExecuteSQLReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ExecuteSQLReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ExecuteSQLReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(in *jlexer.Lexer, out *ExecuteSQLParams) {
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 "databaseId":
out.DatabaseID = ID(in.String())
case "query":
out.Query = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase3(out *jwriter.Writer, in ExecuteSQLParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"databaseId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.DatabaseID))
}
{
const prefix string = ",\"query\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Query))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ExecuteSQLParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ExecuteSQLParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ExecuteSQLParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ExecuteSQLParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(in *jlexer.Lexer, out *EventAddDatabase) {
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 "database":
if in.IsNull() {
in.Skip()
out.Database = nil
} else {
if out.Database == nil {
out.Database = new(Database)
}
(*out.Database).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(out *jwriter.Writer, in EventAddDatabase) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"database\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
if in.Database == nil {
out.RawString("null")
} else {
(*in.Database).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventAddDatabase) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventAddDatabase) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventAddDatabase) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventAddDatabase) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase4(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(in *jlexer.Lexer, out *Error) {
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 "message":
out.Message = string(in.String())
case "code":
out.Code = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(out *jwriter.Writer, in Error) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"message\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Message))
}
{
const prefix string = ",\"code\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Code))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Error) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Error) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Error) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Error) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(in *jlexer.Lexer, out *EnableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase6(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase7(in *jlexer.Lexer, out *DisableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase7(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase7(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(in *jlexer.Lexer, out *Database) {
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 "id":
out.ID = ID(in.String())
case "domain":
out.Domain = string(in.String())
case "name":
out.Name = string(in.String())
case "version":
out.Version = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(out *jwriter.Writer, in Database) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"id\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.ID))
}
{
const prefix string = ",\"domain\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Domain))
}
{
const prefix string = ",\"name\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Name))
}
{
const prefix string = ",\"version\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Version))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Database) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Database) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDatabase8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Database) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Database) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDatabase8(l, v)
}

View File

@ -1,17 +0,0 @@
package database
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventAddDatabase [no description].
type EventAddDatabase struct {
Database *Database `json:"database"`
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventDatabaseAddDatabase,
}

View File

@ -1,25 +0,0 @@
package database
// Code generated by chromedp-gen. DO NOT EDIT.
// ID unique identifier of Database object.
type ID string
// String returns the ID as string value.
func (t ID) String() string {
return string(t)
}
// Database database object.
type Database struct {
ID ID `json:"id"` // Database ID.
Domain string `json:"domain"` // Database domain.
Name string `json:"name"` // Database name.
Version string `json:"version"` // Database version.
}
// Error database error.
type Error struct {
Message string `json:"message"` // Error message.
Code int64 `json:"code"` // Error code.
}

View File

@ -1,938 +0,0 @@
// Package debugger provides the Chrome Debugging Protocol
// commands, types, and events for the Debugger domain.
//
// Debugger domain exposes JavaScript debugging capabilities. It allows
// setting and removing breakpoints, stepping through execution, exploring stack
// traces, etc.
//
// Generated by the chromedp-gen command.
package debugger
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
)
// ContinueToLocationParams continues execution until specific location is
// reached.
type ContinueToLocationParams struct {
Location *Location `json:"location"` // Location to continue to.
TargetCallFrames ContinueToLocationTargetCallFrames `json:"targetCallFrames,omitempty"`
}
// ContinueToLocation continues execution until specific location is reached.
//
// parameters:
// location - Location to continue to.
func ContinueToLocation(location *Location) *ContinueToLocationParams {
return &ContinueToLocationParams{
Location: location,
}
}
// WithTargetCallFrames [no description].
func (p ContinueToLocationParams) WithTargetCallFrames(targetCallFrames ContinueToLocationTargetCallFrames) *ContinueToLocationParams {
p.TargetCallFrames = targetCallFrames
return &p
}
// Do executes Debugger.continueToLocation against the provided context and
// target handler.
func (p *ContinueToLocationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerContinueToLocation, p, nil)
}
// DisableParams disables debugger for given page.
type DisableParams struct{}
// Disable disables debugger for given page.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Debugger.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerDisable, nil, nil)
}
// EnableParams enables debugger for the given page. Clients should not
// assume that the debugging has been enabled until the result for this command
// is received.
type EnableParams struct{}
// Enable enables debugger for the given page. Clients should not assume that
// the debugging has been enabled until the result for this command is received.
func Enable() *EnableParams {
return &EnableParams{}
}
// EnableReturns return values.
type EnableReturns struct {
DebuggerID runtime.UniqueDebuggerID `json:"debuggerId,omitempty"` // Unique identifier of the debugger.
}
// Do executes Debugger.enable against the provided context and
// target handler.
//
// returns:
// debuggerID - Unique identifier of the debugger.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (debuggerID runtime.UniqueDebuggerID, err error) {
// execute
var res EnableReturns
err = h.Execute(ctxt, cdp.CommandDebuggerEnable, nil, &res)
if err != nil {
return "", err
}
return res.DebuggerID, nil
}
// EvaluateOnCallFrameParams evaluates expression on a given call frame.
type EvaluateOnCallFrameParams struct {
CallFrameID CallFrameID `json:"callFrameId"` // Call frame identifier to evaluate on.
Expression string `json:"expression"` // Expression to evaluate.
ObjectGroup string `json:"objectGroup,omitempty"` // String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup).
IncludeCommandLineAPI bool `json:"includeCommandLineAPI,omitempty"` // Specifies whether command line API should be available to the evaluated expression, defaults to false.
Silent bool `json:"silent,omitempty"` // In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
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.
ThrowOnSideEffect bool `json:"throwOnSideEffect,omitempty"` // Whether to throw an exception if side effect cannot be ruled out during evaluation.
}
// EvaluateOnCallFrame evaluates expression on a given call frame.
//
// parameters:
// callFrameID - Call frame identifier to evaluate on.
// expression - Expression to evaluate.
func EvaluateOnCallFrame(callFrameID CallFrameID, expression string) *EvaluateOnCallFrameParams {
return &EvaluateOnCallFrameParams{
CallFrameID: callFrameID,
Expression: expression,
}
}
// WithObjectGroup string object group name to put result into (allows rapid
// releasing resulting object handles using releaseObjectGroup).
func (p EvaluateOnCallFrameParams) WithObjectGroup(objectGroup string) *EvaluateOnCallFrameParams {
p.ObjectGroup = objectGroup
return &p
}
// WithIncludeCommandLineAPI specifies whether command line API should be
// available to the evaluated expression, defaults to false.
func (p EvaluateOnCallFrameParams) WithIncludeCommandLineAPI(includeCommandLineAPI bool) *EvaluateOnCallFrameParams {
p.IncludeCommandLineAPI = includeCommandLineAPI
return &p
}
// WithSilent in silent mode exceptions thrown during evaluation are not
// reported and do not pause execution. Overrides setPauseOnException state.
func (p EvaluateOnCallFrameParams) WithSilent(silent bool) *EvaluateOnCallFrameParams {
p.Silent = silent
return &p
}
// WithReturnByValue whether the result is expected to be a JSON object that
// should be sent by value.
func (p EvaluateOnCallFrameParams) WithReturnByValue(returnByValue bool) *EvaluateOnCallFrameParams {
p.ReturnByValue = returnByValue
return &p
}
// WithGeneratePreview whether preview should be generated for the result.
func (p EvaluateOnCallFrameParams) WithGeneratePreview(generatePreview bool) *EvaluateOnCallFrameParams {
p.GeneratePreview = generatePreview
return &p
}
// WithThrowOnSideEffect whether to throw an exception if side effect cannot
// be ruled out during evaluation.
func (p EvaluateOnCallFrameParams) WithThrowOnSideEffect(throwOnSideEffect bool) *EvaluateOnCallFrameParams {
p.ThrowOnSideEffect = throwOnSideEffect
return &p
}
// EvaluateOnCallFrameReturns return values.
type EvaluateOnCallFrameReturns struct {
Result *runtime.RemoteObject `json:"result,omitempty"` // Object wrapper for the evaluation result.
ExceptionDetails *runtime.ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}
// Do executes Debugger.evaluateOnCallFrame against the provided context and
// target handler.
//
// returns:
// result - Object wrapper for the evaluation result.
// exceptionDetails - Exception details.
func (p *EvaluateOnCallFrameParams) Do(ctxt context.Context, h cdp.Handler) (result *runtime.RemoteObject, exceptionDetails *runtime.ExceptionDetails, err error) {
// execute
var res EvaluateOnCallFrameReturns
err = h.Execute(ctxt, cdp.CommandDebuggerEvaluateOnCallFrame, p, &res)
if err != nil {
return nil, nil, err
}
return res.Result, res.ExceptionDetails, nil
}
// GetPossibleBreakpointsParams returns possible locations for breakpoint.
// scriptId in start and end range locations should be the same.
type GetPossibleBreakpointsParams struct {
Start *Location `json:"start"` // Start of range to search possible breakpoint locations in.
End *Location `json:"end,omitempty"` // End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range.
RestrictToFunction bool `json:"restrictToFunction,omitempty"` // Only consider locations which are in the same (non-nested) function as start.
}
// GetPossibleBreakpoints returns possible locations for breakpoint. scriptId
// in start and end range locations should be the same.
//
// parameters:
// start - Start of range to search possible breakpoint locations in.
func GetPossibleBreakpoints(start *Location) *GetPossibleBreakpointsParams {
return &GetPossibleBreakpointsParams{
Start: start,
}
}
// WithEnd end of range to search possible breakpoint locations in
// (excluding). When not specified, end of scripts is used as end of range.
func (p GetPossibleBreakpointsParams) WithEnd(end *Location) *GetPossibleBreakpointsParams {
p.End = end
return &p
}
// WithRestrictToFunction only consider locations which are in the same
// (non-nested) function as start.
func (p GetPossibleBreakpointsParams) WithRestrictToFunction(restrictToFunction bool) *GetPossibleBreakpointsParams {
p.RestrictToFunction = restrictToFunction
return &p
}
// GetPossibleBreakpointsReturns return values.
type GetPossibleBreakpointsReturns struct {
Locations []*BreakLocation `json:"locations,omitempty"` // List of the possible breakpoint locations.
}
// Do executes Debugger.getPossibleBreakpoints against the provided context and
// target handler.
//
// returns:
// locations - List of the possible breakpoint locations.
func (p *GetPossibleBreakpointsParams) Do(ctxt context.Context, h cdp.Handler) (locations []*BreakLocation, err error) {
// execute
var res GetPossibleBreakpointsReturns
err = h.Execute(ctxt, cdp.CommandDebuggerGetPossibleBreakpoints, p, &res)
if err != nil {
return nil, err
}
return res.Locations, nil
}
// GetScriptSourceParams returns source for the script with given id.
type GetScriptSourceParams struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Id of the script to get source for.
}
// GetScriptSource returns source for the script with given id.
//
// parameters:
// scriptID - Id of the script to get source for.
func GetScriptSource(scriptID runtime.ScriptID) *GetScriptSourceParams {
return &GetScriptSourceParams{
ScriptID: scriptID,
}
}
// GetScriptSourceReturns return values.
type GetScriptSourceReturns struct {
ScriptSource string `json:"scriptSource,omitempty"` // Script source.
}
// Do executes Debugger.getScriptSource against the provided context and
// target handler.
//
// returns:
// scriptSource - Script source.
func (p *GetScriptSourceParams) Do(ctxt context.Context, h cdp.Handler) (scriptSource string, err error) {
// execute
var res GetScriptSourceReturns
err = h.Execute(ctxt, cdp.CommandDebuggerGetScriptSource, p, &res)
if err != nil {
return "", err
}
return res.ScriptSource, nil
}
// GetStackTraceParams returns stack trace with given stackTraceId.
type GetStackTraceParams struct {
StackTraceID *runtime.StackTraceID `json:"stackTraceId"`
}
// GetStackTrace returns stack trace with given stackTraceId.
//
// parameters:
// stackTraceID
func GetStackTrace(stackTraceID *runtime.StackTraceID) *GetStackTraceParams {
return &GetStackTraceParams{
StackTraceID: stackTraceID,
}
}
// GetStackTraceReturns return values.
type GetStackTraceReturns struct {
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"`
}
// Do executes Debugger.getStackTrace against the provided context and
// target handler.
//
// returns:
// stackTrace
func (p *GetStackTraceParams) Do(ctxt context.Context, h cdp.Handler) (stackTrace *runtime.StackTrace, err error) {
// execute
var res GetStackTraceReturns
err = h.Execute(ctxt, cdp.CommandDebuggerGetStackTrace, p, &res)
if err != nil {
return nil, err
}
return res.StackTrace, nil
}
// PauseParams stops on the next JavaScript statement.
type PauseParams struct{}
// Pause stops on the next JavaScript statement.
func Pause() *PauseParams {
return &PauseParams{}
}
// Do executes Debugger.pause against the provided context and
// target handler.
func (p *PauseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerPause, nil, nil)
}
// PauseOnAsyncCallParams [no description].
type PauseOnAsyncCallParams struct {
ParentStackTraceID *runtime.StackTraceID `json:"parentStackTraceId"` // Debugger will pause when async call with given stack trace is started.
}
// PauseOnAsyncCall [no description].
//
// parameters:
// parentStackTraceID - Debugger will pause when async call with given stack trace is started.
func PauseOnAsyncCall(parentStackTraceID *runtime.StackTraceID) *PauseOnAsyncCallParams {
return &PauseOnAsyncCallParams{
ParentStackTraceID: parentStackTraceID,
}
}
// Do executes Debugger.pauseOnAsyncCall against the provided context and
// target handler.
func (p *PauseOnAsyncCallParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerPauseOnAsyncCall, p, nil)
}
// RemoveBreakpointParams removes JavaScript breakpoint.
type RemoveBreakpointParams struct {
BreakpointID BreakpointID `json:"breakpointId"`
}
// RemoveBreakpoint removes JavaScript breakpoint.
//
// parameters:
// breakpointID
func RemoveBreakpoint(breakpointID BreakpointID) *RemoveBreakpointParams {
return &RemoveBreakpointParams{
BreakpointID: breakpointID,
}
}
// Do executes Debugger.removeBreakpoint against the provided context and
// target handler.
func (p *RemoveBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerRemoveBreakpoint, p, nil)
}
// RestartFrameParams restarts particular call frame from the beginning.
type RestartFrameParams struct {
CallFrameID CallFrameID `json:"callFrameId"` // Call frame identifier to evaluate on.
}
// RestartFrame restarts particular call frame from the beginning.
//
// parameters:
// callFrameID - Call frame identifier to evaluate on.
func RestartFrame(callFrameID CallFrameID) *RestartFrameParams {
return &RestartFrameParams{
CallFrameID: callFrameID,
}
}
// RestartFrameReturns return values.
type RestartFrameReturns struct {
CallFrames []*CallFrame `json:"callFrames,omitempty"` // New stack trace.
AsyncStackTrace *runtime.StackTrace `json:"asyncStackTrace,omitempty"` // Async stack trace, if any.
AsyncStackTraceID *runtime.StackTraceID `json:"asyncStackTraceId,omitempty"` // Async stack trace, if any.
}
// Do executes Debugger.restartFrame against the provided context and
// target handler.
//
// returns:
// callFrames - New stack trace.
// asyncStackTrace - Async stack trace, if any.
// asyncStackTraceID - Async stack trace, if any.
func (p *RestartFrameParams) Do(ctxt context.Context, h cdp.Handler) (callFrames []*CallFrame, asyncStackTrace *runtime.StackTrace, asyncStackTraceID *runtime.StackTraceID, err error) {
// execute
var res RestartFrameReturns
err = h.Execute(ctxt, cdp.CommandDebuggerRestartFrame, p, &res)
if err != nil {
return nil, nil, nil, err
}
return res.CallFrames, res.AsyncStackTrace, res.AsyncStackTraceID, nil
}
// ResumeParams resumes JavaScript execution.
type ResumeParams struct{}
// Resume resumes JavaScript execution.
func Resume() *ResumeParams {
return &ResumeParams{}
}
// Do executes Debugger.resume against the provided context and
// target handler.
func (p *ResumeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerResume, nil, nil)
}
// ScheduleStepIntoAsyncParams this method is deprecated - use
// Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask
// instead. Steps into next scheduled async task if any is scheduled before next
// pause. Returns success when async task is actually scheduled, returns error
// if no task were scheduled or another scheduleStepIntoAsync was called.
type ScheduleStepIntoAsyncParams struct{}
// ScheduleStepIntoAsync this method is deprecated - use Debugger.stepInto
// with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next
// scheduled async task if any is scheduled before next pause. Returns success
// when async task is actually scheduled, returns error if no task were
// scheduled or another scheduleStepIntoAsync was called.
func ScheduleStepIntoAsync() *ScheduleStepIntoAsyncParams {
return &ScheduleStepIntoAsyncParams{}
}
// Do executes Debugger.scheduleStepIntoAsync against the provided context and
// target handler.
func (p *ScheduleStepIntoAsyncParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerScheduleStepIntoAsync, nil, nil)
}
// SearchInContentParams searches for given string in script content.
type SearchInContentParams struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Id of the script to search in.
Query string `json:"query"` // String to search for.
CaseSensitive bool `json:"caseSensitive,omitempty"` // If true, search is case sensitive.
IsRegex bool `json:"isRegex,omitempty"` // If true, treats string parameter as regex.
}
// SearchInContent searches for given string in script content.
//
// parameters:
// scriptID - Id of the script to search in.
// query - String to search for.
func SearchInContent(scriptID runtime.ScriptID, query string) *SearchInContentParams {
return &SearchInContentParams{
ScriptID: scriptID,
Query: query,
}
}
// WithCaseSensitive if true, search is case sensitive.
func (p SearchInContentParams) WithCaseSensitive(caseSensitive bool) *SearchInContentParams {
p.CaseSensitive = caseSensitive
return &p
}
// WithIsRegex if true, treats string parameter as regex.
func (p SearchInContentParams) WithIsRegex(isRegex bool) *SearchInContentParams {
p.IsRegex = isRegex
return &p
}
// SearchInContentReturns return values.
type SearchInContentReturns struct {
Result []*SearchMatch `json:"result,omitempty"` // List of search matches.
}
// Do executes Debugger.searchInContent against the provided context and
// target handler.
//
// returns:
// result - List of search matches.
func (p *SearchInContentParams) Do(ctxt context.Context, h cdp.Handler) (result []*SearchMatch, err error) {
// execute
var res SearchInContentReturns
err = h.Execute(ctxt, cdp.CommandDebuggerSearchInContent, p, &res)
if err != nil {
return nil, err
}
return res.Result, nil
}
// SetAsyncCallStackDepthParams enables or disables async call stacks
// tracking.
type SetAsyncCallStackDepthParams struct {
MaxDepth int64 `json:"maxDepth"` // Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default).
}
// SetAsyncCallStackDepth enables or disables async call stacks tracking.
//
// parameters:
// maxDepth - Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default).
func SetAsyncCallStackDepth(maxDepth int64) *SetAsyncCallStackDepthParams {
return &SetAsyncCallStackDepthParams{
MaxDepth: maxDepth,
}
}
// Do executes Debugger.setAsyncCallStackDepth against the provided context and
// target handler.
func (p *SetAsyncCallStackDepthParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerSetAsyncCallStackDepth, p, nil)
}
// SetBlackboxPatternsParams replace previous blackbox patterns with passed
// ones. Forces backend to skip stepping/pausing in scripts with url matching
// one of the patterns. VM will try to leave blackboxed script by performing
// 'step in' several times, finally resorting to 'step out' if unsuccessful.
type SetBlackboxPatternsParams struct {
Patterns []string `json:"patterns"` // Array of regexps that will be used to check script url for blackbox state.
}
// SetBlackboxPatterns replace previous blackbox patterns with passed ones.
// Forces backend to skip stepping/pausing in scripts with url matching one of
// the patterns. VM will try to leave blackboxed script by performing 'step in'
// several times, finally resorting to 'step out' if unsuccessful.
//
// parameters:
// patterns - Array of regexps that will be used to check script url for blackbox state.
func SetBlackboxPatterns(patterns []string) *SetBlackboxPatternsParams {
return &SetBlackboxPatternsParams{
Patterns: patterns,
}
}
// Do executes Debugger.setBlackboxPatterns against the provided context and
// target handler.
func (p *SetBlackboxPatternsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerSetBlackboxPatterns, p, nil)
}
// SetBlackboxedRangesParams makes backend skip steps in the script in
// blackboxed ranges. VM will try leave blacklisted scripts by performing 'step
// in' several times, finally resorting to 'step out' if unsuccessful. Positions
// array contains positions where blackbox state is changed. First interval
// isn't blackboxed. Array should be sorted.
type SetBlackboxedRangesParams struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Id of the script.
Positions []*ScriptPosition `json:"positions"`
}
// SetBlackboxedRanges makes backend skip steps in the script in blackboxed
// ranges. VM will try leave blacklisted scripts by performing 'step in' several
// times, finally resorting to 'step out' if unsuccessful. Positions array
// contains positions where blackbox state is changed. First interval isn't
// blackboxed. Array should be sorted.
//
// parameters:
// scriptID - Id of the script.
// positions
func SetBlackboxedRanges(scriptID runtime.ScriptID, positions []*ScriptPosition) *SetBlackboxedRangesParams {
return &SetBlackboxedRangesParams{
ScriptID: scriptID,
Positions: positions,
}
}
// Do executes Debugger.setBlackboxedRanges against the provided context and
// target handler.
func (p *SetBlackboxedRangesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerSetBlackboxedRanges, p, nil)
}
// SetBreakpointParams sets JavaScript breakpoint at a given location.
type SetBreakpointParams struct {
Location *Location `json:"location"` // Location to set breakpoint in.
Condition string `json:"condition,omitempty"` // Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
}
// SetBreakpoint sets JavaScript breakpoint at a given location.
//
// parameters:
// location - Location to set breakpoint in.
func SetBreakpoint(location *Location) *SetBreakpointParams {
return &SetBreakpointParams{
Location: location,
}
}
// WithCondition expression to use as a breakpoint condition. When specified,
// debugger will only stop on the breakpoint if this expression evaluates to
// true.
func (p SetBreakpointParams) WithCondition(condition string) *SetBreakpointParams {
p.Condition = condition
return &p
}
// SetBreakpointReturns return values.
type SetBreakpointReturns struct {
BreakpointID BreakpointID `json:"breakpointId,omitempty"` // Id of the created breakpoint for further reference.
ActualLocation *Location `json:"actualLocation,omitempty"` // Location this breakpoint resolved into.
}
// Do executes Debugger.setBreakpoint against the provided context and
// target handler.
//
// returns:
// breakpointID - Id of the created breakpoint for further reference.
// actualLocation - Location this breakpoint resolved into.
func (p *SetBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (breakpointID BreakpointID, actualLocation *Location, err error) {
// execute
var res SetBreakpointReturns
err = h.Execute(ctxt, cdp.CommandDebuggerSetBreakpoint, p, &res)
if err != nil {
return "", nil, err
}
return res.BreakpointID, res.ActualLocation, nil
}
// SetBreakpointByURLParams sets JavaScript breakpoint at given location
// specified either by URL or URL regex. Once this command is issued, all
// existing parsed scripts will have breakpoints resolved and returned in
// locations property. Further matching script parsing will result in subsequent
// breakpointResolved events issued. This logical breakpoint will survive page
// reloads.
type SetBreakpointByURLParams struct {
LineNumber int64 `json:"lineNumber"` // Line number to set breakpoint at.
URL string `json:"url,omitempty"` // URL of the resources to set breakpoint on.
URLRegex string `json:"urlRegex,omitempty"` // Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified.
ScriptHash string `json:"scriptHash,omitempty"` // Script hash of the resources to set breakpoint on.
ColumnNumber int64 `json:"columnNumber,omitempty"` // Offset in the line to set breakpoint at.
Condition string `json:"condition,omitempty"` // Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
}
// SetBreakpointByURL sets JavaScript breakpoint at given location specified
// either by URL or URL regex. Once this command is issued, all existing parsed
// scripts will have breakpoints resolved and returned in locations property.
// Further matching script parsing will result in subsequent breakpointResolved
// events issued. This logical breakpoint will survive page reloads.
//
// parameters:
// lineNumber - Line number to set breakpoint at.
func SetBreakpointByURL(lineNumber int64) *SetBreakpointByURLParams {
return &SetBreakpointByURLParams{
LineNumber: lineNumber,
}
}
// WithURL URL of the resources to set breakpoint on.
func (p SetBreakpointByURLParams) WithURL(url string) *SetBreakpointByURLParams {
p.URL = url
return &p
}
// WithURLRegex regex pattern for the URLs of the resources to set
// breakpoints on. Either url or urlRegex must be specified.
func (p SetBreakpointByURLParams) WithURLRegex(urlRegex string) *SetBreakpointByURLParams {
p.URLRegex = urlRegex
return &p
}
// WithScriptHash script hash of the resources to set breakpoint on.
func (p SetBreakpointByURLParams) WithScriptHash(scriptHash string) *SetBreakpointByURLParams {
p.ScriptHash = scriptHash
return &p
}
// WithColumnNumber offset in the line to set breakpoint at.
func (p SetBreakpointByURLParams) WithColumnNumber(columnNumber int64) *SetBreakpointByURLParams {
p.ColumnNumber = columnNumber
return &p
}
// WithCondition expression to use as a breakpoint condition. When specified,
// debugger will only stop on the breakpoint if this expression evaluates to
// true.
func (p SetBreakpointByURLParams) WithCondition(condition string) *SetBreakpointByURLParams {
p.Condition = condition
return &p
}
// SetBreakpointByURLReturns return values.
type SetBreakpointByURLReturns struct {
BreakpointID BreakpointID `json:"breakpointId,omitempty"` // Id of the created breakpoint for further reference.
Locations []*Location `json:"locations,omitempty"` // List of the locations this breakpoint resolved into upon addition.
}
// Do executes Debugger.setBreakpointByUrl against the provided context and
// target handler.
//
// returns:
// breakpointID - Id of the created breakpoint for further reference.
// locations - List of the locations this breakpoint resolved into upon addition.
func (p *SetBreakpointByURLParams) Do(ctxt context.Context, h cdp.Handler) (breakpointID BreakpointID, locations []*Location, err error) {
// execute
var res SetBreakpointByURLReturns
err = h.Execute(ctxt, cdp.CommandDebuggerSetBreakpointByURL, p, &res)
if err != nil {
return "", nil, err
}
return res.BreakpointID, res.Locations, nil
}
// SetBreakpointsActiveParams activates / deactivates all breakpoints on the
// page.
type SetBreakpointsActiveParams struct {
Active bool `json:"active"` // New value for breakpoints active state.
}
// SetBreakpointsActive activates / deactivates all breakpoints on the page.
//
// parameters:
// active - New value for breakpoints active state.
func SetBreakpointsActive(active bool) *SetBreakpointsActiveParams {
return &SetBreakpointsActiveParams{
Active: active,
}
}
// Do executes Debugger.setBreakpointsActive against the provided context and
// target handler.
func (p *SetBreakpointsActiveParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerSetBreakpointsActive, p, nil)
}
// SetPauseOnExceptionsParams defines pause on exceptions state. Can be set
// to stop on all exceptions, uncaught exceptions or no exceptions. Initial
// pause on exceptions state is none.
type SetPauseOnExceptionsParams struct {
State ExceptionsState `json:"state"` // Pause on exceptions mode.
}
// SetPauseOnExceptions defines pause on exceptions state. Can be set to stop
// on all exceptions, uncaught exceptions or no exceptions. Initial pause on
// exceptions state is none.
//
// parameters:
// state - Pause on exceptions mode.
func SetPauseOnExceptions(state ExceptionsState) *SetPauseOnExceptionsParams {
return &SetPauseOnExceptionsParams{
State: state,
}
}
// Do executes Debugger.setPauseOnExceptions against the provided context and
// target handler.
func (p *SetPauseOnExceptionsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerSetPauseOnExceptions, p, nil)
}
// SetReturnValueParams changes return value in top frame. Available only at
// return break position.
type SetReturnValueParams struct {
NewValue *runtime.CallArgument `json:"newValue"` // New return value.
}
// SetReturnValue changes return value in top frame. Available only at return
// break position.
//
// parameters:
// newValue - New return value.
func SetReturnValue(newValue *runtime.CallArgument) *SetReturnValueParams {
return &SetReturnValueParams{
NewValue: newValue,
}
}
// Do executes Debugger.setReturnValue against the provided context and
// target handler.
func (p *SetReturnValueParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerSetReturnValue, p, nil)
}
// SetScriptSourceParams edits JavaScript source live.
type SetScriptSourceParams struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Id of the script to edit.
ScriptSource string `json:"scriptSource"` // New content of the script.
DryRun bool `json:"dryRun,omitempty"` // If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.
}
// SetScriptSource edits JavaScript source live.
//
// parameters:
// scriptID - Id of the script to edit.
// scriptSource - New content of the script.
func SetScriptSource(scriptID runtime.ScriptID, scriptSource string) *SetScriptSourceParams {
return &SetScriptSourceParams{
ScriptID: scriptID,
ScriptSource: scriptSource,
}
}
// WithDryRun if true the change will not actually be applied. Dry run may be
// used to get result description without actually modifying the code.
func (p SetScriptSourceParams) WithDryRun(dryRun bool) *SetScriptSourceParams {
p.DryRun = dryRun
return &p
}
// SetScriptSourceReturns return values.
type SetScriptSourceReturns struct {
CallFrames []*CallFrame `json:"callFrames,omitempty"` // New stack trace in case editing has happened while VM was stopped.
StackChanged bool `json:"stackChanged,omitempty"` // Whether current call stack was modified after applying the changes.
AsyncStackTrace *runtime.StackTrace `json:"asyncStackTrace,omitempty"` // Async stack trace, if any.
AsyncStackTraceID *runtime.StackTraceID `json:"asyncStackTraceId,omitempty"` // Async stack trace, if any.
ExceptionDetails *runtime.ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details if any.
}
// Do executes Debugger.setScriptSource against the provided context and
// target handler.
//
// returns:
// callFrames - New stack trace in case editing has happened while VM was stopped.
// stackChanged - Whether current call stack was modified after applying the changes.
// asyncStackTrace - Async stack trace, if any.
// asyncStackTraceID - Async stack trace, if any.
// exceptionDetails - Exception details if any.
func (p *SetScriptSourceParams) Do(ctxt context.Context, h cdp.Handler) (callFrames []*CallFrame, stackChanged bool, asyncStackTrace *runtime.StackTrace, asyncStackTraceID *runtime.StackTraceID, exceptionDetails *runtime.ExceptionDetails, err error) {
// execute
var res SetScriptSourceReturns
err = h.Execute(ctxt, cdp.CommandDebuggerSetScriptSource, p, &res)
if err != nil {
return nil, false, nil, nil, nil, err
}
return res.CallFrames, res.StackChanged, res.AsyncStackTrace, res.AsyncStackTraceID, res.ExceptionDetails, nil
}
// SetSkipAllPausesParams makes page not interrupt on any pauses (breakpoint,
// exception, dom exception etc).
type SetSkipAllPausesParams struct {
Skip bool `json:"skip"` // New value for skip pauses state.
}
// SetSkipAllPauses makes page not interrupt on any pauses (breakpoint,
// exception, dom exception etc).
//
// parameters:
// skip - New value for skip pauses state.
func SetSkipAllPauses(skip bool) *SetSkipAllPausesParams {
return &SetSkipAllPausesParams{
Skip: skip,
}
}
// Do executes Debugger.setSkipAllPauses against the provided context and
// target handler.
func (p *SetSkipAllPausesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerSetSkipAllPauses, p, nil)
}
// SetVariableValueParams changes value of variable in a callframe.
// Object-based scopes are not supported and must be mutated manually.
type SetVariableValueParams struct {
ScopeNumber int64 `json:"scopeNumber"` // 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.
VariableName string `json:"variableName"` // Variable name.
NewValue *runtime.CallArgument `json:"newValue"` // New variable value.
CallFrameID CallFrameID `json:"callFrameId"` // Id of callframe that holds variable.
}
// SetVariableValue changes value of variable in a callframe. Object-based
// scopes are not supported and must be mutated manually.
//
// parameters:
// scopeNumber - 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.
// variableName - Variable name.
// newValue - New variable value.
// callFrameID - Id of callframe that holds variable.
func SetVariableValue(scopeNumber int64, variableName string, newValue *runtime.CallArgument, callFrameID CallFrameID) *SetVariableValueParams {
return &SetVariableValueParams{
ScopeNumber: scopeNumber,
VariableName: variableName,
NewValue: newValue,
CallFrameID: callFrameID,
}
}
// Do executes Debugger.setVariableValue against the provided context and
// target handler.
func (p *SetVariableValueParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerSetVariableValue, p, nil)
}
// StepIntoParams steps into the function call.
type StepIntoParams struct {
BreakOnAsyncCall bool `json:"breakOnAsyncCall,omitempty"` // Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause.
}
// StepInto steps into the function call.
//
// parameters:
func StepInto() *StepIntoParams {
return &StepIntoParams{}
}
// WithBreakOnAsyncCall debugger will issue additional Debugger.paused
// notification if any async task is scheduled before next pause.
func (p StepIntoParams) WithBreakOnAsyncCall(breakOnAsyncCall bool) *StepIntoParams {
p.BreakOnAsyncCall = breakOnAsyncCall
return &p
}
// Do executes Debugger.stepInto against the provided context and
// target handler.
func (p *StepIntoParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerStepInto, p, nil)
}
// StepOutParams steps out of the function call.
type StepOutParams struct{}
// StepOut steps out of the function call.
func StepOut() *StepOutParams {
return &StepOutParams{}
}
// Do executes Debugger.stepOut against the provided context and
// target handler.
func (p *StepOutParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerStepOut, nil, nil)
}
// StepOverParams steps over the statement.
type StepOverParams struct{}
// StepOver steps over the statement.
func StepOver() *StepOverParams {
return &StepOverParams{}
}
// Do executes Debugger.stepOver against the provided context and
// target handler.
func (p *StepOverParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDebuggerStepOver, nil, nil)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,79 +0,0 @@
package debugger
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
)
// EventBreakpointResolved fired when breakpoint is resolved to an actual
// script and location.
type EventBreakpointResolved struct {
BreakpointID BreakpointID `json:"breakpointId"` // Breakpoint unique identifier.
Location *Location `json:"location"` // Actual breakpoint location.
}
// EventPaused fired when the virtual machine stopped on breakpoint or
// exception or any other stop criteria.
type EventPaused struct {
CallFrames []*CallFrame `json:"callFrames"` // Call stack the virtual machine stopped on.
Reason PausedReason `json:"reason"` // Pause reason.
Data easyjson.RawMessage `json:"data,omitempty"`
HitBreakpoints []string `json:"hitBreakpoints,omitempty"` // Hit breakpoints IDs
AsyncStackTrace *runtime.StackTrace `json:"asyncStackTrace,omitempty"` // Async stack trace, if any.
AsyncStackTraceID *runtime.StackTraceID `json:"asyncStackTraceId,omitempty"` // Async stack trace, if any.
AsyncCallStackTraceID *runtime.StackTraceID `json:"asyncCallStackTraceId,omitempty"` // Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag.
}
// EventResumed fired when the virtual machine resumed execution.
type EventResumed struct{}
// EventScriptFailedToParse fired when virtual machine fails to parse the
// script.
type EventScriptFailedToParse struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Identifier of the script parsed.
URL string `json:"url"` // URL or name of the script parsed (if any).
StartLine int64 `json:"startLine"` // Line offset of the script within the resource with given URL (for script tags).
StartColumn int64 `json:"startColumn"` // Column offset of the script within the resource with given URL.
EndLine int64 `json:"endLine"` // Last line of the script.
EndColumn int64 `json:"endColumn"` // Length of the last line of the script.
ExecutionContextID runtime.ExecutionContextID `json:"executionContextId"` // Specifies script creation context.
Hash string `json:"hash"` // Content hash of the script.
ExecutionContextAuxData easyjson.RawMessage `json:"executionContextAuxData,omitempty"`
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with script (if any).
HasSourceURL bool `json:"hasSourceURL,omitempty"` // True, if this script has sourceURL.
IsModule bool `json:"isModule,omitempty"` // True, if this script is ES6 module.
Length int64 `json:"length,omitempty"` // This script length.
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript top stack frame of where the script parsed event was triggered if available.
}
// EventScriptParsed fired when virtual machine parses script. This event is
// also fired for all known and uncollected scripts upon enabling debugger.
type EventScriptParsed struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Identifier of the script parsed.
URL string `json:"url"` // URL or name of the script parsed (if any).
StartLine int64 `json:"startLine"` // Line offset of the script within the resource with given URL (for script tags).
StartColumn int64 `json:"startColumn"` // Column offset of the script within the resource with given URL.
EndLine int64 `json:"endLine"` // Last line of the script.
EndColumn int64 `json:"endColumn"` // Length of the last line of the script.
ExecutionContextID runtime.ExecutionContextID `json:"executionContextId"` // Specifies script creation context.
Hash string `json:"hash"` // Content hash of the script.
ExecutionContextAuxData easyjson.RawMessage `json:"executionContextAuxData,omitempty"`
IsLiveEdit bool `json:"isLiveEdit,omitempty"` // True, if this script is generated as a result of the live edit operation.
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with script (if any).
HasSourceURL bool `json:"hasSourceURL,omitempty"` // True, if this script has sourceURL.
IsModule bool `json:"isModule,omitempty"` // True, if this script is ES6 module.
Length int64 `json:"length,omitempty"` // This script length.
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript top stack frame of where the script parsed event was triggered if available.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventDebuggerBreakpointResolved,
cdp.EventDebuggerPaused,
cdp.EventDebuggerResumed,
cdp.EventDebuggerScriptFailedToParse,
cdp.EventDebuggerScriptParsed,
}

View File

@ -1,337 +0,0 @@
package debugger
import (
"errors"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// BreakpointID breakpoint identifier.
type BreakpointID string
// String returns the BreakpointID as string value.
func (t BreakpointID) String() string {
return string(t)
}
// CallFrameID call frame identifier.
type CallFrameID string
// String returns the CallFrameID as string value.
func (t CallFrameID) String() string {
return string(t)
}
// Location location in the source code.
type Location struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Script identifier as reported in the Debugger.scriptParsed.
LineNumber int64 `json:"lineNumber"` // Line number in the script (0-based).
ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based).
}
// ScriptPosition location in the source code.
type ScriptPosition struct {
LineNumber int64 `json:"lineNumber"`
ColumnNumber int64 `json:"columnNumber"`
}
// CallFrame JavaScript call frame. Array of call frames form the call stack.
type CallFrame struct {
CallFrameID CallFrameID `json:"callFrameId"` // Call frame identifier. This identifier is only valid while the virtual machine is paused.
FunctionName string `json:"functionName"` // Name of the JavaScript function called on this call frame.
FunctionLocation *Location `json:"functionLocation,omitempty"` // Location in the source code.
Location *Location `json:"location"` // Location in the source code.
URL string `json:"url"` // JavaScript script name or url.
ScopeChain []*Scope `json:"scopeChain"` // Scope chain for this call frame.
This *runtime.RemoteObject `json:"this"` // this object for this call frame.
ReturnValue *runtime.RemoteObject `json:"returnValue,omitempty"` // The value being returned, if the function is at return point.
}
// Scope scope description.
type Scope struct {
Type ScopeType `json:"type"` // Scope type.
Object *runtime.RemoteObject `json:"object"` // Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties.
Name string `json:"name,omitempty"`
StartLocation *Location `json:"startLocation,omitempty"` // Location in the source code where scope starts
EndLocation *Location `json:"endLocation,omitempty"` // Location in the source code where scope ends
}
// SearchMatch search match for resource.
type SearchMatch struct {
LineNumber float64 `json:"lineNumber"` // Line number in resource content.
LineContent string `json:"lineContent"` // Line with match content.
}
// BreakLocation [no description].
type BreakLocation struct {
ScriptID runtime.ScriptID `json:"scriptId"` // Script identifier as reported in the Debugger.scriptParsed.
LineNumber int64 `json:"lineNumber"` // Line number in the script (0-based).
ColumnNumber int64 `json:"columnNumber,omitempty"` // Column number in the script (0-based).
Type BreakLocationType `json:"type,omitempty"`
}
// ScopeType scope type.
type ScopeType string
// String returns the ScopeType as string value.
func (t ScopeType) String() string {
return string(t)
}
// ScopeType values.
const (
ScopeTypeGlobal ScopeType = "global"
ScopeTypeLocal ScopeType = "local"
ScopeTypeWith ScopeType = "with"
ScopeTypeClosure ScopeType = "closure"
ScopeTypeCatch ScopeType = "catch"
ScopeTypeBlock ScopeType = "block"
ScopeTypeScript ScopeType = "script"
ScopeTypeEval ScopeType = "eval"
ScopeTypeModule ScopeType = "module"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ScopeType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ScopeType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ScopeType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ScopeType(in.String()) {
case ScopeTypeGlobal:
*t = ScopeTypeGlobal
case ScopeTypeLocal:
*t = ScopeTypeLocal
case ScopeTypeWith:
*t = ScopeTypeWith
case ScopeTypeClosure:
*t = ScopeTypeClosure
case ScopeTypeCatch:
*t = ScopeTypeCatch
case ScopeTypeBlock:
*t = ScopeTypeBlock
case ScopeTypeScript:
*t = ScopeTypeScript
case ScopeTypeEval:
*t = ScopeTypeEval
case ScopeTypeModule:
*t = ScopeTypeModule
default:
in.AddError(errors.New("unknown ScopeType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ScopeType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// BreakLocationType [no description].
type BreakLocationType string
// String returns the BreakLocationType as string value.
func (t BreakLocationType) String() string {
return string(t)
}
// BreakLocationType values.
const (
BreakLocationTypeDebuggerStatement BreakLocationType = "debuggerStatement"
BreakLocationTypeCall BreakLocationType = "call"
BreakLocationTypeReturn BreakLocationType = "return"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t BreakLocationType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t BreakLocationType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *BreakLocationType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch BreakLocationType(in.String()) {
case BreakLocationTypeDebuggerStatement:
*t = BreakLocationTypeDebuggerStatement
case BreakLocationTypeCall:
*t = BreakLocationTypeCall
case BreakLocationTypeReturn:
*t = BreakLocationTypeReturn
default:
in.AddError(errors.New("unknown BreakLocationType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *BreakLocationType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// PausedReason pause reason.
type PausedReason string
// String returns the PausedReason as string value.
func (t PausedReason) String() string {
return string(t)
}
// PausedReason values.
const (
PausedReasonXHR PausedReason = "XHR"
PausedReasonDOM PausedReason = "DOM"
PausedReasonEventListener PausedReason = "EventListener"
PausedReasonException PausedReason = "exception"
PausedReasonAssert PausedReason = "assert"
PausedReasonDebugCommand PausedReason = "debugCommand"
PausedReasonPromiseRejection PausedReason = "promiseRejection"
PausedReasonOOM PausedReason = "OOM"
PausedReasonOther PausedReason = "other"
PausedReasonAmbiguous PausedReason = "ambiguous"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t PausedReason) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t PausedReason) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *PausedReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch PausedReason(in.String()) {
case PausedReasonXHR:
*t = PausedReasonXHR
case PausedReasonDOM:
*t = PausedReasonDOM
case PausedReasonEventListener:
*t = PausedReasonEventListener
case PausedReasonException:
*t = PausedReasonException
case PausedReasonAssert:
*t = PausedReasonAssert
case PausedReasonDebugCommand:
*t = PausedReasonDebugCommand
case PausedReasonPromiseRejection:
*t = PausedReasonPromiseRejection
case PausedReasonOOM:
*t = PausedReasonOOM
case PausedReasonOther:
*t = PausedReasonOther
case PausedReasonAmbiguous:
*t = PausedReasonAmbiguous
default:
in.AddError(errors.New("unknown PausedReason value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *PausedReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ContinueToLocationTargetCallFrames [no description].
type ContinueToLocationTargetCallFrames string
// String returns the ContinueToLocationTargetCallFrames as string value.
func (t ContinueToLocationTargetCallFrames) String() string {
return string(t)
}
// ContinueToLocationTargetCallFrames values.
const (
ContinueToLocationTargetCallFramesAny ContinueToLocationTargetCallFrames = "any"
ContinueToLocationTargetCallFramesCurrent ContinueToLocationTargetCallFrames = "current"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ContinueToLocationTargetCallFrames) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ContinueToLocationTargetCallFrames) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ContinueToLocationTargetCallFrames) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ContinueToLocationTargetCallFrames(in.String()) {
case ContinueToLocationTargetCallFramesAny:
*t = ContinueToLocationTargetCallFramesAny
case ContinueToLocationTargetCallFramesCurrent:
*t = ContinueToLocationTargetCallFramesCurrent
default:
in.AddError(errors.New("unknown ContinueToLocationTargetCallFrames value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ContinueToLocationTargetCallFrames) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ExceptionsState pause on exceptions mode.
type ExceptionsState string
// String returns the ExceptionsState as string value.
func (t ExceptionsState) String() string {
return string(t)
}
// ExceptionsState values.
const (
ExceptionsStateNone ExceptionsState = "none"
ExceptionsStateUncaught ExceptionsState = "uncaught"
ExceptionsStateAll ExceptionsState = "all"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ExceptionsState) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ExceptionsState) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ExceptionsState) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ExceptionsState(in.String()) {
case ExceptionsStateNone:
*t = ExceptionsStateNone
case ExceptionsStateUncaught:
*t = ExceptionsStateUncaught
case ExceptionsStateAll:
*t = ExceptionsStateAll
default:
in.AddError(errors.New("unknown ExceptionsState value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ExceptionsState) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -1,55 +0,0 @@
// Package deviceorientation provides the Chrome Debugging Protocol
// commands, types, and events for the DeviceOrientation domain.
//
// Generated by the chromedp-gen command.
package deviceorientation
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// ClearDeviceOrientationOverrideParams clears the overridden Device
// Orientation.
type ClearDeviceOrientationOverrideParams struct{}
// ClearDeviceOrientationOverride clears the overridden Device Orientation.
func ClearDeviceOrientationOverride() *ClearDeviceOrientationOverrideParams {
return &ClearDeviceOrientationOverrideParams{}
}
// Do executes DeviceOrientation.clearDeviceOrientationOverride against the provided context and
// target handler.
func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDeviceOrientationClearDeviceOrientationOverride, nil, nil)
}
// SetDeviceOrientationOverrideParams overrides the Device Orientation.
type SetDeviceOrientationOverrideParams struct {
Alpha float64 `json:"alpha"` // Mock alpha
Beta float64 `json:"beta"` // Mock beta
Gamma float64 `json:"gamma"` // Mock gamma
}
// SetDeviceOrientationOverride overrides the Device Orientation.
//
// parameters:
// alpha - Mock alpha
// beta - Mock beta
// gamma - Mock gamma
func SetDeviceOrientationOverride(alpha float64, beta float64, gamma float64) *SetDeviceOrientationOverrideParams {
return &SetDeviceOrientationOverrideParams{
Alpha: alpha,
Beta: beta,
Gamma: gamma,
}
}
// Do executes DeviceOrientation.setDeviceOrientationOverride against the provided context and
// target handler.
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDeviceOrientationSetDeviceOrientationOverride, p, nil)
}

View File

@ -1,173 +0,0 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package deviceorientation
import (
json "encoding/json"
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 easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(in *jlexer.Lexer, out *SetDeviceOrientationOverrideParams) {
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 "alpha":
out.Alpha = float64(in.Float64())
case "beta":
out.Beta = float64(in.Float64())
case "gamma":
out.Gamma = float64(in.Float64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(out *jwriter.Writer, in SetDeviceOrientationOverrideParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"alpha\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Float64(float64(in.Alpha))
}
{
const prefix string = ",\"beta\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Float64(float64(in.Beta))
}
{
const prefix string = ",\"gamma\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Float64(float64(in.Gamma))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetDeviceOrientationOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(in *jlexer.Lexer, out *ClearDeviceOrientationOverrideParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(out *jwriter.Writer, in ClearDeviceOrientationOverrideParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ClearDeviceOrientationOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearDeviceOrientationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDeviceorientation1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearDeviceOrientationOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearDeviceOrientationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDeviceorientation1(l, v)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,114 +0,0 @@
package dom
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventAttributeModified fired when Element's attribute is modified.
type EventAttributeModified struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
Name string `json:"name"` // Attribute name.
Value string `json:"value"` // Attribute value.
}
// EventAttributeRemoved fired when Element's attribute is removed.
type EventAttributeRemoved struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
Name string `json:"name"` // A ttribute name.
}
// EventCharacterDataModified mirrors DOMCharacterDataModified event.
type EventCharacterDataModified struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
CharacterData string `json:"characterData"` // New text value.
}
// EventChildNodeCountUpdated fired when Container's child node count has
// changed.
type EventChildNodeCountUpdated struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
ChildNodeCount int64 `json:"childNodeCount"` // New node count.
}
// EventChildNodeInserted mirrors DOMNodeInserted event.
type EventChildNodeInserted struct {
ParentNodeID cdp.NodeID `json:"parentNodeId"` // Id of the node that has changed.
PreviousNodeID cdp.NodeID `json:"previousNodeId"` // If of the previous siblint.
Node *cdp.Node `json:"node"` // Inserted node data.
}
// EventChildNodeRemoved mirrors DOMNodeRemoved event.
type EventChildNodeRemoved struct {
ParentNodeID cdp.NodeID `json:"parentNodeId"` // Parent id.
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has been removed.
}
// EventDistributedNodesUpdated called when distribution is changed.
type EventDistributedNodesUpdated struct {
InsertionPointID cdp.NodeID `json:"insertionPointId"` // Insertion point where distributed nodes were updated.
DistributedNodes []*cdp.BackendNode `json:"distributedNodes"` // Distributed nodes for given insertion point.
}
// EventDocumentUpdated fired when Document has been totally updated. Node
// ids are no longer valid.
type EventDocumentUpdated struct{}
// EventInlineStyleInvalidated fired when Element's inline style is modified
// via a CSS property modification.
type EventInlineStyleInvalidated struct {
NodeIds []cdp.NodeID `json:"nodeIds"` // Ids of the nodes for which the inline styles have been invalidated.
}
// EventPseudoElementAdded called when a pseudo element is added to an
// element.
type EventPseudoElementAdded struct {
ParentID cdp.NodeID `json:"parentId"` // Pseudo element's parent element id.
PseudoElement *cdp.Node `json:"pseudoElement"` // The added pseudo element.
}
// EventPseudoElementRemoved called when a pseudo element is removed from an
// element.
type EventPseudoElementRemoved struct {
ParentID cdp.NodeID `json:"parentId"` // Pseudo element's parent element id.
PseudoElementID cdp.NodeID `json:"pseudoElementId"` // The removed pseudo element id.
}
// EventSetChildNodes fired when backend wants to provide client with the
// missing DOM structure. This happens upon most of the calls requesting node
// ids.
type EventSetChildNodes struct {
ParentID cdp.NodeID `json:"parentId"` // Parent node id to populate with children.
Nodes []*cdp.Node `json:"nodes"` // Child nodes array.
}
// EventShadowRootPopped called when shadow root is popped from the element.
type EventShadowRootPopped struct {
HostID cdp.NodeID `json:"hostId"` // Host element id.
RootID cdp.NodeID `json:"rootId"` // Shadow root id.
}
// EventShadowRootPushed called when shadow root is pushed into the element.
type EventShadowRootPushed struct {
HostID cdp.NodeID `json:"hostId"` // Host element id.
Root *cdp.Node `json:"root"` // Shadow root.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventDOMAttributeModified,
cdp.EventDOMAttributeRemoved,
cdp.EventDOMCharacterDataModified,
cdp.EventDOMChildNodeCountUpdated,
cdp.EventDOMChildNodeInserted,
cdp.EventDOMChildNodeRemoved,
cdp.EventDOMDistributedNodesUpdated,
cdp.EventDOMDocumentUpdated,
cdp.EventDOMInlineStyleInvalidated,
cdp.EventDOMPseudoElementAdded,
cdp.EventDOMPseudoElementRemoved,
cdp.EventDOMSetChildNodes,
cdp.EventDOMShadowRootPopped,
cdp.EventDOMShadowRootPushed,
}

View File

@ -1,35 +0,0 @@
package dom
import "github.com/mailru/easyjson"
// Code generated by chromedp-gen. DO NOT EDIT.
// Quad an array of quad vertices, x immediately followed by y for each
// point, points clock-wise.
type Quad []float64
// BoxModel box model.
type BoxModel struct {
Content Quad `json:"content"` // Content box
Padding Quad `json:"padding"` // Padding box
Border Quad `json:"border"` // Border box
Margin Quad `json:"margin"` // Margin box
Width int64 `json:"width"` // Node width
Height int64 `json:"height"` // Node height
ShapeOutside *ShapeOutsideInfo `json:"shapeOutside,omitempty"` // Shape outside coordinates
}
// ShapeOutsideInfo CSS Shape Outside details.
type ShapeOutsideInfo struct {
Bounds Quad `json:"bounds"` // Shape bounds
Shape []easyjson.RawMessage `json:"shape"` // Shape coordinate details
MarginShape []easyjson.RawMessage `json:"marginShape"` // Margin shape bounds
}
// Rect Rectangle.
type Rect struct {
X float64 `json:"x"` // X coordinate
Y float64 `json:"y"` // Y coordinate
Width float64 `json:"width"` // Rectangle width
Height float64 `json:"height"` // Rectangle height
}

View File

@ -1,267 +0,0 @@
// Package domdebugger provides the Chrome Debugging Protocol
// commands, types, and events for the DOMDebugger domain.
//
// DOM debugging allows setting breakpoints on particular DOM operations and
// events. JavaScript execution will stop on these operations as if there was a
// regular breakpoint set.
//
// Generated by the chromedp-gen command.
package domdebugger
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
)
// GetEventListenersParams returns event listeners of the given object.
type GetEventListenersParams struct {
ObjectID runtime.RemoteObjectID `json:"objectId"` // Identifier of the object to return listeners for.
Depth int64 `json:"depth,omitempty"` // The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
Pierce bool `json:"pierce,omitempty"` // Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). Reports listeners for all contexts if pierce is enabled.
}
// GetEventListeners returns event listeners of the given object.
//
// parameters:
// objectID - Identifier of the object to return listeners for.
func GetEventListeners(objectID runtime.RemoteObjectID) *GetEventListenersParams {
return &GetEventListenersParams{
ObjectID: objectID,
}
}
// WithDepth the maximum depth at which Node children should be retrieved,
// defaults to 1. Use -1 for the entire subtree or provide an integer larger
// than 0.
func (p GetEventListenersParams) WithDepth(depth int64) *GetEventListenersParams {
p.Depth = depth
return &p
}
// WithPierce whether or not iframes and shadow roots should be traversed
// when returning the subtree (default is false). Reports listeners for all
// contexts if pierce is enabled.
func (p GetEventListenersParams) WithPierce(pierce bool) *GetEventListenersParams {
p.Pierce = pierce
return &p
}
// GetEventListenersReturns return values.
type GetEventListenersReturns struct {
Listeners []*EventListener `json:"listeners,omitempty"` // Array of relevant listeners.
}
// Do executes DOMDebugger.getEventListeners against the provided context and
// target handler.
//
// returns:
// listeners - Array of relevant listeners.
func (p *GetEventListenersParams) Do(ctxt context.Context, h cdp.Handler) (listeners []*EventListener, err error) {
// execute
var res GetEventListenersReturns
err = h.Execute(ctxt, cdp.CommandDOMDebuggerGetEventListeners, p, &res)
if err != nil {
return nil, err
}
return res.Listeners, nil
}
// RemoveDOMBreakpointParams removes DOM breakpoint that was set using
// setDOMBreakpoint.
type RemoveDOMBreakpointParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Identifier of the node to remove breakpoint from.
Type DOMBreakpointType `json:"type"` // Type of the breakpoint to remove.
}
// RemoveDOMBreakpoint removes DOM breakpoint that was set using
// setDOMBreakpoint.
//
// parameters:
// nodeID - Identifier of the node to remove breakpoint from.
// type - Type of the breakpoint to remove.
func RemoveDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *RemoveDOMBreakpointParams {
return &RemoveDOMBreakpointParams{
NodeID: nodeID,
Type: typeVal,
}
}
// Do executes DOMDebugger.removeDOMBreakpoint against the provided context and
// target handler.
func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveDOMBreakpoint, p, nil)
}
// RemoveEventListenerBreakpointParams removes breakpoint on particular DOM
// event.
type RemoveEventListenerBreakpointParams struct {
EventName string `json:"eventName"` // Event name.
TargetName string `json:"targetName,omitempty"` // EventTarget interface name.
}
// RemoveEventListenerBreakpoint removes breakpoint on particular DOM event.
//
// parameters:
// eventName - Event name.
func RemoveEventListenerBreakpoint(eventName string) *RemoveEventListenerBreakpointParams {
return &RemoveEventListenerBreakpointParams{
EventName: eventName,
}
}
// WithTargetName eventTarget interface name.
func (p RemoveEventListenerBreakpointParams) WithTargetName(targetName string) *RemoveEventListenerBreakpointParams {
p.TargetName = targetName
return &p
}
// Do executes DOMDebugger.removeEventListenerBreakpoint against the provided context and
// target handler.
func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveEventListenerBreakpoint, p, nil)
}
// RemoveInstrumentationBreakpointParams removes breakpoint on particular
// native event.
type RemoveInstrumentationBreakpointParams struct {
EventName string `json:"eventName"` // Instrumentation name to stop on.
}
// RemoveInstrumentationBreakpoint removes breakpoint on particular native
// event.
//
// parameters:
// eventName - Instrumentation name to stop on.
func RemoveInstrumentationBreakpoint(eventName string) *RemoveInstrumentationBreakpointParams {
return &RemoveInstrumentationBreakpointParams{
EventName: eventName,
}
}
// Do executes DOMDebugger.removeInstrumentationBreakpoint against the provided context and
// target handler.
func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveInstrumentationBreakpoint, p, nil)
}
// RemoveXHRBreakpointParams removes breakpoint from XMLHttpRequest.
type RemoveXHRBreakpointParams struct {
URL string `json:"url"` // Resource URL substring.
}
// RemoveXHRBreakpoint removes breakpoint from XMLHttpRequest.
//
// parameters:
// url - Resource URL substring.
func RemoveXHRBreakpoint(url string) *RemoveXHRBreakpointParams {
return &RemoveXHRBreakpointParams{
URL: url,
}
}
// Do executes DOMDebugger.removeXHRBreakpoint against the provided context and
// target handler.
func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMDebuggerRemoveXHRBreakpoint, p, nil)
}
// SetDOMBreakpointParams sets breakpoint on particular operation with DOM.
type SetDOMBreakpointParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Identifier of the node to set breakpoint on.
Type DOMBreakpointType `json:"type"` // Type of the operation to stop upon.
}
// SetDOMBreakpoint sets breakpoint on particular operation with DOM.
//
// parameters:
// nodeID - Identifier of the node to set breakpoint on.
// type - Type of the operation to stop upon.
func SetDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *SetDOMBreakpointParams {
return &SetDOMBreakpointParams{
NodeID: nodeID,
Type: typeVal,
}
}
// Do executes DOMDebugger.setDOMBreakpoint against the provided context and
// target handler.
func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetDOMBreakpoint, p, nil)
}
// SetEventListenerBreakpointParams sets breakpoint on particular DOM event.
type SetEventListenerBreakpointParams struct {
EventName string `json:"eventName"` // DOM Event name to stop on (any DOM event will do).
TargetName string `json:"targetName,omitempty"` // EventTarget interface name to stop on. If equal to "*" or not provided, will stop on any EventTarget.
}
// SetEventListenerBreakpoint sets breakpoint on particular DOM event.
//
// parameters:
// eventName - DOM Event name to stop on (any DOM event will do).
func SetEventListenerBreakpoint(eventName string) *SetEventListenerBreakpointParams {
return &SetEventListenerBreakpointParams{
EventName: eventName,
}
}
// WithTargetName eventTarget interface name to stop on. If equal to "*" or
// not provided, will stop on any EventTarget.
func (p SetEventListenerBreakpointParams) WithTargetName(targetName string) *SetEventListenerBreakpointParams {
p.TargetName = targetName
return &p
}
// Do executes DOMDebugger.setEventListenerBreakpoint against the provided context and
// target handler.
func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetEventListenerBreakpoint, p, nil)
}
// SetInstrumentationBreakpointParams sets breakpoint on particular native
// event.
type SetInstrumentationBreakpointParams struct {
EventName string `json:"eventName"` // Instrumentation name to stop on.
}
// SetInstrumentationBreakpoint sets breakpoint on particular native event.
//
// parameters:
// eventName - Instrumentation name to stop on.
func SetInstrumentationBreakpoint(eventName string) *SetInstrumentationBreakpointParams {
return &SetInstrumentationBreakpointParams{
EventName: eventName,
}
}
// Do executes DOMDebugger.setInstrumentationBreakpoint against the provided context and
// target handler.
func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetInstrumentationBreakpoint, p, nil)
}
// SetXHRBreakpointParams sets breakpoint on XMLHttpRequest.
type SetXHRBreakpointParams struct {
URL string `json:"url"` // Resource URL substring. All XHRs having this substring in the URL will get stopped upon.
}
// SetXHRBreakpoint sets breakpoint on XMLHttpRequest.
//
// parameters:
// url - Resource URL substring. All XHRs having this substring in the URL will get stopped upon.
func SetXHRBreakpoint(url string) *SetXHRBreakpointParams {
return &SetXHRBreakpointParams{
URL: url,
}
}
// Do executes DOMDebugger.setXHRBreakpoint against the provided context and
// target handler.
func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMDebuggerSetXHRBreakpoint, p, nil)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +0,0 @@
package domdebugger
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// DOMBreakpointType DOM breakpoint type.
type DOMBreakpointType string
// String returns the DOMBreakpointType as string value.
func (t DOMBreakpointType) String() string {
return string(t)
}
// DOMBreakpointType values.
const (
DOMBreakpointTypeSubtreeModified DOMBreakpointType = "subtree-modified"
DOMBreakpointTypeAttributeModified DOMBreakpointType = "attribute-modified"
DOMBreakpointTypeNodeRemoved DOMBreakpointType = "node-removed"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t DOMBreakpointType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t DOMBreakpointType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *DOMBreakpointType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch DOMBreakpointType(in.String()) {
case DOMBreakpointTypeSubtreeModified:
*t = DOMBreakpointTypeSubtreeModified
case DOMBreakpointTypeAttributeModified:
*t = DOMBreakpointTypeAttributeModified
case DOMBreakpointTypeNodeRemoved:
*t = DOMBreakpointTypeNodeRemoved
default:
in.AddError(errors.New("unknown DOMBreakpointType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *DOMBreakpointType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// EventListener object event listener.
type EventListener struct {
Type string `json:"type"` // EventListener's type.
UseCapture bool `json:"useCapture"` // EventListener's useCapture.
Passive bool `json:"passive"` // EventListener's passive flag.
Once bool `json:"once"` // EventListener's once flag.
ScriptID runtime.ScriptID `json:"scriptId"` // Script id of the handler code.
LineNumber int64 `json:"lineNumber"` // Line number in the script (0-based).
ColumnNumber int64 `json:"columnNumber"` // Column number in the script (0-based).
Handler *runtime.RemoteObject `json:"handler,omitempty"` // Event handler function value.
OriginalHandler *runtime.RemoteObject `json:"originalHandler,omitempty"` // Event original handler function value.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Node the listener is added to (if any).
}

View File

@ -1,63 +0,0 @@
// Package domsnapshot provides the Chrome Debugging Protocol
// commands, types, and events for the DOMSnapshot domain.
//
// This domain facilitates obtaining document snapshots with DOM, layout, and
// style information.
//
// Generated by the chromedp-gen command.
package domsnapshot
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// GetSnapshotParams returns a document snapshot, including the full DOM tree
// of the root node (including iframes, template contents, and imported
// documents) in a flattened array, as well as layout and white-listed computed
// style information for the nodes. Shadow DOM in the returned DOM tree is
// flattened.
type GetSnapshotParams struct {
ComputedStyleWhitelist []string `json:"computedStyleWhitelist"` // Whitelist of computed styles to return.
}
// GetSnapshot returns a document snapshot, including the full DOM tree of
// the root node (including iframes, template contents, and imported documents)
// in a flattened array, as well as layout and white-listed computed style
// information for the nodes. Shadow DOM in the returned DOM tree is flattened.
//
// parameters:
// computedStyleWhitelist - Whitelist of computed styles to return.
func GetSnapshot(computedStyleWhitelist []string) *GetSnapshotParams {
return &GetSnapshotParams{
ComputedStyleWhitelist: computedStyleWhitelist,
}
}
// GetSnapshotReturns return values.
type GetSnapshotReturns struct {
DomNodes []*DOMNode `json:"domNodes,omitempty"` // The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
LayoutTreeNodes []*LayoutTreeNode `json:"layoutTreeNodes,omitempty"` // The nodes in the layout tree.
ComputedStyles []*ComputedStyle `json:"computedStyles,omitempty"` // Whitelisted ComputedStyle properties for each node in the layout tree.
}
// Do executes DOMSnapshot.getSnapshot against the provided context and
// target handler.
//
// returns:
// domNodes - The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document.
// layoutTreeNodes - The nodes in the layout tree.
// computedStyles - Whitelisted ComputedStyle properties for each node in the layout tree.
func (p *GetSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (domNodes []*DOMNode, layoutTreeNodes []*LayoutTreeNode, computedStyles []*ComputedStyle, err error) {
// execute
var res GetSnapshotReturns
err = h.Execute(ctxt, cdp.CommandDOMSnapshotGetSnapshot, p, &res)
if err != nil {
return nil, nil, nil, err
}
return res.DomNodes, res.LayoutTreeNodes, res.ComputedStyles, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,65 +0,0 @@
package domsnapshot
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/dom"
)
// DOMNode a Node in the DOM tree.
type DOMNode struct {
NodeType cdp.NodeType `json:"nodeType"` // Node's nodeType.
NodeName string `json:"nodeName"` // Node's nodeName.
NodeValue string `json:"nodeValue"` // Node's nodeValue.
TextValue string `json:"textValue,omitempty"` // Only set for textarea elements, contains the text value.
InputValue string `json:"inputValue,omitempty"` // Only set for input elements, contains the input's associated text value.
InputChecked bool `json:"inputChecked,omitempty"` // Only set for radio and checkbox input elements, indicates if the element has been checked
OptionSelected bool `json:"optionSelected,omitempty"` // Only set for option elements, indicates if the element has been selected
BackendNodeID cdp.BackendNodeID `json:"backendNodeId"` // Node's id, corresponds to DOM.Node.backendNodeId.
ChildNodeIndexes []int64 `json:"childNodeIndexes,omitempty"` // The indexes of the node's child nodes in the domNodes array returned by getSnapshot, if any.
Attributes []*NameValue `json:"attributes,omitempty"` // Attributes of an Element node.
PseudoElementIndexes []int64 `json:"pseudoElementIndexes,omitempty"` // Indexes of pseudo elements associated with this node in the domNodes array returned by getSnapshot, if any.
LayoutNodeIndex int64 `json:"layoutNodeIndex,omitempty"` // The index of the node's related layout tree node in the layoutTreeNodes array returned by getSnapshot, if any.
DocumentURL string `json:"documentURL,omitempty"` // Document URL that Document or FrameOwner node points to.
BaseURL string `json:"baseURL,omitempty"` // Base URL that Document or FrameOwner node uses for URL completion.
ContentLanguage string `json:"contentLanguage,omitempty"` // Only set for documents, contains the document's content language.
DocumentEncoding string `json:"documentEncoding,omitempty"` // Only set for documents, contains the document's character set encoding.
PublicID string `json:"publicId,omitempty"` // DocumentType node's publicId.
SystemID string `json:"systemId,omitempty"` // DocumentType node's systemId.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame ID for frame owner elements and also for the document node.
ContentDocumentIndex int64 `json:"contentDocumentIndex,omitempty"` // The index of a frame owner element's content document in the domNodes array returned by getSnapshot, if any.
ImportedDocumentIndex int64 `json:"importedDocumentIndex,omitempty"` // Index of the imported document's node of a link element in the domNodes array returned by getSnapshot, if any.
TemplateContentIndex int64 `json:"templateContentIndex,omitempty"` // Index of the content node of a template element in the domNodes array returned by getSnapshot.
PseudoType cdp.PseudoType `json:"pseudoType,omitempty"` // Type of a pseudo element node.
IsClickable bool `json:"isClickable,omitempty"` // Whether this DOM node responds to mouse clicks. This includes nodes that have had click event listeners attached via JavaScript as well as anchor tags that naturally navigate when clicked.
}
// InlineTextBox details of post layout rendered text positions. The exact
// layout should not be regarded as stable and may change between versions.
type InlineTextBox struct {
BoundingBox *dom.Rect `json:"boundingBox"` // The absolute position bounding box.
StartCharacterIndex int64 `json:"startCharacterIndex"` // The starting index in characters, for this post layout textbox substring.
NumCharacters int64 `json:"numCharacters"` // The number of characters in this post layout textbox substring.
}
// LayoutTreeNode details of an element in the DOM tree with a LayoutObject.
type LayoutTreeNode struct {
DomNodeIndex int64 `json:"domNodeIndex"` // The index of the related DOM node in the domNodes array returned by getSnapshot.
BoundingBox *dom.Rect `json:"boundingBox"` // The absolute position bounding box.
LayoutText string `json:"layoutText,omitempty"` // Contents of the LayoutText, if any.
InlineTextNodes []*InlineTextBox `json:"inlineTextNodes,omitempty"` // The post-layout inline text nodes, if any.
StyleIndex int64 `json:"styleIndex,omitempty"` // Index into the computedStyles array returned by getSnapshot.
}
// ComputedStyle a subset of the full ComputedStyle as defined by the request
// whitelist.
type ComputedStyle struct {
Properties []*NameValue `json:"properties"` // Name/value pairs of computed style properties.
}
// NameValue a name/value pair.
type NameValue struct {
Name string `json:"name"` // Attribute/property name.
Value string `json:"value"` // Attribute/property value.
}

View File

@ -1,155 +0,0 @@
// Package domstorage provides the Chrome Debugging Protocol
// commands, types, and events for the DOMStorage domain.
//
// Query and modify DOM storage.
//
// Generated by the chromedp-gen command.
package domstorage
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// ClearParams [no description].
type ClearParams struct {
StorageID *StorageID `json:"storageId"`
}
// Clear [no description].
//
// parameters:
// storageID
func Clear(storageID *StorageID) *ClearParams {
return &ClearParams{
StorageID: storageID,
}
}
// Do executes DOMStorage.clear against the provided context and
// target handler.
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMStorageClear, p, nil)
}
// DisableParams disables storage tracking, prevents storage events from
// being sent to the client.
type DisableParams struct{}
// Disable disables storage tracking, prevents storage events from being sent
// to the client.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes DOMStorage.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMStorageDisable, nil, nil)
}
// EnableParams enables storage tracking, storage events will now be
// delivered to the client.
type EnableParams struct{}
// Enable enables storage tracking, storage events will now be delivered to
// the client.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes DOMStorage.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMStorageEnable, nil, nil)
}
// GetDOMStorageItemsParams [no description].
type GetDOMStorageItemsParams struct {
StorageID *StorageID `json:"storageId"`
}
// GetDOMStorageItems [no description].
//
// parameters:
// storageID
func GetDOMStorageItems(storageID *StorageID) *GetDOMStorageItemsParams {
return &GetDOMStorageItemsParams{
StorageID: storageID,
}
}
// GetDOMStorageItemsReturns return values.
type GetDOMStorageItemsReturns struct {
Entries []Item `json:"entries,omitempty"`
}
// Do executes DOMStorage.getDOMStorageItems against the provided context and
// target handler.
//
// returns:
// entries
func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h cdp.Handler) (entries []Item, err error) {
// execute
var res GetDOMStorageItemsReturns
err = h.Execute(ctxt, cdp.CommandDOMStorageGetDOMStorageItems, p, &res)
if err != nil {
return nil, err
}
return res.Entries, nil
}
// RemoveDOMStorageItemParams [no description].
type RemoveDOMStorageItemParams struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
}
// RemoveDOMStorageItem [no description].
//
// parameters:
// storageID
// key
func RemoveDOMStorageItem(storageID *StorageID, key string) *RemoveDOMStorageItemParams {
return &RemoveDOMStorageItemParams{
StorageID: storageID,
Key: key,
}
}
// Do executes DOMStorage.removeDOMStorageItem against the provided context and
// target handler.
func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMStorageRemoveDOMStorageItem, p, nil)
}
// SetDOMStorageItemParams [no description].
type SetDOMStorageItemParams struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
Value string `json:"value"`
}
// SetDOMStorageItem [no description].
//
// parameters:
// storageID
// key
// value
func SetDOMStorageItem(storageID *StorageID, key string, value string) *SetDOMStorageItemParams {
return &SetDOMStorageItemParams{
StorageID: storageID,
Key: key,
Value: value,
}
}
// Do executes DOMStorage.setDOMStorageItem against the provided context and
// target handler.
func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDOMStorageSetDOMStorageItem, p, nil)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +0,0 @@
package domstorage
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventDomStorageItemAdded [no description].
type EventDomStorageItemAdded struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
NewValue string `json:"newValue"`
}
// EventDomStorageItemRemoved [no description].
type EventDomStorageItemRemoved struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
}
// EventDomStorageItemUpdated [no description].
type EventDomStorageItemUpdated struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
OldValue string `json:"oldValue"`
NewValue string `json:"newValue"`
}
// EventDomStorageItemsCleared [no description].
type EventDomStorageItemsCleared struct {
StorageID *StorageID `json:"storageId"`
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventDOMStorageDomStorageItemAdded,
cdp.EventDOMStorageDomStorageItemRemoved,
cdp.EventDOMStorageDomStorageItemUpdated,
cdp.EventDOMStorageDomStorageItemsCleared,
}

View File

@ -1,12 +0,0 @@
package domstorage
// Code generated by chromedp-gen. DO NOT EDIT.
// StorageID DOM Storage identifier.
type StorageID struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin for the storage.
IsLocalStorage bool `json:"isLocalStorage"` // Whether the storage is local storage (not session storage).
}
// Item DOM Storage item.
type Item []string

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,483 +0,0 @@
// Package emulation provides the Chrome Debugging Protocol
// commands, types, and events for the Emulation domain.
//
// This domain emulates different environments for the page.
//
// Generated by the chromedp-gen command.
package emulation
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/page"
"github.com/knq/chromedp/cdp/runtime"
)
// CanEmulateParams tells whether emulation is supported.
type CanEmulateParams struct{}
// CanEmulate tells whether emulation is supported.
func CanEmulate() *CanEmulateParams {
return &CanEmulateParams{}
}
// CanEmulateReturns return values.
type CanEmulateReturns struct {
Result bool `json:"result,omitempty"` // True if emulation is supported.
}
// Do executes Emulation.canEmulate against the provided context and
// target handler.
//
// returns:
// result - True if emulation is supported.
func (p *CanEmulateParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
// execute
var res CanEmulateReturns
err = h.Execute(ctxt, cdp.CommandEmulationCanEmulate, nil, &res)
if err != nil {
return false, err
}
return res.Result, nil
}
// ClearDeviceMetricsOverrideParams clears the overridden device metrics.
type ClearDeviceMetricsOverrideParams struct{}
// ClearDeviceMetricsOverride clears the overridden device metrics.
func ClearDeviceMetricsOverride() *ClearDeviceMetricsOverrideParams {
return &ClearDeviceMetricsOverrideParams{}
}
// Do executes Emulation.clearDeviceMetricsOverride against the provided context and
// target handler.
func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationClearDeviceMetricsOverride, nil, nil)
}
// ClearGeolocationOverrideParams clears the overridden Geolocation Position
// and Error.
type ClearGeolocationOverrideParams struct{}
// ClearGeolocationOverride clears the overridden Geolocation Position and
// Error.
func ClearGeolocationOverride() *ClearGeolocationOverrideParams {
return &ClearGeolocationOverrideParams{}
}
// Do executes Emulation.clearGeolocationOverride against the provided context and
// target handler.
func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationClearGeolocationOverride, nil, nil)
}
// ResetPageScaleFactorParams requests that page scale factor is reset to
// initial values.
type ResetPageScaleFactorParams struct{}
// ResetPageScaleFactor requests that page scale factor is reset to initial
// values.
func ResetPageScaleFactor() *ResetPageScaleFactorParams {
return &ResetPageScaleFactorParams{}
}
// Do executes Emulation.resetPageScaleFactor against the provided context and
// target handler.
func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationResetPageScaleFactor, nil, nil)
}
// SetCPUThrottlingRateParams enables CPU throttling to emulate slow CPUs.
type SetCPUThrottlingRateParams struct {
Rate float64 `json:"rate"` // Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
}
// SetCPUThrottlingRate enables CPU throttling to emulate slow CPUs.
//
// parameters:
// rate - Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
func SetCPUThrottlingRate(rate float64) *SetCPUThrottlingRateParams {
return &SetCPUThrottlingRateParams{
Rate: rate,
}
}
// Do executes Emulation.setCPUThrottlingRate against the provided context and
// target handler.
func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetCPUThrottlingRate, p, nil)
}
// SetDefaultBackgroundColorOverrideParams sets or clears an override of the
// default background color of the frame. This override is used if the content
// does not specify one.
type SetDefaultBackgroundColorOverrideParams struct {
Color *cdp.RGBA `json:"color,omitempty"` // RGBA of the default background color. If not specified, any existing override will be cleared.
}
// SetDefaultBackgroundColorOverride sets or clears an override of the
// default background color of the frame. This override is used if the content
// does not specify one.
//
// parameters:
func SetDefaultBackgroundColorOverride() *SetDefaultBackgroundColorOverrideParams {
return &SetDefaultBackgroundColorOverrideParams{}
}
// WithColor rGBA of the default background color. If not specified, any
// existing override will be cleared.
func (p SetDefaultBackgroundColorOverrideParams) WithColor(color *cdp.RGBA) *SetDefaultBackgroundColorOverrideParams {
p.Color = color
return &p
}
// Do executes Emulation.setDefaultBackgroundColorOverride against the provided context and
// target handler.
func (p *SetDefaultBackgroundColorOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetDefaultBackgroundColorOverride, p, nil)
}
// SetDeviceMetricsOverrideParams overrides the values of device screen
// dimensions (window.screen.width, window.screen.height, window.innerWidth,
// window.innerHeight, and "device-width"/"device-height"-related CSS media
// query results).
type SetDeviceMetricsOverrideParams struct {
Width int64 `json:"width"` // Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
Height int64 `json:"height"` // Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
DeviceScaleFactor float64 `json:"deviceScaleFactor"` // Overriding device scale factor value. 0 disables the override.
Mobile bool `json:"mobile"` // Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
Scale float64 `json:"scale,omitempty"` // Scale to apply to resulting view image.
ScreenWidth int64 `json:"screenWidth,omitempty"` // Overriding screen width value in pixels (minimum 0, maximum 10000000).
ScreenHeight int64 `json:"screenHeight,omitempty"` // Overriding screen height value in pixels (minimum 0, maximum 10000000).
PositionX int64 `json:"positionX,omitempty"` // Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
PositionY int64 `json:"positionY,omitempty"` // Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
DontSetVisibleSize bool `json:"dontSetVisibleSize,omitempty"` // Do not set visible view size, rely upon explicit setVisibleSize call.
ScreenOrientation *ScreenOrientation `json:"screenOrientation,omitempty"` // Screen orientation override.
Viewport *page.Viewport `json:"viewport,omitempty"` // If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
}
// SetDeviceMetricsOverride overrides the values of device screen dimensions
// (window.screen.width, window.screen.height, window.innerWidth,
// window.innerHeight, and "device-width"/"device-height"-related CSS media
// query results).
//
// parameters:
// width - Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
// height - Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
// deviceScaleFactor - Overriding device scale factor value. 0 disables the override.
// mobile - Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
func SetDeviceMetricsOverride(width int64, height int64, deviceScaleFactor float64, mobile bool) *SetDeviceMetricsOverrideParams {
return &SetDeviceMetricsOverrideParams{
Width: width,
Height: height,
DeviceScaleFactor: deviceScaleFactor,
Mobile: mobile,
}
}
// WithScale scale to apply to resulting view image.
func (p SetDeviceMetricsOverrideParams) WithScale(scale float64) *SetDeviceMetricsOverrideParams {
p.Scale = scale
return &p
}
// WithScreenWidth overriding screen width value in pixels (minimum 0,
// maximum 10000000).
func (p SetDeviceMetricsOverrideParams) WithScreenWidth(screenWidth int64) *SetDeviceMetricsOverrideParams {
p.ScreenWidth = screenWidth
return &p
}
// WithScreenHeight overriding screen height value in pixels (minimum 0,
// maximum 10000000).
func (p SetDeviceMetricsOverrideParams) WithScreenHeight(screenHeight int64) *SetDeviceMetricsOverrideParams {
p.ScreenHeight = screenHeight
return &p
}
// WithPositionX overriding view X position on screen in pixels (minimum 0,
// maximum 10000000).
func (p SetDeviceMetricsOverrideParams) WithPositionX(positionX int64) *SetDeviceMetricsOverrideParams {
p.PositionX = positionX
return &p
}
// WithPositionY overriding view Y position on screen in pixels (minimum 0,
// maximum 10000000).
func (p SetDeviceMetricsOverrideParams) WithPositionY(positionY int64) *SetDeviceMetricsOverrideParams {
p.PositionY = positionY
return &p
}
// WithDontSetVisibleSize do not set visible view size, rely upon explicit
// setVisibleSize call.
func (p SetDeviceMetricsOverrideParams) WithDontSetVisibleSize(dontSetVisibleSize bool) *SetDeviceMetricsOverrideParams {
p.DontSetVisibleSize = dontSetVisibleSize
return &p
}
// WithScreenOrientation screen orientation override.
func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation *ScreenOrientation) *SetDeviceMetricsOverrideParams {
p.ScreenOrientation = screenOrientation
return &p
}
// WithViewport if set, the visible area of the page will be overridden to
// this viewport. This viewport change is not observed by the page, e.g.
// viewport-relative elements do not change positions.
func (p SetDeviceMetricsOverrideParams) WithViewport(viewport *page.Viewport) *SetDeviceMetricsOverrideParams {
p.Viewport = viewport
return &p
}
// Do executes Emulation.setDeviceMetricsOverride against the provided context and
// target handler.
func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetDeviceMetricsOverride, p, nil)
}
// SetEmitTouchEventsForMouseParams [no description].
type SetEmitTouchEventsForMouseParams struct {
Enabled bool `json:"enabled"` // Whether touch emulation based on mouse input should be enabled.
Configuration SetEmitTouchEventsForMouseConfiguration `json:"configuration,omitempty"` // Touch/gesture events configuration. Default: current platform.
}
// SetEmitTouchEventsForMouse [no description].
//
// parameters:
// enabled - Whether touch emulation based on mouse input should be enabled.
func SetEmitTouchEventsForMouse(enabled bool) *SetEmitTouchEventsForMouseParams {
return &SetEmitTouchEventsForMouseParams{
Enabled: enabled,
}
}
// WithConfiguration touch/gesture events configuration. Default: current
// platform.
func (p SetEmitTouchEventsForMouseParams) WithConfiguration(configuration SetEmitTouchEventsForMouseConfiguration) *SetEmitTouchEventsForMouseParams {
p.Configuration = configuration
return &p
}
// Do executes Emulation.setEmitTouchEventsForMouse against the provided context and
// target handler.
func (p *SetEmitTouchEventsForMouseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetEmitTouchEventsForMouse, p, nil)
}
// SetEmulatedMediaParams emulates the given media for CSS media queries.
type SetEmulatedMediaParams struct {
Media string `json:"media"` // Media type to emulate. Empty string disables the override.
}
// SetEmulatedMedia emulates the given media for CSS media queries.
//
// parameters:
// media - Media type to emulate. Empty string disables the override.
func SetEmulatedMedia(media string) *SetEmulatedMediaParams {
return &SetEmulatedMediaParams{
Media: media,
}
}
// Do executes Emulation.setEmulatedMedia against the provided context and
// target handler.
func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetEmulatedMedia, p, nil)
}
// SetGeolocationOverrideParams overrides the Geolocation Position or Error.
// Omitting any of the parameters emulates position unavailable.
type SetGeolocationOverrideParams struct {
Latitude float64 `json:"latitude,omitempty"` // Mock latitude
Longitude float64 `json:"longitude,omitempty"` // Mock longitude
Accuracy float64 `json:"accuracy,omitempty"` // Mock accuracy
}
// SetGeolocationOverride overrides the Geolocation Position or Error.
// Omitting any of the parameters emulates position unavailable.
//
// parameters:
func SetGeolocationOverride() *SetGeolocationOverrideParams {
return &SetGeolocationOverrideParams{}
}
// WithLatitude mock latitude.
func (p SetGeolocationOverrideParams) WithLatitude(latitude float64) *SetGeolocationOverrideParams {
p.Latitude = latitude
return &p
}
// WithLongitude mock longitude.
func (p SetGeolocationOverrideParams) WithLongitude(longitude float64) *SetGeolocationOverrideParams {
p.Longitude = longitude
return &p
}
// WithAccuracy mock accuracy.
func (p SetGeolocationOverrideParams) WithAccuracy(accuracy float64) *SetGeolocationOverrideParams {
p.Accuracy = accuracy
return &p
}
// Do executes Emulation.setGeolocationOverride against the provided context and
// target handler.
func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetGeolocationOverride, p, nil)
}
// SetNavigatorOverridesParams overrides value returned by the javascript
// navigator object.
type SetNavigatorOverridesParams struct {
Platform string `json:"platform"` // The platform navigator.platform should return.
}
// SetNavigatorOverrides overrides value returned by the javascript navigator
// object.
//
// parameters:
// platform - The platform navigator.platform should return.
func SetNavigatorOverrides(platform string) *SetNavigatorOverridesParams {
return &SetNavigatorOverridesParams{
Platform: platform,
}
}
// Do executes Emulation.setNavigatorOverrides against the provided context and
// target handler.
func (p *SetNavigatorOverridesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetNavigatorOverrides, p, nil)
}
// SetPageScaleFactorParams sets a specified page scale factor.
type SetPageScaleFactorParams struct {
PageScaleFactor float64 `json:"pageScaleFactor"` // Page scale factor.
}
// SetPageScaleFactor sets a specified page scale factor.
//
// parameters:
// pageScaleFactor - Page scale factor.
func SetPageScaleFactor(pageScaleFactor float64) *SetPageScaleFactorParams {
return &SetPageScaleFactorParams{
PageScaleFactor: pageScaleFactor,
}
}
// Do executes Emulation.setPageScaleFactor against the provided context and
// target handler.
func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetPageScaleFactor, p, nil)
}
// SetScriptExecutionDisabledParams switches script execution in the page.
type SetScriptExecutionDisabledParams struct {
Value bool `json:"value"` // Whether script execution should be disabled in the page.
}
// SetScriptExecutionDisabled switches script execution in the page.
//
// parameters:
// value - Whether script execution should be disabled in the page.
func SetScriptExecutionDisabled(value bool) *SetScriptExecutionDisabledParams {
return &SetScriptExecutionDisabledParams{
Value: value,
}
}
// Do executes Emulation.setScriptExecutionDisabled against the provided context and
// target handler.
func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetScriptExecutionDisabled, p, nil)
}
// SetTouchEmulationEnabledParams enables touch on platforms which do not
// support them.
type SetTouchEmulationEnabledParams struct {
Enabled bool `json:"enabled"` // Whether the touch event emulation should be enabled.
MaxTouchPoints int64 `json:"maxTouchPoints,omitempty"` // Maximum touch points supported. Defaults to one.
}
// SetTouchEmulationEnabled enables touch on platforms which do not support
// them.
//
// parameters:
// enabled - Whether the touch event emulation should be enabled.
func SetTouchEmulationEnabled(enabled bool) *SetTouchEmulationEnabledParams {
return &SetTouchEmulationEnabledParams{
Enabled: enabled,
}
}
// WithMaxTouchPoints maximum touch points supported. Defaults to one.
func (p SetTouchEmulationEnabledParams) WithMaxTouchPoints(maxTouchPoints int64) *SetTouchEmulationEnabledParams {
p.MaxTouchPoints = maxTouchPoints
return &p
}
// Do executes Emulation.setTouchEmulationEnabled against the provided context and
// target handler.
func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetTouchEmulationEnabled, p, nil)
}
// SetVirtualTimePolicyParams turns on virtual time for all frames (replacing
// real-time with a synthetic time source) and sets the current virtual time
// policy. Note this supersedes any previous time budget.
type SetVirtualTimePolicyParams struct {
Policy VirtualTimePolicy `json:"policy"`
Budget float64 `json:"budget,omitempty"` // If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
MaxVirtualTimeTaskStarvationCount int64 `json:"maxVirtualTimeTaskStarvationCount,omitempty"` // If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
}
// SetVirtualTimePolicy turns on virtual time for all frames (replacing
// real-time with a synthetic time source) and sets the current virtual time
// policy. Note this supersedes any previous time budget.
//
// parameters:
// policy
func SetVirtualTimePolicy(policy VirtualTimePolicy) *SetVirtualTimePolicyParams {
return &SetVirtualTimePolicyParams{
Policy: policy,
}
}
// WithBudget if set, after this many virtual milliseconds have elapsed
// virtual time will be paused and a virtualTimeBudgetExpired event is sent.
func (p SetVirtualTimePolicyParams) WithBudget(budget float64) *SetVirtualTimePolicyParams {
p.Budget = budget
return &p
}
// WithMaxVirtualTimeTaskStarvationCount if set this specifies the maximum
// number of tasks that can be run before virtual is forced forwards to prevent
// deadlock.
func (p SetVirtualTimePolicyParams) WithMaxVirtualTimeTaskStarvationCount(maxVirtualTimeTaskStarvationCount int64) *SetVirtualTimePolicyParams {
p.MaxVirtualTimeTaskStarvationCount = maxVirtualTimeTaskStarvationCount
return &p
}
// SetVirtualTimePolicyReturns return values.
type SetVirtualTimePolicyReturns struct {
VirtualTimeBase *runtime.Timestamp `json:"virtualTimeBase,omitempty"` // Absolute timestamp at which virtual time was first enabled (milliseconds since epoch).
}
// Do executes Emulation.setVirtualTimePolicy against the provided context and
// target handler.
//
// returns:
// virtualTimeBase - Absolute timestamp at which virtual time was first enabled (milliseconds since epoch).
func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.Handler) (virtualTimeBase *runtime.Timestamp, err error) {
// execute
var res SetVirtualTimePolicyReturns
err = h.Execute(ctxt, cdp.CommandEmulationSetVirtualTimePolicy, p, &res)
if err != nil {
return nil, err
}
return res.VirtualTimeBase, nil
}

View File

@ -1,30 +0,0 @@
package emulation
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventVirtualTimeAdvanced notification sent after the virtual time has
// advanced.
type EventVirtualTimeAdvanced struct {
VirtualTimeElapsed float64 `json:"virtualTimeElapsed"` // The amount of virtual time that has elapsed in milliseconds since virtual time was first enabled.
}
// EventVirtualTimeBudgetExpired notification sent after the virtual time
// budget for the current VirtualTimePolicy has run out.
type EventVirtualTimeBudgetExpired struct{}
// EventVirtualTimePaused notification sent after the virtual time has
// paused.
type EventVirtualTimePaused struct {
VirtualTimeElapsed float64 `json:"virtualTimeElapsed"` // The amount of virtual time that has elapsed in milliseconds since virtual time was first enabled.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventEmulationVirtualTimeAdvanced,
cdp.EventEmulationVirtualTimeBudgetExpired,
cdp.EventEmulationVirtualTimePaused,
}

View File

@ -1,157 +0,0 @@
package emulation
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// ScreenOrientation screen orientation.
type ScreenOrientation struct {
Type OrientationType `json:"type"` // Orientation type.
Angle int64 `json:"angle"` // Orientation angle.
}
// VirtualTimePolicy advance: If the scheduler runs out of immediate work,
// the virtual time base may fast forward to allow the next delayed task (if
// any) to run; pause: The virtual time base may not advance;
// pauseIfNetworkFetchesPending: The virtual time base may not advance if there
// are any pending resource fetches.
type VirtualTimePolicy string
// String returns the VirtualTimePolicy as string value.
func (t VirtualTimePolicy) String() string {
return string(t)
}
// VirtualTimePolicy values.
const (
VirtualTimePolicyAdvance VirtualTimePolicy = "advance"
VirtualTimePolicyPause VirtualTimePolicy = "pause"
VirtualTimePolicyPauseIfNetworkFetchesPending VirtualTimePolicy = "pauseIfNetworkFetchesPending"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t VirtualTimePolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t VirtualTimePolicy) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *VirtualTimePolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch VirtualTimePolicy(in.String()) {
case VirtualTimePolicyAdvance:
*t = VirtualTimePolicyAdvance
case VirtualTimePolicyPause:
*t = VirtualTimePolicyPause
case VirtualTimePolicyPauseIfNetworkFetchesPending:
*t = VirtualTimePolicyPauseIfNetworkFetchesPending
default:
in.AddError(errors.New("unknown VirtualTimePolicy value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *VirtualTimePolicy) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// OrientationType orientation type.
type OrientationType string
// String returns the OrientationType as string value.
func (t OrientationType) String() string {
return string(t)
}
// OrientationType values.
const (
OrientationTypePortraitPrimary OrientationType = "portraitPrimary"
OrientationTypePortraitSecondary OrientationType = "portraitSecondary"
OrientationTypeLandscapePrimary OrientationType = "landscapePrimary"
OrientationTypeLandscapeSecondary OrientationType = "landscapeSecondary"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t OrientationType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t OrientationType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *OrientationType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch OrientationType(in.String()) {
case OrientationTypePortraitPrimary:
*t = OrientationTypePortraitPrimary
case OrientationTypePortraitSecondary:
*t = OrientationTypePortraitSecondary
case OrientationTypeLandscapePrimary:
*t = OrientationTypeLandscapePrimary
case OrientationTypeLandscapeSecondary:
*t = OrientationTypeLandscapeSecondary
default:
in.AddError(errors.New("unknown OrientationType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *OrientationType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// SetEmitTouchEventsForMouseConfiguration touch/gesture events
// configuration. Default: current platform.
type SetEmitTouchEventsForMouseConfiguration string
// String returns the SetEmitTouchEventsForMouseConfiguration as string value.
func (t SetEmitTouchEventsForMouseConfiguration) String() string {
return string(t)
}
// SetEmitTouchEventsForMouseConfiguration values.
const (
SetEmitTouchEventsForMouseConfigurationMobile SetEmitTouchEventsForMouseConfiguration = "mobile"
SetEmitTouchEventsForMouseConfigurationDesktop SetEmitTouchEventsForMouseConfiguration = "desktop"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t SetEmitTouchEventsForMouseConfiguration) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t SetEmitTouchEventsForMouseConfiguration) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *SetEmitTouchEventsForMouseConfiguration) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch SetEmitTouchEventsForMouseConfiguration(in.String()) {
case SetEmitTouchEventsForMouseConfigurationMobile:
*t = SetEmitTouchEventsForMouseConfigurationMobile
case SetEmitTouchEventsForMouseConfigurationDesktop:
*t = SetEmitTouchEventsForMouseConfigurationDesktop
default:
in.AddError(errors.New("unknown SetEmitTouchEventsForMouseConfiguration value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *SetEmitTouchEventsForMouseConfiguration) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
// Package har provides the Chrome Debugging Protocol
// commands, types, and events for the HAR domain.
//
// HTTP Archive Format.
//
// Generated by the chromedp-gen command.
package har
// Code generated by chromedp-gen. DO NOT EDIT.

View File

@ -1,168 +0,0 @@
package har
// Code generated by chromedp-gen. DO NOT EDIT.
// Cache this objects contains info about a request coming from browser
// cache.
type Cache struct {
BeforeRequest *CacheData `json:"beforeRequest,omitempty"` // State of a cache entry before the request. Leave out this field if the information is not available.
AfterRequest *CacheData `json:"afterRequest,omitempty"` // State of a cache entry after the request. Leave out this field if the information is not available.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// CacheData describes the cache data for beforeRequest and afterRequest.
type CacheData struct {
Expires string `json:"expires,omitempty"` // Expiration time of the cache entry.
LastAccess string `json:"lastAccess"` // The last time the cache entry was opened.
ETag string `json:"eTag"` // Etag
HitCount int64 `json:"hitCount"` // The number of times the cache entry has been opened.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// Content this object describes details about response content (embedded in
// <response> object).
type Content struct {
Size int64 `json:"size"` // Length of the returned content in bytes. Should be equal to response.bodySize if there is no compression and bigger when the content has been compressed.
Compression int64 `json:"compression,omitempty"` // Number of bytes saved. Leave out this field if the information is not available.
MimeType string `json:"mimeType"` // MIME type of the response text (value of the Content-Type response header). The charset attribute of the MIME type is included (if available).
Text string `json:"text,omitempty"` // Response body sent from the server or loaded from the browser cache. This field is populated with textual content only. The text field is either HTTP decoded text or a encoded (e.g. "base64") representation of the response body. Leave out this field if the information is not available.
Encoding string `json:"encoding,omitempty"` // Encoding used for response text field e.g "base64". Leave out this field if the text field is HTTP decoded (decompressed & unchunked), than trans-coded from its original character set into UTF-8.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// Cookie this object contains list of all cookies (used in <request> and
// <response> objects).
type Cookie struct {
Name string `json:"name"` // The name of the cookie.
Value string `json:"value"` // The cookie value.
Path string `json:"path,omitempty"` // The path pertaining to the cookie.
Domain string `json:"domain,omitempty"` // The host of the cookie.
Expires string `json:"expires,omitempty"` // Cookie expiration time. (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD, e.g. 2009-07-24T19:20:30.123+02:00).
HTTPOnly bool `json:"httpOnly,omitempty"` // Set to true if the cookie is HTTP only, false otherwise.
Secure bool `json:"secure,omitempty"` // True if the cookie was transmitted over ssl, false otherwise.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// Creator creator and browser objects share the same structure.
type Creator struct {
Name string `json:"name"` // Name of the application/browser used to export the log.
Version string `json:"version"` // Version of the application/browser used to export the log.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// Entry this object represents an array with all exported HTTP requests.
// Sorting entries by startedDateTime (starting from the oldest) is preferred
// way how to export data since it can make importing faster. However the reader
// application should always make sure the array is sorted (if required for the
// import).
type Entry struct {
Pageref string `json:"pageref,omitempty"` // Reference to the parent page. Leave out this field if the application does not support grouping by pages.
StartedDateTime string `json:"startedDateTime"` // Date and time stamp of the request start (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD).
Time float64 `json:"time"` // Total elapsed time of the request in milliseconds. This is the sum of all timings available in the timings object (i.e. not including -1 values) .
Request *Request `json:"request"` // Detailed info about the request.
Response *Response `json:"response"` // Detailed info about the response.
Cache *Cache `json:"cache"` // Info about cache usage.
Timings *Timings `json:"timings"` // Detailed timing info about request/response round trip.
ServerIPAddress string `json:"serverIPAddress,omitempty"` // IP address of the server that was connected (result of DNS resolution).
Connection string `json:"connection,omitempty"` // Unique ID of the parent TCP/IP connection, can be the client or server port number. Note that a port number doesn't have to be unique identifier in cases where the port is shared for more connections. If the port isn't available for the application, any other unique connection ID can be used instead (e.g. connection index). Leave out this field if the application doesn't support this info.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// HAR parent container for HAR log.
type HAR struct {
Log *Log `json:"log"`
}
// Log this object represents the root of exported data.
type Log struct {
Version string `json:"version"` // Version number of the format. If empty, string "1.1" is assumed by default.
Creator *Creator `json:"creator"` // Name and version info of the log creator application.
Browser *Creator `json:"browser,omitempty"` // Name and version info of used browser.
Pages []*Page `json:"pages,omitempty"` // List of all exported (tracked) pages. Leave out this field if the application does not support grouping by pages.
Entries []*Entry `json:"entries"` // List of all exported (tracked) requests.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// NameValuePair describes a name/value pair.
type NameValuePair struct {
Name string `json:"name"` // Name of the pair.
Value string `json:"value"` // Value of the pair.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// Page this object represents list of exported pages.
type Page struct {
StartedDateTime string `json:"startedDateTime"` // Date and time stamp for the beginning of the page load (ISO 8601 - YYYY-MM-DDThh:mm:ss.sTZD, e.g. 2009-07-24T19:20:30.45+01:00).
ID string `json:"id"` // Unique identifier of a page within the <log>. Entries use it to refer the parent page.
Title string `json:"title"` // Page title.
PageTimings *PageTimings `json:"pageTimings"` // Detailed timing info about page load.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// PageTimings this object describes timings for various events (states)
// fired during the page load. All times are specified in milliseconds. If a
// time info is not available appropriate field is set to -1.
type PageTimings struct {
OnContentLoad float64 `json:"onContentLoad,omitempty"` // Content of the page loaded. Number of milliseconds since page load started (page.startedDateTime). Use -1 if the timing does not apply to the current request.
OnLoad float64 `json:"onLoad,omitempty"` // Page is loaded (onLoad event fired). Number of milliseconds since page load started (page.startedDateTime). Use -1 if the timing does not apply to the current request.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// Param list of posted parameters, if any (embedded in <postData> object).
type Param struct {
Name string `json:"name"` // name of a posted parameter.
Value string `json:"value,omitempty"` // value of a posted parameter or content of a posted file.
FileName string `json:"fileName,omitempty"` // name of a posted file.
ContentType string `json:"contentType,omitempty"` // content type of a posted file.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// PostData this object describes posted data, if any (embedded in <request>
// object).
type PostData struct {
MimeType string `json:"mimeType"` // Mime type of posted data.
Params []*Param `json:"params"` // List of posted parameters (in case of URL encoded parameters).
Text string `json:"text"` // Plain text posted data
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// Request this object contains detailed info about performed request.
type Request struct {
Method string `json:"method"` // Request method (GET, POST, ...).
URL string `json:"url"` // Absolute URL of the request (fragments are not included).
HTTPVersion string `json:"httpVersion"` // Request HTTP Version.
Cookies []*Cookie `json:"cookies"` // List of cookie objects.
Headers []*NameValuePair `json:"headers"` // List of header objects.
QueryString []*NameValuePair `json:"queryString"` // List of query parameter objects.
PostData *PostData `json:"postData,omitempty"` // Posted data info.
HeadersSize int64 `json:"headersSize"` // Total number of bytes from the start of the HTTP request message until (and including) the double CRLF before the body. Set to -1 if the info is not available.
BodySize int64 `json:"bodySize"` // Size of the request body (POST data payload) in bytes. Set to -1 if the info is not available.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// Response this object contains detailed info about the response.
type Response struct {
Status int64 `json:"status"` // Response status.
StatusText string `json:"statusText"` // Response status description.
HTTPVersion string `json:"httpVersion"` // Response HTTP Version.
Cookies []*Cookie `json:"cookies"` // List of cookie objects.
Headers []*NameValuePair `json:"headers"` // List of header objects.
Content *Content `json:"content"` // Details about the response body.
RedirectURL string `json:"redirectURL"` // Redirection target URL from the Location response header.
HeadersSize int64 `json:"headersSize"` // Total number of bytes from the start of the HTTP response message until (and including) the double CRLF before the body. Set to -1 if the info is not available.
BodySize int64 `json:"bodySize"` // Size of the received response body in bytes. Set to zero in case of responses coming from the cache (304). Set to -1 if the info is not available.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}
// Timings this object describes various phases within request-response round
// trip. All times are specified in milliseconds.
type Timings struct {
Blocked float64 `json:"blocked,omitempty"` // Time spent in a queue waiting for a network connection. Use -1 if the timing does not apply to the current request.
DNS float64 `json:"dns,omitempty"` // DNS resolution time. The time required to resolve a host name. Use -1 if the timing does not apply to the current request.
Connect float64 `json:"connect,omitempty"` // Time required to create TCP connection. Use -1 if the timing does not apply to the current request.
Send float64 `json:"send"` // Time required to send HTTP request to the server.
Wait float64 `json:"wait"` // Waiting for a response from the server.
Receive float64 `json:"receive"` // Time required to read entire response from the server (or cache).
Ssl float64 `json:"ssl,omitempty"` // Time required for SSL/TLS negotiation. If this field is defined then the time is also included in the connect field (to ensure backward compatibility with HAR 1.1). Use -1 if the timing does not apply to the current request.
Comment string `json:"comment,omitempty"` // A comment provided by the user or the application.
}

View File

@ -1,577 +0,0 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package headlessexperimental
import (
json "encoding/json"
runtime "github.com/knq/chromedp/cdp/runtime"
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 easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental(in *jlexer.Lexer, out *ScreenshotParams) {
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 "format":
(out.Format).UnmarshalEasyJSON(in)
case "quality":
out.Quality = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental(out *jwriter.Writer, in ScreenshotParams) {
out.RawByte('{')
first := true
_ = first
if in.Format != "" {
const prefix string = ",\"format\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.Format).MarshalEasyJSON(out)
}
if in.Quality != 0 {
const prefix string = ",\"quality\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Quality))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ScreenshotParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ScreenshotParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ScreenshotParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ScreenshotParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental1(in *jlexer.Lexer, out *EventNeedsBeginFramesChanged) {
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 "needsBeginFrames":
out.NeedsBeginFrames = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental1(out *jwriter.Writer, in EventNeedsBeginFramesChanged) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"needsBeginFrames\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Bool(bool(in.NeedsBeginFrames))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventNeedsBeginFramesChanged) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventNeedsBeginFramesChanged) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventNeedsBeginFramesChanged) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventNeedsBeginFramesChanged) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental2(in *jlexer.Lexer, out *EventMainFrameReadyForScreenshots) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental2(out *jwriter.Writer, in EventMainFrameReadyForScreenshots) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventMainFrameReadyForScreenshots) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventMainFrameReadyForScreenshots) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventMainFrameReadyForScreenshots) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventMainFrameReadyForScreenshots) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental3(in *jlexer.Lexer, out *EnableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental3(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental4(in *jlexer.Lexer, out *DisableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental4(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental4(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental5(in *jlexer.Lexer, out *BeginFrameReturns) {
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 "hasDamage":
out.HasDamage = bool(in.Bool())
case "mainFrameContentUpdated":
out.MainFrameContentUpdated = bool(in.Bool())
case "screenshotData":
out.ScreenshotData = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental5(out *jwriter.Writer, in BeginFrameReturns) {
out.RawByte('{')
first := true
_ = first
if in.HasDamage {
const prefix string = ",\"hasDamage\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Bool(bool(in.HasDamage))
}
if in.MainFrameContentUpdated {
const prefix string = ",\"mainFrameContentUpdated\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Bool(bool(in.MainFrameContentUpdated))
}
if in.ScreenshotData != "" {
const prefix string = ",\"screenshotData\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.ScreenshotData))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v BeginFrameReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v BeginFrameReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *BeginFrameReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *BeginFrameReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental6(in *jlexer.Lexer, out *BeginFrameParams) {
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 "frameTime":
if in.IsNull() {
in.Skip()
out.FrameTime = nil
} else {
if out.FrameTime == nil {
out.FrameTime = new(runtime.Timestamp)
}
(*out.FrameTime).UnmarshalEasyJSON(in)
}
case "deadline":
if in.IsNull() {
in.Skip()
out.Deadline = nil
} else {
if out.Deadline == nil {
out.Deadline = new(runtime.Timestamp)
}
(*out.Deadline).UnmarshalEasyJSON(in)
}
case "interval":
out.Interval = float64(in.Float64())
case "screenshot":
if in.IsNull() {
in.Skip()
out.Screenshot = nil
} else {
if out.Screenshot == nil {
out.Screenshot = new(ScreenshotParams)
}
(*out.Screenshot).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental6(out *jwriter.Writer, in BeginFrameParams) {
out.RawByte('{')
first := true
_ = first
if in.FrameTime != nil {
const prefix string = ",\"frameTime\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.FrameTime).MarshalEasyJSON(out)
}
if in.Deadline != nil {
const prefix string = ",\"deadline\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.Deadline).MarshalEasyJSON(out)
}
if in.Interval != 0 {
const prefix string = ",\"interval\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Float64(float64(in.Interval))
}
if in.Screenshot != nil {
const prefix string = ",\"screenshot\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.Screenshot).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v BeginFrameParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v BeginFrameParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpHeadlessexperimental6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *BeginFrameParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *BeginFrameParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpHeadlessexperimental6(l, v)
}

View File

@ -1,24 +0,0 @@
package headlessexperimental
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventMainFrameReadyForScreenshots issued when the main frame has first
// submitted a frame to the browser. May only be fired while a BeginFrame is in
// flight. Before this event, screenshotting requests may fail.
type EventMainFrameReadyForScreenshots struct{}
// EventNeedsBeginFramesChanged issued when the target starts or stops
// needing BeginFrames.
type EventNeedsBeginFramesChanged struct {
NeedsBeginFrames bool `json:"needsBeginFrames"` // True if BeginFrames are needed, false otherwise.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventHeadlessExperimentalMainFrameReadyForScreenshots,
cdp.EventHeadlessExperimentalNeedsBeginFramesChanged,
}

View File

@ -1,125 +0,0 @@
// Package headlessexperimental provides the Chrome Debugging Protocol
// commands, types, and events for the HeadlessExperimental domain.
//
// This domain provides experimental commands only supported in headless
// mode.
//
// Generated by the chromedp-gen command.
package headlessexperimental
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
"encoding/base64"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
)
// BeginFrameParams sends a BeginFrame to the target and returns when the
// frame was completed. Optionally captures a screenshot from the resulting
// frame. Requires that the target was created with enabled BeginFrameControl.
type BeginFrameParams struct {
FrameTime *runtime.Timestamp `json:"frameTime,omitempty"` // Timestamp of this BeginFrame (milliseconds since epoch). If not set, the current time will be used.
Deadline *runtime.Timestamp `json:"deadline,omitempty"` // Deadline of this BeginFrame (milliseconds since epoch). If not set, the deadline will be calculated from the frameTime and interval.
Interval float64 `json:"interval,omitempty"` // The interval between BeginFrames that is reported to the compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.
Screenshot *ScreenshotParams `json:"screenshot,omitempty"` // If set, a screenshot of the frame will be captured and returned in the response. Otherwise, no screenshot will be captured.
}
// BeginFrame sends a BeginFrame to the target and returns when the frame was
// completed. Optionally captures a screenshot from the resulting frame.
// Requires that the target was created with enabled BeginFrameControl.
//
// parameters:
func BeginFrame() *BeginFrameParams {
return &BeginFrameParams{}
}
// WithFrameTime timestamp of this BeginFrame (milliseconds since epoch). If
// not set, the current time will be used.
func (p BeginFrameParams) WithFrameTime(frameTime *runtime.Timestamp) *BeginFrameParams {
p.FrameTime = frameTime
return &p
}
// WithDeadline deadline of this BeginFrame (milliseconds since epoch). If
// not set, the deadline will be calculated from the frameTime and interval.
func (p BeginFrameParams) WithDeadline(deadline *runtime.Timestamp) *BeginFrameParams {
p.Deadline = deadline
return &p
}
// WithInterval the interval between BeginFrames that is reported to the
// compositor, in milliseconds. Defaults to a 60 frames/second interval, i.e.
// about 16.666 milliseconds.
func (p BeginFrameParams) WithInterval(interval float64) *BeginFrameParams {
p.Interval = interval
return &p
}
// WithScreenshot if set, a screenshot of the frame will be captured and
// returned in the response. Otherwise, no screenshot will be captured.
func (p BeginFrameParams) WithScreenshot(screenshot *ScreenshotParams) *BeginFrameParams {
p.Screenshot = screenshot
return &p
}
// BeginFrameReturns return values.
type BeginFrameReturns struct {
HasDamage bool `json:"hasDamage,omitempty"` // Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display.
MainFrameContentUpdated bool `json:"mainFrameContentUpdated,omitempty"` // Whether the main frame submitted a new display frame in response to this BeginFrame.
ScreenshotData string `json:"screenshotData,omitempty"` // Base64-encoded image data of the screenshot, if one was requested and successfully taken.
}
// Do executes HeadlessExperimental.beginFrame against the provided context and
// target handler.
//
// returns:
// hasDamage - Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the display.
// mainFrameContentUpdated - Whether the main frame submitted a new display frame in response to this BeginFrame.
// screenshotData - Base64-encoded image data of the screenshot, if one was requested and successfully taken.
func (p *BeginFrameParams) Do(ctxt context.Context, h cdp.Handler) (hasDamage bool, mainFrameContentUpdated bool, screenshotData []byte, err error) {
// execute
var res BeginFrameReturns
err = h.Execute(ctxt, cdp.CommandHeadlessExperimentalBeginFrame, p, &res)
if err != nil {
return false, false, nil, err
}
// decode
var dec []byte
dec, err = base64.StdEncoding.DecodeString(res.ScreenshotData)
if err != nil {
return false, false, nil, err
}
return res.HasDamage, res.MainFrameContentUpdated, dec, nil
}
// DisableParams disables headless events for the target.
type DisableParams struct{}
// Disable disables headless events for the target.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes HeadlessExperimental.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeadlessExperimentalDisable, nil, nil)
}
// EnableParams enables headless events for the target.
type EnableParams struct{}
// Enable enables headless events for the target.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes HeadlessExperimental.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeadlessExperimentalEnable, nil, nil)
}

View File

@ -1,59 +0,0 @@
package headlessexperimental
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// ScreenshotParams encoding options for a screenshot.
type ScreenshotParams struct {
Format ScreenshotParamsFormat `json:"format,omitempty"` // Image compression format (defaults to png).
Quality int64 `json:"quality,omitempty"` // Compression quality from range [0..100] (jpeg only).
}
// ScreenshotParamsFormat image compression format (defaults to png).
type ScreenshotParamsFormat string
// String returns the ScreenshotParamsFormat as string value.
func (t ScreenshotParamsFormat) String() string {
return string(t)
}
// ScreenshotParamsFormat values.
const (
ScreenshotParamsFormatJpeg ScreenshotParamsFormat = "jpeg"
ScreenshotParamsFormatPng ScreenshotParamsFormat = "png"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ScreenshotParamsFormat) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ScreenshotParamsFormat) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ScreenshotParamsFormat) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ScreenshotParamsFormat(in.String()) {
case ScreenshotParamsFormatJpeg:
*t = ScreenshotParamsFormatJpeg
case ScreenshotParamsFormatPng:
*t = ScreenshotParamsFormatPng
default:
in.AddError(errors.New("unknown ScreenshotParamsFormat value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ScreenshotParamsFormat) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,47 +0,0 @@
package heapprofiler
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventAddHeapSnapshotChunk [no description].
type EventAddHeapSnapshotChunk struct {
Chunk string `json:"chunk"`
}
// EventHeapStatsUpdate if heap objects tracking has been started then
// backend may send update for one or more fragments.
type EventHeapStatsUpdate struct {
StatsUpdate []int64 `json:"statsUpdate"` // An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment.
}
// EventLastSeenObjectID if heap objects tracking has been started then
// backend regularly sends a current value for last seen object id and
// corresponding timestamp. If the were changes in the heap since last event
// then one or more heapStatsUpdate events will be sent before a new
// lastSeenObjectId event.
type EventLastSeenObjectID struct {
LastSeenObjectID int64 `json:"lastSeenObjectId"`
Timestamp float64 `json:"timestamp"`
}
// EventReportHeapSnapshotProgress [no description].
type EventReportHeapSnapshotProgress struct {
Done int64 `json:"done"`
Total int64 `json:"total"`
Finished bool `json:"finished,omitempty"`
}
// EventResetProfiles [no description].
type EventResetProfiles struct{}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventHeapProfilerAddHeapSnapshotChunk,
cdp.EventHeapProfilerHeapStatsUpdate,
cdp.EventHeapProfilerLastSeenObjectID,
cdp.EventHeapProfilerReportHeapSnapshotProgress,
cdp.EventHeapProfilerResetProfiles,
}

View File

@ -1,316 +0,0 @@
// Package heapprofiler provides the Chrome Debugging Protocol
// commands, types, and events for the HeapProfiler domain.
//
// Generated by the chromedp-gen command.
package heapprofiler
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
)
// AddInspectedHeapObjectParams enables console to refer to the node with
// given id via $x (see Command Line API for more details $x functions).
type AddInspectedHeapObjectParams struct {
HeapObjectID HeapSnapshotObjectID `json:"heapObjectId"` // Heap snapshot object id to be accessible by means of $x command line API.
}
// AddInspectedHeapObject enables console to refer to the node with given id
// via $x (see Command Line API for more details $x functions).
//
// parameters:
// heapObjectID - Heap snapshot object id to be accessible by means of $x command line API.
func AddInspectedHeapObject(heapObjectID HeapSnapshotObjectID) *AddInspectedHeapObjectParams {
return &AddInspectedHeapObjectParams{
HeapObjectID: heapObjectID,
}
}
// Do executes HeapProfiler.addInspectedHeapObject against the provided context and
// target handler.
func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeapProfilerAddInspectedHeapObject, p, nil)
}
// CollectGarbageParams [no description].
type CollectGarbageParams struct{}
// CollectGarbage [no description].
func CollectGarbage() *CollectGarbageParams {
return &CollectGarbageParams{}
}
// Do executes HeapProfiler.collectGarbage against the provided context and
// target handler.
func (p *CollectGarbageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeapProfilerCollectGarbage, nil, nil)
}
// DisableParams [no description].
type DisableParams struct{}
// Disable [no description].
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes HeapProfiler.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeapProfilerDisable, nil, nil)
}
// EnableParams [no description].
type EnableParams struct{}
// Enable [no description].
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes HeapProfiler.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeapProfilerEnable, nil, nil)
}
// GetHeapObjectIDParams [no description].
type GetHeapObjectIDParams struct {
ObjectID runtime.RemoteObjectID `json:"objectId"` // Identifier of the object to get heap object id for.
}
// GetHeapObjectID [no description].
//
// parameters:
// objectID - Identifier of the object to get heap object id for.
func GetHeapObjectID(objectID runtime.RemoteObjectID) *GetHeapObjectIDParams {
return &GetHeapObjectIDParams{
ObjectID: objectID,
}
}
// GetHeapObjectIDReturns return values.
type GetHeapObjectIDReturns struct {
HeapSnapshotObjectID HeapSnapshotObjectID `json:"heapSnapshotObjectId,omitempty"` // Id of the heap snapshot object corresponding to the passed remote object id.
}
// Do executes HeapProfiler.getHeapObjectId against the provided context and
// target handler.
//
// returns:
// heapSnapshotObjectID - Id of the heap snapshot object corresponding to the passed remote object id.
func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h cdp.Handler) (heapSnapshotObjectID HeapSnapshotObjectID, err error) {
// execute
var res GetHeapObjectIDReturns
err = h.Execute(ctxt, cdp.CommandHeapProfilerGetHeapObjectID, p, &res)
if err != nil {
return "", err
}
return res.HeapSnapshotObjectID, nil
}
// GetObjectByHeapObjectIDParams [no description].
type GetObjectByHeapObjectIDParams struct {
ObjectID HeapSnapshotObjectID `json:"objectId"`
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release multiple objects.
}
// GetObjectByHeapObjectID [no description].
//
// parameters:
// objectID
func GetObjectByHeapObjectID(objectID HeapSnapshotObjectID) *GetObjectByHeapObjectIDParams {
return &GetObjectByHeapObjectIDParams{
ObjectID: objectID,
}
}
// WithObjectGroup symbolic group name that can be used to release multiple
// objects.
func (p GetObjectByHeapObjectIDParams) WithObjectGroup(objectGroup string) *GetObjectByHeapObjectIDParams {
p.ObjectGroup = objectGroup
return &p
}
// GetObjectByHeapObjectIDReturns return values.
type GetObjectByHeapObjectIDReturns struct {
Result *runtime.RemoteObject `json:"result,omitempty"` // Evaluation result.
}
// Do executes HeapProfiler.getObjectByHeapObjectId against the provided context and
// target handler.
//
// returns:
// result - Evaluation result.
func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h cdp.Handler) (result *runtime.RemoteObject, err error) {
// execute
var res GetObjectByHeapObjectIDReturns
err = h.Execute(ctxt, cdp.CommandHeapProfilerGetObjectByHeapObjectID, p, &res)
if err != nil {
return nil, err
}
return res.Result, nil
}
// GetSamplingProfileParams [no description].
type GetSamplingProfileParams struct{}
// GetSamplingProfile [no description].
func GetSamplingProfile() *GetSamplingProfileParams {
return &GetSamplingProfileParams{}
}
// GetSamplingProfileReturns return values.
type GetSamplingProfileReturns struct {
Profile *SamplingHeapProfile `json:"profile,omitempty"` // Return the sampling profile being collected.
}
// Do executes HeapProfiler.getSamplingProfile against the provided context and
// target handler.
//
// returns:
// profile - Return the sampling profile being collected.
func (p *GetSamplingProfileParams) Do(ctxt context.Context, h cdp.Handler) (profile *SamplingHeapProfile, err error) {
// execute
var res GetSamplingProfileReturns
err = h.Execute(ctxt, cdp.CommandHeapProfilerGetSamplingProfile, nil, &res)
if err != nil {
return nil, err
}
return res.Profile, nil
}
// StartSamplingParams [no description].
type StartSamplingParams struct {
SamplingInterval float64 `json:"samplingInterval,omitempty"` // Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.
}
// StartSampling [no description].
//
// parameters:
func StartSampling() *StartSamplingParams {
return &StartSamplingParams{}
}
// WithSamplingInterval average sample interval in bytes. Poisson
// distribution is used for the intervals. The default value is 32768 bytes.
func (p StartSamplingParams) WithSamplingInterval(samplingInterval float64) *StartSamplingParams {
p.SamplingInterval = samplingInterval
return &p
}
// Do executes HeapProfiler.startSampling against the provided context and
// target handler.
func (p *StartSamplingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeapProfilerStartSampling, p, nil)
}
// StartTrackingHeapObjectsParams [no description].
type StartTrackingHeapObjectsParams struct {
TrackAllocations bool `json:"trackAllocations,omitempty"`
}
// StartTrackingHeapObjects [no description].
//
// parameters:
func StartTrackingHeapObjects() *StartTrackingHeapObjectsParams {
return &StartTrackingHeapObjectsParams{}
}
// WithTrackAllocations [no description].
func (p StartTrackingHeapObjectsParams) WithTrackAllocations(trackAllocations bool) *StartTrackingHeapObjectsParams {
p.TrackAllocations = trackAllocations
return &p
}
// Do executes HeapProfiler.startTrackingHeapObjects against the provided context and
// target handler.
func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeapProfilerStartTrackingHeapObjects, p, nil)
}
// StopSamplingParams [no description].
type StopSamplingParams struct{}
// StopSampling [no description].
func StopSampling() *StopSamplingParams {
return &StopSamplingParams{}
}
// StopSamplingReturns return values.
type StopSamplingReturns struct {
Profile *SamplingHeapProfile `json:"profile,omitempty"` // Recorded sampling heap profile.
}
// Do executes HeapProfiler.stopSampling against the provided context and
// target handler.
//
// returns:
// profile - Recorded sampling heap profile.
func (p *StopSamplingParams) Do(ctxt context.Context, h cdp.Handler) (profile *SamplingHeapProfile, err error) {
// execute
var res StopSamplingReturns
err = h.Execute(ctxt, cdp.CommandHeapProfilerStopSampling, nil, &res)
if err != nil {
return nil, err
}
return res.Profile, nil
}
// StopTrackingHeapObjectsParams [no description].
type StopTrackingHeapObjectsParams struct {
ReportProgress bool `json:"reportProgress,omitempty"` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped.
}
// StopTrackingHeapObjects [no description].
//
// parameters:
func StopTrackingHeapObjects() *StopTrackingHeapObjectsParams {
return &StopTrackingHeapObjectsParams{}
}
// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken when the tracking is stopped.
func (p StopTrackingHeapObjectsParams) WithReportProgress(reportProgress bool) *StopTrackingHeapObjectsParams {
p.ReportProgress = reportProgress
return &p
}
// Do executes HeapProfiler.stopTrackingHeapObjects against the provided context and
// target handler.
func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeapProfilerStopTrackingHeapObjects, p, nil)
}
// TakeHeapSnapshotParams [no description].
type TakeHeapSnapshotParams struct {
ReportProgress bool `json:"reportProgress,omitempty"` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
}
// TakeHeapSnapshot [no description].
//
// parameters:
func TakeHeapSnapshot() *TakeHeapSnapshotParams {
return &TakeHeapSnapshotParams{}
}
// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken.
func (p TakeHeapSnapshotParams) WithReportProgress(reportProgress bool) *TakeHeapSnapshotParams {
p.ReportProgress = reportProgress
return &p
}
// Do executes HeapProfiler.takeHeapSnapshot against the provided context and
// target handler.
func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandHeapProfilerTakeHeapSnapshot, p, nil)
}

View File

@ -1,26 +0,0 @@
package heapprofiler
import "github.com/knq/chromedp/cdp/runtime"
// Code generated by chromedp-gen. DO NOT EDIT.
// HeapSnapshotObjectID heap snapshot object id.
type HeapSnapshotObjectID string
// String returns the HeapSnapshotObjectID as string value.
func (t HeapSnapshotObjectID) String() string {
return string(t)
}
// SamplingHeapProfileNode sampling Heap Profile node. Holds callsite
// information, allocation statistics and child nodes.
type SamplingHeapProfileNode struct {
CallFrame *runtime.CallFrame `json:"callFrame"` // Function location.
SelfSize float64 `json:"selfSize"` // Allocations size in bytes for the node excluding children.
Children []*SamplingHeapProfileNode `json:"children"` // Child nodes.
}
// SamplingHeapProfile Profile.
type SamplingHeapProfile struct {
Head *SamplingHeapProfileNode `json:"head"`
}

File diff suppressed because it is too large Load Diff

View File

@ -1,259 +0,0 @@
// Package indexeddb provides the Chrome Debugging Protocol
// commands, types, and events for the IndexedDB domain.
//
// Generated by the chromedp-gen command.
package indexeddb
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// ClearObjectStoreParams clears all entries from an object store.
type ClearObjectStoreParams struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin.
DatabaseName string `json:"databaseName"` // Database name.
ObjectStoreName string `json:"objectStoreName"` // Object store name.
}
// ClearObjectStore clears all entries from an object store.
//
// parameters:
// securityOrigin - Security origin.
// databaseName - Database name.
// objectStoreName - Object store name.
func ClearObjectStore(securityOrigin string, databaseName string, objectStoreName string) *ClearObjectStoreParams {
return &ClearObjectStoreParams{
SecurityOrigin: securityOrigin,
DatabaseName: databaseName,
ObjectStoreName: objectStoreName,
}
}
// Do executes IndexedDB.clearObjectStore against the provided context and
// target handler.
func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandIndexedDBClearObjectStore, p, nil)
}
// DeleteDatabaseParams deletes a database.
type DeleteDatabaseParams struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin.
DatabaseName string `json:"databaseName"` // Database name.
}
// DeleteDatabase deletes a database.
//
// parameters:
// securityOrigin - Security origin.
// databaseName - Database name.
func DeleteDatabase(securityOrigin string, databaseName string) *DeleteDatabaseParams {
return &DeleteDatabaseParams{
SecurityOrigin: securityOrigin,
DatabaseName: databaseName,
}
}
// Do executes IndexedDB.deleteDatabase against the provided context and
// target handler.
func (p *DeleteDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandIndexedDBDeleteDatabase, p, nil)
}
// DeleteObjectStoreEntriesParams delete a range of entries from an object
// store.
type DeleteObjectStoreEntriesParams struct {
SecurityOrigin string `json:"securityOrigin"`
DatabaseName string `json:"databaseName"`
ObjectStoreName string `json:"objectStoreName"`
KeyRange *KeyRange `json:"keyRange"` // Range of entry keys to delete
}
// DeleteObjectStoreEntries delete a range of entries from an object store.
//
// parameters:
// securityOrigin
// databaseName
// objectStoreName
// keyRange - Range of entry keys to delete
func DeleteObjectStoreEntries(securityOrigin string, databaseName string, objectStoreName string, keyRange *KeyRange) *DeleteObjectStoreEntriesParams {
return &DeleteObjectStoreEntriesParams{
SecurityOrigin: securityOrigin,
DatabaseName: databaseName,
ObjectStoreName: objectStoreName,
KeyRange: keyRange,
}
}
// Do executes IndexedDB.deleteObjectStoreEntries against the provided context and
// target handler.
func (p *DeleteObjectStoreEntriesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandIndexedDBDeleteObjectStoreEntries, p, nil)
}
// DisableParams disables events from backend.
type DisableParams struct{}
// Disable disables events from backend.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes IndexedDB.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandIndexedDBDisable, nil, nil)
}
// EnableParams enables events from backend.
type EnableParams struct{}
// Enable enables events from backend.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes IndexedDB.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandIndexedDBEnable, nil, nil)
}
// RequestDataParams requests data from object store or index.
type RequestDataParams struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin.
DatabaseName string `json:"databaseName"` // Database name.
ObjectStoreName string `json:"objectStoreName"` // Object store name.
IndexName string `json:"indexName"` // Index name, empty string for object store data requests.
SkipCount int64 `json:"skipCount"` // Number of records to skip.
PageSize int64 `json:"pageSize"` // Number of records to fetch.
KeyRange *KeyRange `json:"keyRange,omitempty"` // Key range.
}
// RequestData requests data from object store or index.
//
// parameters:
// securityOrigin - Security origin.
// databaseName - Database name.
// objectStoreName - Object store name.
// indexName - Index name, empty string for object store data requests.
// skipCount - Number of records to skip.
// pageSize - Number of records to fetch.
func RequestData(securityOrigin string, databaseName string, objectStoreName string, indexName string, skipCount int64, pageSize int64) *RequestDataParams {
return &RequestDataParams{
SecurityOrigin: securityOrigin,
DatabaseName: databaseName,
ObjectStoreName: objectStoreName,
IndexName: indexName,
SkipCount: skipCount,
PageSize: pageSize,
}
}
// WithKeyRange key range.
func (p RequestDataParams) WithKeyRange(keyRange *KeyRange) *RequestDataParams {
p.KeyRange = keyRange
return &p
}
// RequestDataReturns return values.
type RequestDataReturns struct {
ObjectStoreDataEntries []*DataEntry `json:"objectStoreDataEntries,omitempty"` // Array of object store data entries.
HasMore bool `json:"hasMore,omitempty"` // If true, there are more entries to fetch in the given range.
}
// Do executes IndexedDB.requestData against the provided context and
// target handler.
//
// returns:
// objectStoreDataEntries - Array of object store data entries.
// hasMore - If true, there are more entries to fetch in the given range.
func (p *RequestDataParams) Do(ctxt context.Context, h cdp.Handler) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
// execute
var res RequestDataReturns
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestData, p, &res)
if err != nil {
return nil, false, err
}
return res.ObjectStoreDataEntries, res.HasMore, nil
}
// RequestDatabaseParams requests database with given name in given frame.
type RequestDatabaseParams struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin.
DatabaseName string `json:"databaseName"` // Database name.
}
// RequestDatabase requests database with given name in given frame.
//
// parameters:
// securityOrigin - Security origin.
// databaseName - Database name.
func RequestDatabase(securityOrigin string, databaseName string) *RequestDatabaseParams {
return &RequestDatabaseParams{
SecurityOrigin: securityOrigin,
DatabaseName: databaseName,
}
}
// RequestDatabaseReturns return values.
type RequestDatabaseReturns struct {
DatabaseWithObjectStores *DatabaseWithObjectStores `json:"databaseWithObjectStores,omitempty"` // Database with an array of object stores.
}
// Do executes IndexedDB.requestDatabase against the provided context and
// target handler.
//
// returns:
// databaseWithObjectStores - Database with an array of object stores.
func (p *RequestDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
// execute
var res RequestDatabaseReturns
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabase, p, &res)
if err != nil {
return nil, err
}
return res.DatabaseWithObjectStores, nil
}
// RequestDatabaseNamesParams requests database names for given security
// origin.
type RequestDatabaseNamesParams struct {
SecurityOrigin string `json:"securityOrigin"` // Security origin.
}
// RequestDatabaseNames requests database names for given security origin.
//
// parameters:
// securityOrigin - Security origin.
func RequestDatabaseNames(securityOrigin string) *RequestDatabaseNamesParams {
return &RequestDatabaseNamesParams{
SecurityOrigin: securityOrigin,
}
}
// RequestDatabaseNamesReturns return values.
type RequestDatabaseNamesReturns struct {
DatabaseNames []string `json:"databaseNames,omitempty"` // Database names for origin.
}
// Do executes IndexedDB.requestDatabaseNames against the provided context and
// target handler.
//
// returns:
// databaseNames - Database names for origin.
func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h cdp.Handler) (databaseNames []string, err error) {
// execute
var res RequestDatabaseNamesReturns
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabaseNames, p, &res)
if err != nil {
return nil, err
}
return res.DatabaseNames, nil
}

View File

@ -1,159 +0,0 @@
package indexeddb
import (
"errors"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// DatabaseWithObjectStores database with an array of object stores.
type DatabaseWithObjectStores struct {
Name string `json:"name"` // Database name.
Version int64 `json:"version"` // Database version.
ObjectStores []*ObjectStore `json:"objectStores"` // Object stores in this database.
}
// ObjectStore object store.
type ObjectStore struct {
Name string `json:"name"` // Object store name.
KeyPath *KeyPath `json:"keyPath"` // Object store key path.
AutoIncrement bool `json:"autoIncrement"` // If true, object store has auto increment flag set.
Indexes []*ObjectStoreIndex `json:"indexes"` // Indexes in this object store.
}
// ObjectStoreIndex object store index.
type ObjectStoreIndex struct {
Name string `json:"name"` // Index name.
KeyPath *KeyPath `json:"keyPath"` // Index key path.
Unique bool `json:"unique"` // If true, index is unique.
MultiEntry bool `json:"multiEntry"` // If true, index allows multiple entries for a key.
}
// Key Key.
type Key struct {
Type KeyType `json:"type"` // Key type.
Number float64 `json:"number,omitempty"` // Number value.
String string `json:"string,omitempty"` // String value.
Date float64 `json:"date,omitempty"` // Date value.
Array []*Key `json:"array,omitempty"` // Array value.
}
// KeyRange key range.
type KeyRange struct {
Lower *Key `json:"lower,omitempty"` // Lower bound.
Upper *Key `json:"upper,omitempty"` // Upper bound.
LowerOpen bool `json:"lowerOpen"` // If true lower bound is open.
UpperOpen bool `json:"upperOpen"` // If true upper bound is open.
}
// DataEntry data entry.
type DataEntry struct {
Key *runtime.RemoteObject `json:"key"` // Key object.
PrimaryKey *runtime.RemoteObject `json:"primaryKey"` // Primary key object.
Value *runtime.RemoteObject `json:"value"` // Value object.
}
// KeyPath key path.
type KeyPath struct {
Type KeyPathType `json:"type"` // Key path type.
String string `json:"string,omitempty"` // String value.
Array []string `json:"array,omitempty"` // Array value.
}
// KeyType key type.
type KeyType string
// String returns the KeyType as string value.
func (t KeyType) String() string {
return string(t)
}
// KeyType values.
const (
KeyTypeNumber KeyType = "number"
KeyTypeString KeyType = "string"
KeyTypeDate KeyType = "date"
KeyTypeArray KeyType = "array"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t KeyType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t KeyType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *KeyType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch KeyType(in.String()) {
case KeyTypeNumber:
*t = KeyTypeNumber
case KeyTypeString:
*t = KeyTypeString
case KeyTypeDate:
*t = KeyTypeDate
case KeyTypeArray:
*t = KeyTypeArray
default:
in.AddError(errors.New("unknown KeyType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *KeyType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// KeyPathType key path type.
type KeyPathType string
// String returns the KeyPathType as string value.
func (t KeyPathType) String() string {
return string(t)
}
// KeyPathType values.
const (
KeyPathTypeNull KeyPathType = "null"
KeyPathTypeString KeyPathType = "string"
KeyPathTypeArray KeyPathType = "array"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t KeyPathType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t KeyPathType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *KeyPathType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch KeyPathType(in.String()) {
case KeyPathTypeNull:
*t = KeyPathTypeNull
case KeyPathTypeString:
*t = KeyPathTypeString
case KeyPathTypeArray:
*t = KeyPathTypeArray
default:
in.AddError(errors.New("unknown KeyPathType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *KeyPathType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,529 +0,0 @@
// Package input provides the Chrome Debugging Protocol
// commands, types, and events for the Input domain.
//
// Generated by the chromedp-gen command.
package input
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// DispatchKeyEventParams dispatches a key event to the page.
type DispatchKeyEventParams struct {
Type KeyType `json:"type"` // Type of the key event.
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.
Text string `json:"text,omitempty"` // Text as generated by processing a virtual key code with a keyboard layout. Not needed for for keyUp and rawKeyDown events (default: "")
UnmodifiedText string `json:"unmodifiedText,omitempty"` // Text that would have been generated by the keyboard if no modifiers were pressed (except for shift). Useful for shortcut (accelerator) key handling (default: "").
KeyIdentifier string `json:"keyIdentifier,omitempty"` // Unique key identifier (e.g., 'U+0041') (default: "").
Code string `json:"code,omitempty"` // Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
Key string `json:"key,omitempty"` // Unique DOM defined string value describing the meaning of the key in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
WindowsVirtualKeyCode int64 `json:"windowsVirtualKeyCode,omitempty"` // Windows virtual key code (default: 0).
NativeVirtualKeyCode int64 `json:"nativeVirtualKeyCode,omitempty"` // Native virtual key code (default: 0).
AutoRepeat bool `json:"autoRepeat,omitempty"` // Whether the event was generated from auto repeat (default: false).
IsKeypad bool `json:"isKeypad,omitempty"` // Whether the event was generated from the keypad (default: false).
IsSystemKey bool `json:"isSystemKey,omitempty"` // Whether the event was a system key event (default: false).
Location int64 `json:"location,omitempty"` // Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: 0).
}
// DispatchKeyEvent dispatches a key event to the page.
//
// parameters:
// type - Type of the key event.
func DispatchKeyEvent(typeVal KeyType) *DispatchKeyEventParams {
return &DispatchKeyEventParams{
Type: typeVal,
}
}
// WithModifiers bit field representing pressed modifier keys. Alt=1, Ctrl=2,
// Meta/Command=4, Shift=8 (default: 0).
func (p DispatchKeyEventParams) WithModifiers(modifiers Modifier) *DispatchKeyEventParams {
p.Modifiers = modifiers
return &p
}
// WithTimestamp time at which the event occurred.
func (p DispatchKeyEventParams) WithTimestamp(timestamp *TimeSinceEpoch) *DispatchKeyEventParams {
p.Timestamp = timestamp
return &p
}
// WithText text as generated by processing a virtual key code with a
// keyboard layout. Not needed for for keyUp and rawKeyDown events (default:
// "").
func (p DispatchKeyEventParams) WithText(text string) *DispatchKeyEventParams {
p.Text = text
return &p
}
// WithUnmodifiedText text that would have been generated by the keyboard if
// no modifiers were pressed (except for shift). Useful for shortcut
// (accelerator) key handling (default: "").
func (p DispatchKeyEventParams) WithUnmodifiedText(unmodifiedText string) *DispatchKeyEventParams {
p.UnmodifiedText = unmodifiedText
return &p
}
// WithKeyIdentifier unique key identifier (e.g., 'U+0041') (default: "").
func (p DispatchKeyEventParams) WithKeyIdentifier(keyIdentifier string) *DispatchKeyEventParams {
p.KeyIdentifier = keyIdentifier
return &p
}
// WithCode unique DOM defined string value for each physical key (e.g.,
// 'KeyA') (default: "").
func (p DispatchKeyEventParams) WithCode(code string) *DispatchKeyEventParams {
p.Code = code
return &p
}
// WithKey unique DOM defined string value describing the meaning of the key
// in the context of active modifiers, keyboard layout, etc (e.g., 'AltGr')
// (default: "").
func (p DispatchKeyEventParams) WithKey(key string) *DispatchKeyEventParams {
p.Key = key
return &p
}
// WithWindowsVirtualKeyCode windows virtual key code (default: 0).
func (p DispatchKeyEventParams) WithWindowsVirtualKeyCode(windowsVirtualKeyCode int64) *DispatchKeyEventParams {
p.WindowsVirtualKeyCode = windowsVirtualKeyCode
return &p
}
// WithNativeVirtualKeyCode native virtual key code (default: 0).
func (p DispatchKeyEventParams) WithNativeVirtualKeyCode(nativeVirtualKeyCode int64) *DispatchKeyEventParams {
p.NativeVirtualKeyCode = nativeVirtualKeyCode
return &p
}
// WithAutoRepeat whether the event was generated from auto repeat (default:
// false).
func (p DispatchKeyEventParams) WithAutoRepeat(autoRepeat bool) *DispatchKeyEventParams {
p.AutoRepeat = autoRepeat
return &p
}
// WithIsKeypad whether the event was generated from the keypad (default:
// false).
func (p DispatchKeyEventParams) WithIsKeypad(isKeypad bool) *DispatchKeyEventParams {
p.IsKeypad = isKeypad
return &p
}
// WithIsSystemKey whether the event was a system key event (default: false).
func (p DispatchKeyEventParams) WithIsSystemKey(isSystemKey bool) *DispatchKeyEventParams {
p.IsSystemKey = isSystemKey
return &p
}
// WithLocation whether the event was from the left or right side of the
// keyboard. 1=Left, 2=Right (default: 0).
func (p DispatchKeyEventParams) WithLocation(location int64) *DispatchKeyEventParams {
p.Location = location
return &p
}
// Do executes Input.dispatchKeyEvent against the provided context and
// target handler.
func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInputDispatchKeyEvent, p, nil)
}
// DispatchMouseEventParams dispatches a mouse event to the page.
type DispatchMouseEventParams struct {
Type MouseType `json:"type"` // Type of the mouse event.
X float64 `json:"x"` // X coordinate of the event relative to the main frame's viewport in CSS pixels.
Y float64 `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.
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.
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.
//
// parameters:
// type - Type of the mouse event.
// x - X coordinate of the event relative to the main frame's viewport in CSS pixels.
// 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.
func DispatchMouseEvent(typeVal MouseType, x float64, y float64) *DispatchMouseEventParams {
return &DispatchMouseEventParams{
Type: typeVal,
X: x,
Y: y,
}
}
// WithModifiers bit field representing pressed modifier keys. Alt=1, Ctrl=2,
// Meta/Command=4, Shift=8 (default: 0).
func (p DispatchMouseEventParams) WithModifiers(modifiers Modifier) *DispatchMouseEventParams {
p.Modifiers = modifiers
return &p
}
// WithTimestamp time at which the event occurred.
func (p DispatchMouseEventParams) WithTimestamp(timestamp *TimeSinceEpoch) *DispatchMouseEventParams {
p.Timestamp = timestamp
return &p
}
// WithButton mouse button (default: "none").
func (p DispatchMouseEventParams) WithButton(button ButtonType) *DispatchMouseEventParams {
p.Button = button
return &p
}
// WithClickCount number of times the mouse button was clicked (default: 0).
func (p DispatchMouseEventParams) WithClickCount(clickCount int64) *DispatchMouseEventParams {
p.ClickCount = clickCount
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) {
return h.Execute(ctxt, cdp.CommandInputDispatchMouseEvent, p, nil)
}
// DispatchTouchEventParams dispatches a touch event to the page.
type DispatchTouchEventParams struct {
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.
}
// DispatchTouchEvent dispatches a touch event to the page.
//
// parameters:
// 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,
TouchPoints: touchPoints,
}
}
// WithModifiers bit field representing pressed modifier keys. Alt=1, Ctrl=2,
// Meta/Command=4, Shift=8 (default: 0).
func (p DispatchTouchEventParams) WithModifiers(modifiers Modifier) *DispatchTouchEventParams {
p.Modifiers = modifiers
return &p
}
// WithTimestamp time at which the event occurred.
func (p DispatchTouchEventParams) WithTimestamp(timestamp *TimeSinceEpoch) *DispatchTouchEventParams {
p.Timestamp = timestamp
return &p
}
// Do executes Input.dispatchTouchEvent against the provided context and
// target handler.
func (p *DispatchTouchEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInputDispatchTouchEvent, p, nil)
}
// EmulateTouchFromMouseEventParams emulates touch event from the mouse event
// parameters.
type EmulateTouchFromMouseEventParams struct {
Type MouseType `json:"type"` // Type of the mouse event.
X int64 `json:"x"` // X coordinate of the mouse pointer in DIP.
Y int64 `json:"y"` // Y coordinate of the mouse pointer in DIP.
Timestamp *TimeSinceEpoch `json:"timestamp"` // Time at which the event occurred.
Button ButtonType `json:"button"` // Mouse button.
DeltaX float64 `json:"deltaX,omitempty"` // X delta in DIP for mouse wheel event (default: 0).
DeltaY float64 `json:"deltaY,omitempty"` // Y delta in DIP for mouse wheel event (default: 0).
Modifiers Modifier `json:"modifiers,omitempty"` // Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 (default: 0).
ClickCount int64 `json:"clickCount,omitempty"` // Number of times the mouse button was clicked (default: 0).
}
// EmulateTouchFromMouseEvent emulates touch event from the mouse event
// parameters.
//
// parameters:
// type - Type of the mouse event.
// x - X coordinate of the mouse pointer in DIP.
// y - Y coordinate of the mouse pointer in DIP.
// timestamp - Time at which the event occurred.
// button - Mouse button.
func EmulateTouchFromMouseEvent(typeVal MouseType, x int64, y int64, timestamp *TimeSinceEpoch, button ButtonType) *EmulateTouchFromMouseEventParams {
return &EmulateTouchFromMouseEventParams{
Type: typeVal,
X: x,
Y: y,
Timestamp: timestamp,
Button: button,
}
}
// WithDeltaX X delta in DIP for mouse wheel event (default: 0).
func (p EmulateTouchFromMouseEventParams) WithDeltaX(deltaX float64) *EmulateTouchFromMouseEventParams {
p.DeltaX = deltaX
return &p
}
// WithDeltaY Y delta in DIP for mouse wheel event (default: 0).
func (p EmulateTouchFromMouseEventParams) WithDeltaY(deltaY float64) *EmulateTouchFromMouseEventParams {
p.DeltaY = deltaY
return &p
}
// WithModifiers bit field representing pressed modifier keys. Alt=1, Ctrl=2,
// Meta/Command=4, Shift=8 (default: 0).
func (p EmulateTouchFromMouseEventParams) WithModifiers(modifiers Modifier) *EmulateTouchFromMouseEventParams {
p.Modifiers = modifiers
return &p
}
// WithClickCount number of times the mouse button was clicked (default: 0).
func (p EmulateTouchFromMouseEventParams) WithClickCount(clickCount int64) *EmulateTouchFromMouseEventParams {
p.ClickCount = clickCount
return &p
}
// Do executes Input.emulateTouchFromMouseEvent against the provided context and
// target handler.
func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInputEmulateTouchFromMouseEvent, p, nil)
}
// SetIgnoreInputEventsParams ignores input events (useful while auditing
// page).
type SetIgnoreInputEventsParams struct {
Ignore bool `json:"ignore"` // Ignores input events processing when set to true.
}
// SetIgnoreInputEvents ignores input events (useful while auditing page).
//
// parameters:
// ignore - Ignores input events processing when set to true.
func SetIgnoreInputEvents(ignore bool) *SetIgnoreInputEventsParams {
return &SetIgnoreInputEventsParams{
Ignore: ignore,
}
}
// Do executes Input.setIgnoreInputEvents against the provided context and
// target handler.
func (p *SetIgnoreInputEventsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInputSetIgnoreInputEvents, p, nil)
}
// SynthesizePinchGestureParams synthesizes a pinch gesture over a time
// period by issuing appropriate touch events.
type SynthesizePinchGestureParams struct {
X float64 `json:"x"` // X coordinate of the start of the gesture in CSS pixels.
Y float64 `json:"y"` // Y coordinate of the start of the gesture in CSS pixels.
ScaleFactor float64 `json:"scaleFactor"` // Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).
RelativeSpeed int64 `json:"relativeSpeed,omitempty"` // Relative pointer speed in pixels per second (default: 800).
GestureSourceType GestureType `json:"gestureSourceType,omitempty"` // Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
}
// SynthesizePinchGesture synthesizes a pinch gesture over a time period by
// issuing appropriate touch events.
//
// parameters:
// x - X coordinate of the start of the gesture in CSS pixels.
// y - Y coordinate of the start of the gesture in CSS pixels.
// scaleFactor - Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out).
func SynthesizePinchGesture(x float64, y float64, scaleFactor float64) *SynthesizePinchGestureParams {
return &SynthesizePinchGestureParams{
X: x,
Y: y,
ScaleFactor: scaleFactor,
}
}
// WithRelativeSpeed relative pointer speed in pixels per second (default:
// 800).
func (p SynthesizePinchGestureParams) WithRelativeSpeed(relativeSpeed int64) *SynthesizePinchGestureParams {
p.RelativeSpeed = relativeSpeed
return &p
}
// WithGestureSourceType which type of input events to be generated (default:
// 'default', which queries the platform for the preferred input type).
func (p SynthesizePinchGestureParams) WithGestureSourceType(gestureSourceType GestureType) *SynthesizePinchGestureParams {
p.GestureSourceType = gestureSourceType
return &p
}
// Do executes Input.synthesizePinchGesture against the provided context and
// target handler.
func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInputSynthesizePinchGesture, p, nil)
}
// SynthesizeScrollGestureParams synthesizes a scroll gesture over a time
// period by issuing appropriate touch events.
type SynthesizeScrollGestureParams struct {
X float64 `json:"x"` // X coordinate of the start of the gesture in CSS pixels.
Y float64 `json:"y"` // Y coordinate of the start of the gesture in CSS pixels.
XDistance float64 `json:"xDistance,omitempty"` // The distance to scroll along the X axis (positive to scroll left).
YDistance float64 `json:"yDistance,omitempty"` // The distance to scroll along the Y axis (positive to scroll up).
XOverscroll float64 `json:"xOverscroll,omitempty"` // The number of additional pixels to scroll back along the X axis, in addition to the given distance.
YOverscroll float64 `json:"yOverscroll,omitempty"` // The number of additional pixels to scroll back along the Y axis, in addition to the given distance.
PreventFling bool `json:"preventFling,omitempty"` // Prevent fling (default: true).
Speed int64 `json:"speed,omitempty"` // Swipe speed in pixels per second (default: 800).
GestureSourceType GestureType `json:"gestureSourceType,omitempty"` // Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
RepeatCount int64 `json:"repeatCount,omitempty"` // The number of times to repeat the gesture (default: 0).
RepeatDelayMs int64 `json:"repeatDelayMs,omitempty"` // The number of milliseconds delay between each repeat. (default: 250).
InteractionMarkerName string `json:"interactionMarkerName,omitempty"` // The name of the interaction markers to generate, if not empty (default: "").
}
// SynthesizeScrollGesture synthesizes a scroll gesture over a time period by
// issuing appropriate touch events.
//
// parameters:
// x - X coordinate of the start of the gesture in CSS pixels.
// y - Y coordinate of the start of the gesture in CSS pixels.
func SynthesizeScrollGesture(x float64, y float64) *SynthesizeScrollGestureParams {
return &SynthesizeScrollGestureParams{
X: x,
Y: y,
}
}
// WithXDistance the distance to scroll along the X axis (positive to scroll
// left).
func (p SynthesizeScrollGestureParams) WithXDistance(xDistance float64) *SynthesizeScrollGestureParams {
p.XDistance = xDistance
return &p
}
// WithYDistance the distance to scroll along the Y axis (positive to scroll
// up).
func (p SynthesizeScrollGestureParams) WithYDistance(yDistance float64) *SynthesizeScrollGestureParams {
p.YDistance = yDistance
return &p
}
// WithXOverscroll the number of additional pixels to scroll back along the X
// axis, in addition to the given distance.
func (p SynthesizeScrollGestureParams) WithXOverscroll(xOverscroll float64) *SynthesizeScrollGestureParams {
p.XOverscroll = xOverscroll
return &p
}
// WithYOverscroll the number of additional pixels to scroll back along the Y
// axis, in addition to the given distance.
func (p SynthesizeScrollGestureParams) WithYOverscroll(yOverscroll float64) *SynthesizeScrollGestureParams {
p.YOverscroll = yOverscroll
return &p
}
// WithPreventFling prevent fling (default: true).
func (p SynthesizeScrollGestureParams) WithPreventFling(preventFling bool) *SynthesizeScrollGestureParams {
p.PreventFling = preventFling
return &p
}
// WithSpeed swipe speed in pixels per second (default: 800).
func (p SynthesizeScrollGestureParams) WithSpeed(speed int64) *SynthesizeScrollGestureParams {
p.Speed = speed
return &p
}
// WithGestureSourceType which type of input events to be generated (default:
// 'default', which queries the platform for the preferred input type).
func (p SynthesizeScrollGestureParams) WithGestureSourceType(gestureSourceType GestureType) *SynthesizeScrollGestureParams {
p.GestureSourceType = gestureSourceType
return &p
}
// WithRepeatCount the number of times to repeat the gesture (default: 0).
func (p SynthesizeScrollGestureParams) WithRepeatCount(repeatCount int64) *SynthesizeScrollGestureParams {
p.RepeatCount = repeatCount
return &p
}
// WithRepeatDelayMs the number of milliseconds delay between each repeat.
// (default: 250).
func (p SynthesizeScrollGestureParams) WithRepeatDelayMs(repeatDelayMs int64) *SynthesizeScrollGestureParams {
p.RepeatDelayMs = repeatDelayMs
return &p
}
// WithInteractionMarkerName the name of the interaction markers to generate,
// if not empty (default: "").
func (p SynthesizeScrollGestureParams) WithInteractionMarkerName(interactionMarkerName string) *SynthesizeScrollGestureParams {
p.InteractionMarkerName = interactionMarkerName
return &p
}
// Do executes Input.synthesizeScrollGesture against the provided context and
// target handler.
func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInputSynthesizeScrollGesture, p, nil)
}
// SynthesizeTapGestureParams synthesizes a tap gesture over a time period by
// issuing appropriate touch events.
type SynthesizeTapGestureParams struct {
X float64 `json:"x"` // X coordinate of the start of the gesture in CSS pixels.
Y float64 `json:"y"` // Y coordinate of the start of the gesture in CSS pixels.
Duration int64 `json:"duration,omitempty"` // Duration between touchdown and touchup events in ms (default: 50).
TapCount int64 `json:"tapCount,omitempty"` // Number of times to perform the tap (e.g. 2 for double tap, default: 1).
GestureSourceType GestureType `json:"gestureSourceType,omitempty"` // Which type of input events to be generated (default: 'default', which queries the platform for the preferred input type).
}
// SynthesizeTapGesture synthesizes a tap gesture over a time period by
// issuing appropriate touch events.
//
// parameters:
// x - X coordinate of the start of the gesture in CSS pixels.
// y - Y coordinate of the start of the gesture in CSS pixels.
func SynthesizeTapGesture(x float64, y float64) *SynthesizeTapGestureParams {
return &SynthesizeTapGestureParams{
X: x,
Y: y,
}
}
// WithDuration duration between touchdown and touchup events in ms (default:
// 50).
func (p SynthesizeTapGestureParams) WithDuration(duration int64) *SynthesizeTapGestureParams {
p.Duration = duration
return &p
}
// WithTapCount number of times to perform the tap (e.g. 2 for double tap,
// default: 1).
func (p SynthesizeTapGestureParams) WithTapCount(tapCount int64) *SynthesizeTapGestureParams {
p.TapCount = tapCount
return &p
}
// WithGestureSourceType which type of input events to be generated (default:
// 'default', which queries the platform for the preferred input type).
func (p SynthesizeTapGestureParams) WithGestureSourceType(gestureSourceType GestureType) *SynthesizeTapGestureParams {
p.GestureSourceType = gestureSourceType
return &p
}
// Do executes Input.synthesizeTapGesture against the provided context and
// target handler.
func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInputSynthesizeTapGesture, p, nil)
}

View File

@ -1,367 +0,0 @@
package input
import (
"errors"
"fmt"
"strconv"
"time"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// TouchPoint [no description].
type TouchPoint struct {
X float64 `json:"x"` // X coordinate of the event relative to the main frame's viewport in CSS pixels.
Y float64 `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 float64 `json:"radiusX,omitempty"` // X radius of the touch area (default: 1.0).
RadiusY float64 `json:"radiusY,omitempty"` // Y radius of the touch area (default: 1.0).
RotationAngle float64 `json:"rotationAngle,omitempty"` // Rotation angle (default: 0.0).
Force float64 `json:"force,omitempty"` // Force (default: 1.0).
ID float64 `json:"id,omitempty"` // Identifier used to track touch sources between events, must be unique within an event.
}
// GestureType [no description].
type GestureType string
// String returns the GestureType as string value.
func (t GestureType) String() string {
return string(t)
}
// GestureType values.
const (
GestureDefault GestureType = "default"
GestureTouch GestureType = "touch"
GestureMouse GestureType = "mouse"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t GestureType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t GestureType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *GestureType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch GestureType(in.String()) {
case GestureDefault:
*t = GestureDefault
case GestureTouch:
*t = GestureTouch
case GestureMouse:
*t = GestureMouse
default:
in.AddError(errors.New("unknown GestureType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *GestureType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// TimeSinceEpoch uTC time in seconds, counted from January 1, 1970.
type TimeSinceEpoch time.Time
// Time returns the TimeSinceEpoch as time.Time value.
func (t TimeSinceEpoch) Time() time.Time {
return time.Time(t)
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t TimeSinceEpoch) MarshalEasyJSON(out *jwriter.Writer) {
v := float64(time.Time(t).UnixNano() / int64(time.Second))
out.Buffer.EnsureSpace(20)
out.Buffer.Buf = strconv.AppendFloat(out.Buffer.Buf, v, 'f', -1, 64)
}
// MarshalJSON satisfies json.Marshaler.
func (t TimeSinceEpoch) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *TimeSinceEpoch) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = TimeSinceEpoch(time.Unix(0, int64(in.Float64()*float64(time.Second))))
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *TimeSinceEpoch) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Modifier input key modifier type.
type Modifier int64
// Int64 returns the Modifier as int64 value.
func (t Modifier) Int64() int64 {
return int64(t)
}
// Modifier values.
const (
ModifierNone Modifier = 0
ModifierAlt Modifier = 1
ModifierCtrl Modifier = 2
ModifierMeta Modifier = 4
ModifierShift Modifier = 8
)
// String returns the Modifier as string value.
func (t Modifier) String() string {
switch t {
case ModifierNone:
return "None"
case ModifierAlt:
return "Alt"
case ModifierCtrl:
return "Ctrl"
case ModifierMeta:
return "Meta"
case ModifierShift:
return "Shift"
}
return fmt.Sprintf("Modifier(%d)", t)
}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Modifier) MarshalEasyJSON(out *jwriter.Writer) {
out.Int64(int64(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t Modifier) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Modifier) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch Modifier(in.Int64()) {
case ModifierNone:
*t = ModifierNone
case ModifierAlt:
*t = ModifierAlt
case ModifierCtrl:
*t = ModifierCtrl
case ModifierMeta:
*t = ModifierMeta
case ModifierShift:
*t = ModifierShift
default:
in.AddError(errors.New("unknown Modifier value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Modifier) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ModifierCommand is an alias for ModifierMeta.
const ModifierCommand Modifier = ModifierMeta
// KeyType type of the key event.
type KeyType string
// String returns the KeyType as string value.
func (t KeyType) String() string {
return string(t)
}
// KeyType values.
const (
KeyDown KeyType = "keyDown"
KeyUp KeyType = "keyUp"
KeyRawDown KeyType = "rawKeyDown"
KeyChar KeyType = "char"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t KeyType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t KeyType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *KeyType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch KeyType(in.String()) {
case KeyDown:
*t = KeyDown
case KeyUp:
*t = KeyUp
case KeyRawDown:
*t = KeyRawDown
case KeyChar:
*t = KeyChar
default:
in.AddError(errors.New("unknown KeyType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *KeyType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// MouseType type of the mouse event.
type MouseType string
// String returns the MouseType as string value.
func (t MouseType) String() string {
return string(t)
}
// MouseType values.
const (
MousePressed MouseType = "mousePressed"
MouseReleased MouseType = "mouseReleased"
MouseMoved MouseType = "mouseMoved"
MouseWheel MouseType = "mouseWheel"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t MouseType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t MouseType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *MouseType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch MouseType(in.String()) {
case MousePressed:
*t = MousePressed
case MouseReleased:
*t = MouseReleased
case MouseMoved:
*t = MouseMoved
case MouseWheel:
*t = MouseWheel
default:
in.AddError(errors.New("unknown MouseType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *MouseType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ButtonType mouse button (default: "none").
type ButtonType string
// String returns the ButtonType as string value.
func (t ButtonType) String() string {
return string(t)
}
// ButtonType values.
const (
ButtonNone ButtonType = "none"
ButtonLeft ButtonType = "left"
ButtonMiddle ButtonType = "middle"
ButtonRight ButtonType = "right"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ButtonType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ButtonType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ButtonType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ButtonType(in.String()) {
case ButtonNone:
*t = ButtonNone
case ButtonLeft:
*t = ButtonLeft
case ButtonMiddle:
*t = ButtonMiddle
case ButtonRight:
*t = ButtonRight
default:
in.AddError(errors.New("unknown ButtonType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ButtonType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// 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.
func (t TouchType) String() string {
return string(t)
}
// TouchType values.
const (
TouchStart TouchType = "touchStart"
TouchEnd TouchType = "touchEnd"
TouchMove TouchType = "touchMove"
TouchCancel TouchType = "touchCancel"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t TouchType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t TouchType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *TouchType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch TouchType(in.String()) {
case TouchStart:
*t = TouchStart
case TouchEnd:
*t = TouchEnd
case TouchMove:
*t = TouchMove
case TouchCancel:
*t = TouchCancel
default:
in.AddError(errors.New("unknown TouchType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *TouchType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -1,267 +0,0 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package inspector
import (
json "encoding/json"
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 easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(in *jlexer.Lexer, out *EventTargetCrashed) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(out *jwriter.Writer, in EventTargetCrashed) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventTargetCrashed) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventTargetCrashed) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventTargetCrashed) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventTargetCrashed) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(in *jlexer.Lexer, out *EventDetached) {
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 "reason":
(out.Reason).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(out *jwriter.Writer, in EventDetached) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"reason\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.Reason).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventDetached) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventDetached) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventDetached) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventDetached) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(in *jlexer.Lexer, out *EnableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(in *jlexer.Lexer, out *DisableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpInspector3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpInspector3(l, v)
}

View File

@ -1,22 +0,0 @@
package inspector
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventDetached fired when remote debugging connection is about to be
// terminated. Contains detach reason.
type EventDetached struct {
Reason DetachReason `json:"reason"` // The reason why connection has been terminated.
}
// EventTargetCrashed fired when debugging target has crashed.
type EventTargetCrashed struct{}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventInspectorDetached,
cdp.EventInspectorTargetCrashed,
}

View File

@ -1,41 +0,0 @@
// Package inspector provides the Chrome Debugging Protocol
// commands, types, and events for the Inspector domain.
//
// Generated by the chromedp-gen command.
package inspector
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// DisableParams disables inspector domain notifications.
type DisableParams struct{}
// Disable disables inspector domain notifications.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Inspector.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInspectorDisable, nil, nil)
}
// EnableParams enables inspector domain notifications.
type EnableParams struct{}
// Enable enables inspector domain notifications.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Inspector.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandInspectorEnable, nil, nil)
}

View File

@ -1,59 +0,0 @@
package inspector
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// DetachReason detach reason.
type DetachReason string
// String returns the DetachReason as string value.
func (t DetachReason) String() string {
return string(t)
}
// DetachReason values.
const (
DetachReasonTargetClosed DetachReason = "target_closed"
DetachReasonCanceledByUser DetachReason = "canceled_by_user"
DetachReasonReplacedWithDevtools DetachReason = "replaced_with_devtools"
DetachReasonRenderProcessGone DetachReason = "Render process gone."
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t DetachReason) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t DetachReason) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *DetachReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch DetachReason(in.String()) {
case DetachReasonTargetClosed:
*t = DetachReasonTargetClosed
case DetachReasonCanceledByUser:
*t = DetachReasonCanceledByUser
case DetachReasonReplacedWithDevtools:
*t = DetachReasonReplacedWithDevtools
case DetachReasonRenderProcessGone:
*t = DetachReasonRenderProcessGone
default:
in.AddError(errors.New("unknown DetachReason value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *DetachReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -1,423 +0,0 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package io
import (
json "encoding/json"
runtime "github.com/knq/chromedp/cdp/runtime"
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 easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(in *jlexer.Lexer, out *ResolveBlobReturns) {
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 "uuid":
out.UUID = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(out *jwriter.Writer, in ResolveBlobReturns) {
out.RawByte('{')
first := true
_ = first
if in.UUID != "" {
const prefix string = ",\"uuid\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.UUID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ResolveBlobReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResolveBlobReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ResolveBlobReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResolveBlobReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(in *jlexer.Lexer, out *ResolveBlobParams) {
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 "objectId":
out.ObjectID = runtime.RemoteObjectID(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(out *jwriter.Writer, in ResolveBlobParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"objectId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.ObjectID))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ResolveBlobParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResolveBlobParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ResolveBlobParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResolveBlobParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(in *jlexer.Lexer, out *ReadReturns) {
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 "base64Encoded":
out.Base64encoded = bool(in.Bool())
case "data":
out.Data = string(in.String())
case "eof":
out.EOF = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(out *jwriter.Writer, in ReadReturns) {
out.RawByte('{')
first := true
_ = first
if in.Base64encoded {
const prefix string = ",\"base64Encoded\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Bool(bool(in.Base64encoded))
}
if in.Data != "" {
const prefix string = ",\"data\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Data))
}
if in.EOF {
const prefix string = ",\"eof\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Bool(bool(in.EOF))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ReadReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ReadReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ReadReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ReadReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo3(in *jlexer.Lexer, out *ReadParams) {
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 "handle":
out.Handle = StreamHandle(in.String())
case "offset":
out.Offset = int64(in.Int64())
case "size":
out.Size = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo3(out *jwriter.Writer, in ReadParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"handle\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Handle))
}
if in.Offset != 0 {
const prefix string = ",\"offset\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Offset))
}
if in.Size != 0 {
const prefix string = ",\"size\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Size))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ReadParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ReadParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ReadParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ReadParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo4(in *jlexer.Lexer, out *CloseParams) {
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 "handle":
out.Handle = StreamHandle(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo4(out *jwriter.Writer, in CloseParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"handle\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Handle))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v CloseParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CloseParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIo4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CloseParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CloseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIo4(l, v)
}

View File

@ -1,129 +0,0 @@
// Package io provides the Chrome Debugging Protocol
// commands, types, and events for the IO domain.
//
// Input/Output operations for streams produced by DevTools.
//
// Generated by the chromedp-gen command.
package io
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
)
// CloseParams close the stream, discard any temporary backing storage.
type CloseParams struct {
Handle StreamHandle `json:"handle"` // Handle of the stream to close.
}
// Close close the stream, discard any temporary backing storage.
//
// parameters:
// handle - Handle of the stream to close.
func Close(handle StreamHandle) *CloseParams {
return &CloseParams{
Handle: handle,
}
}
// Do executes IO.close against the provided context and
// target handler.
func (p *CloseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandIOClose, p, nil)
}
// ReadParams read a chunk of the stream.
type ReadParams struct {
Handle StreamHandle `json:"handle"` // Handle of the stream to read.
Offset int64 `json:"offset,omitempty"` // Seek to the specified offset before reading (if not specificed, proceed with offset following the last read).
Size int64 `json:"size,omitempty"` // Maximum number of bytes to read (left upon the agent discretion if not specified).
}
// Read read a chunk of the stream.
//
// parameters:
// handle - Handle of the stream to read.
func Read(handle StreamHandle) *ReadParams {
return &ReadParams{
Handle: handle,
}
}
// WithOffset seek to the specified offset before reading (if not specificed,
// proceed with offset following the last read).
func (p ReadParams) WithOffset(offset int64) *ReadParams {
p.Offset = offset
return &p
}
// WithSize maximum number of bytes to read (left upon the agent discretion
// if not specified).
func (p ReadParams) WithSize(size int64) *ReadParams {
p.Size = size
return &p
}
// ReadReturns return values.
type ReadReturns struct {
Base64encoded bool `json:"base64Encoded,omitempty"` // Set if the data is base64-encoded
Data string `json:"data,omitempty"` // Data that were read.
EOF bool `json:"eof,omitempty"` // Set if the end-of-file condition occurred while reading.
}
// Do executes IO.read against the provided context and
// target handler.
//
// returns:
// data - Data that were read.
// eof - Set if the end-of-file condition occurred while reading.
func (p *ReadParams) Do(ctxt context.Context, h cdp.Handler) (data string, eof bool, err error) {
// execute
var res ReadReturns
err = h.Execute(ctxt, cdp.CommandIORead, p, &res)
if err != nil {
return "", false, err
}
return res.Data, res.EOF, nil
}
// ResolveBlobParams return UUID of Blob object specified by a remote object
// id.
type ResolveBlobParams struct {
ObjectID runtime.RemoteObjectID `json:"objectId"` // Object id of a Blob object wrapper.
}
// ResolveBlob return UUID of Blob object specified by a remote object id.
//
// parameters:
// objectID - Object id of a Blob object wrapper.
func ResolveBlob(objectID runtime.RemoteObjectID) *ResolveBlobParams {
return &ResolveBlobParams{
ObjectID: objectID,
}
}
// ResolveBlobReturns return values.
type ResolveBlobReturns struct {
UUID string `json:"uuid,omitempty"` // UUID of the specified Blob.
}
// Do executes IO.resolveBlob against the provided context and
// target handler.
//
// returns:
// uuid - UUID of the specified Blob.
func (p *ResolveBlobParams) Do(ctxt context.Context, h cdp.Handler) (uuid string, err error) {
// execute
var res ResolveBlobReturns
err = h.Execute(ctxt, cdp.CommandIOResolveBlob, p, &res)
if err != nil {
return "", err
}
return res.UUID, nil
}

View File

@ -1,12 +0,0 @@
package io
// Code generated by chromedp-gen. DO NOT EDIT.
// StreamHandle this is either obtained from another method or specified as
// blob:<uuid> where <uuid> is an UUID of a Blob.
type StreamHandle string
// String returns the StreamHandle as string value.
func (t StreamHandle) String() string {
return string(t)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
package layertree
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/dom"
)
// EventLayerPainted [no description].
type EventLayerPainted struct {
LayerID LayerID `json:"layerId"` // The id of the painted layer.
Clip *dom.Rect `json:"clip"` // Clip rectangle.
}
// EventLayerTreeDidChange [no description].
type EventLayerTreeDidChange struct {
Layers []*Layer `json:"layers,omitempty"` // Layer tree, absent if not in the comspositing mode.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventLayerTreeLayerPainted,
cdp.EventLayerTreeLayerTreeDidChange,
}

View File

@ -1,330 +0,0 @@
// Package layertree provides the Chrome Debugging Protocol
// commands, types, and events for the LayerTree domain.
//
// Generated by the chromedp-gen command.
package layertree
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/dom"
"github.com/mailru/easyjson"
)
// CompositingReasonsParams provides the reasons why the given layer was
// composited.
type CompositingReasonsParams struct {
LayerID LayerID `json:"layerId"` // The id of the layer for which we want to get the reasons it was composited.
}
// CompositingReasons provides the reasons why the given layer was
// composited.
//
// parameters:
// layerID - The id of the layer for which we want to get the reasons it was composited.
func CompositingReasons(layerID LayerID) *CompositingReasonsParams {
return &CompositingReasonsParams{
LayerID: layerID,
}
}
// CompositingReasonsReturns return values.
type CompositingReasonsReturns struct {
CompositingReasons []string `json:"compositingReasons,omitempty"` // A list of strings specifying reasons for the given layer to become composited.
}
// Do executes LayerTree.compositingReasons against the provided context and
// target handler.
//
// returns:
// compositingReasons - A list of strings specifying reasons for the given layer to become composited.
func (p *CompositingReasonsParams) Do(ctxt context.Context, h cdp.Handler) (compositingReasons []string, err error) {
// execute
var res CompositingReasonsReturns
err = h.Execute(ctxt, cdp.CommandLayerTreeCompositingReasons, p, &res)
if err != nil {
return nil, err
}
return res.CompositingReasons, nil
}
// DisableParams disables compositing tree inspection.
type DisableParams struct{}
// Disable disables compositing tree inspection.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes LayerTree.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandLayerTreeDisable, nil, nil)
}
// EnableParams enables compositing tree inspection.
type EnableParams struct{}
// Enable enables compositing tree inspection.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes LayerTree.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandLayerTreeEnable, nil, nil)
}
// LoadSnapshotParams returns the snapshot identifier.
type LoadSnapshotParams struct {
Tiles []*PictureTile `json:"tiles"` // An array of tiles composing the snapshot.
}
// LoadSnapshot returns the snapshot identifier.
//
// parameters:
// tiles - An array of tiles composing the snapshot.
func LoadSnapshot(tiles []*PictureTile) *LoadSnapshotParams {
return &LoadSnapshotParams{
Tiles: tiles,
}
}
// LoadSnapshotReturns return values.
type LoadSnapshotReturns struct {
SnapshotID SnapshotID `json:"snapshotId,omitempty"` // The id of the snapshot.
}
// Do executes LayerTree.loadSnapshot against the provided context and
// target handler.
//
// returns:
// snapshotID - The id of the snapshot.
func (p *LoadSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
// execute
var res LoadSnapshotReturns
err = h.Execute(ctxt, cdp.CommandLayerTreeLoadSnapshot, p, &res)
if err != nil {
return "", err
}
return res.SnapshotID, nil
}
// MakeSnapshotParams returns the layer snapshot identifier.
type MakeSnapshotParams struct {
LayerID LayerID `json:"layerId"` // The id of the layer.
}
// MakeSnapshot returns the layer snapshot identifier.
//
// parameters:
// layerID - The id of the layer.
func MakeSnapshot(layerID LayerID) *MakeSnapshotParams {
return &MakeSnapshotParams{
LayerID: layerID,
}
}
// MakeSnapshotReturns return values.
type MakeSnapshotReturns struct {
SnapshotID SnapshotID `json:"snapshotId,omitempty"` // The id of the layer snapshot.
}
// Do executes LayerTree.makeSnapshot against the provided context and
// target handler.
//
// returns:
// snapshotID - The id of the layer snapshot.
func (p *MakeSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
// execute
var res MakeSnapshotReturns
err = h.Execute(ctxt, cdp.CommandLayerTreeMakeSnapshot, p, &res)
if err != nil {
return "", err
}
return res.SnapshotID, nil
}
// ProfileSnapshotParams [no description].
type ProfileSnapshotParams struct {
SnapshotID SnapshotID `json:"snapshotId"` // The id of the layer snapshot.
MinRepeatCount int64 `json:"minRepeatCount,omitempty"` // The maximum number of times to replay the snapshot (1, if not specified).
MinDuration float64 `json:"minDuration,omitempty"` // The minimum duration (in seconds) to replay the snapshot.
ClipRect *dom.Rect `json:"clipRect,omitempty"` // The clip rectangle to apply when replaying the snapshot.
}
// ProfileSnapshot [no description].
//
// parameters:
// snapshotID - The id of the layer snapshot.
func ProfileSnapshot(snapshotID SnapshotID) *ProfileSnapshotParams {
return &ProfileSnapshotParams{
SnapshotID: snapshotID,
}
}
// WithMinRepeatCount the maximum number of times to replay the snapshot (1,
// if not specified).
func (p ProfileSnapshotParams) WithMinRepeatCount(minRepeatCount int64) *ProfileSnapshotParams {
p.MinRepeatCount = minRepeatCount
return &p
}
// WithMinDuration the minimum duration (in seconds) to replay the snapshot.
func (p ProfileSnapshotParams) WithMinDuration(minDuration float64) *ProfileSnapshotParams {
p.MinDuration = minDuration
return &p
}
// WithClipRect the clip rectangle to apply when replaying the snapshot.
func (p ProfileSnapshotParams) WithClipRect(clipRect *dom.Rect) *ProfileSnapshotParams {
p.ClipRect = clipRect
return &p
}
// ProfileSnapshotReturns return values.
type ProfileSnapshotReturns struct {
Timings []PaintProfile `json:"timings,omitempty"` // The array of paint profiles, one per run.
}
// Do executes LayerTree.profileSnapshot against the provided context and
// target handler.
//
// returns:
// timings - The array of paint profiles, one per run.
func (p *ProfileSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (timings []PaintProfile, err error) {
// execute
var res ProfileSnapshotReturns
err = h.Execute(ctxt, cdp.CommandLayerTreeProfileSnapshot, p, &res)
if err != nil {
return nil, err
}
return res.Timings, nil
}
// ReleaseSnapshotParams releases layer snapshot captured by the back-end.
type ReleaseSnapshotParams struct {
SnapshotID SnapshotID `json:"snapshotId"` // The id of the layer snapshot.
}
// ReleaseSnapshot releases layer snapshot captured by the back-end.
//
// parameters:
// snapshotID - The id of the layer snapshot.
func ReleaseSnapshot(snapshotID SnapshotID) *ReleaseSnapshotParams {
return &ReleaseSnapshotParams{
SnapshotID: snapshotID,
}
}
// Do executes LayerTree.releaseSnapshot against the provided context and
// target handler.
func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandLayerTreeReleaseSnapshot, p, nil)
}
// ReplaySnapshotParams replays the layer snapshot and returns the resulting
// bitmap.
type ReplaySnapshotParams struct {
SnapshotID SnapshotID `json:"snapshotId"` // The id of the layer snapshot.
FromStep int64 `json:"fromStep,omitempty"` // The first step to replay from (replay from the very start if not specified).
ToStep int64 `json:"toStep,omitempty"` // The last step to replay to (replay till the end if not specified).
Scale float64 `json:"scale,omitempty"` // The scale to apply while replaying (defaults to 1).
}
// ReplaySnapshot replays the layer snapshot and returns the resulting
// bitmap.
//
// parameters:
// snapshotID - The id of the layer snapshot.
func ReplaySnapshot(snapshotID SnapshotID) *ReplaySnapshotParams {
return &ReplaySnapshotParams{
SnapshotID: snapshotID,
}
}
// WithFromStep the first step to replay from (replay from the very start if
// not specified).
func (p ReplaySnapshotParams) WithFromStep(fromStep int64) *ReplaySnapshotParams {
p.FromStep = fromStep
return &p
}
// WithToStep the last step to replay to (replay till the end if not
// specified).
func (p ReplaySnapshotParams) WithToStep(toStep int64) *ReplaySnapshotParams {
p.ToStep = toStep
return &p
}
// WithScale the scale to apply while replaying (defaults to 1).
func (p ReplaySnapshotParams) WithScale(scale float64) *ReplaySnapshotParams {
p.Scale = scale
return &p
}
// ReplaySnapshotReturns return values.
type ReplaySnapshotReturns struct {
DataURL string `json:"dataURL,omitempty"` // A data: URL for resulting image.
}
// Do executes LayerTree.replaySnapshot against the provided context and
// target handler.
//
// returns:
// dataURL - A data: URL for resulting image.
func (p *ReplaySnapshotParams) Do(ctxt context.Context, h cdp.Handler) (dataURL string, err error) {
// execute
var res ReplaySnapshotReturns
err = h.Execute(ctxt, cdp.CommandLayerTreeReplaySnapshot, p, &res)
if err != nil {
return "", err
}
return res.DataURL, nil
}
// SnapshotCommandLogParams replays the layer snapshot and returns canvas
// log.
type SnapshotCommandLogParams struct {
SnapshotID SnapshotID `json:"snapshotId"` // The id of the layer snapshot.
}
// SnapshotCommandLog replays the layer snapshot and returns canvas log.
//
// parameters:
// snapshotID - The id of the layer snapshot.
func SnapshotCommandLog(snapshotID SnapshotID) *SnapshotCommandLogParams {
return &SnapshotCommandLogParams{
SnapshotID: snapshotID,
}
}
// SnapshotCommandLogReturns return values.
type SnapshotCommandLogReturns struct {
CommandLog []easyjson.RawMessage `json:"commandLog,omitempty"` // The array of canvas function calls.
}
// Do executes LayerTree.snapshotCommandLog against the provided context and
// target handler.
//
// returns:
// commandLog - The array of canvas function calls.
func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h cdp.Handler) (commandLog []easyjson.RawMessage, err error) {
// execute
var res SnapshotCommandLogReturns
err = h.Execute(ctxt, cdp.CommandLayerTreeSnapshotCommandLog, p, &res)
if err != nil {
return nil, err
}
return res.CommandLog, nil
}

View File

@ -1,119 +0,0 @@
package layertree
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/dom"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// LayerID unique Layer identifier.
type LayerID string
// String returns the LayerID as string value.
func (t LayerID) String() string {
return string(t)
}
// SnapshotID unique snapshot identifier.
type SnapshotID string
// String returns the SnapshotID as string value.
func (t SnapshotID) String() string {
return string(t)
}
// ScrollRect rectangle where scrolling happens on the main thread.
type ScrollRect struct {
Rect *dom.Rect `json:"rect"` // Rectangle itself.
Type ScrollRectType `json:"type"` // Reason for rectangle to force scrolling on the main thread
}
// StickyPositionConstraint sticky position constraints.
type StickyPositionConstraint struct {
StickyBoxRect *dom.Rect `json:"stickyBoxRect"` // Layout rectangle of the sticky element before being shifted
ContainingBlockRect *dom.Rect `json:"containingBlockRect"` // Layout rectangle of the containing block of the sticky element
NearestLayerShiftingStickyBox LayerID `json:"nearestLayerShiftingStickyBox,omitempty"` // The nearest sticky layer that shifts the sticky box
NearestLayerShiftingContainingBlock LayerID `json:"nearestLayerShiftingContainingBlock,omitempty"` // The nearest sticky layer that shifts the containing block
}
// PictureTile serialized fragment of layer picture along with its offset
// within the layer.
type PictureTile struct {
X float64 `json:"x"` // Offset from owning layer left boundary
Y float64 `json:"y"` // Offset from owning layer top boundary
Picture string `json:"picture"` // Base64-encoded snapshot data.
}
// Layer information about a compositing layer.
type Layer struct {
LayerID LayerID `json:"layerId"` // The unique id for this layer.
ParentLayerID LayerID `json:"parentLayerId,omitempty"` // The id of parent (not present for root).
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // The backend id for the node associated with this layer.
OffsetX float64 `json:"offsetX"` // Offset from parent layer, X coordinate.
OffsetY float64 `json:"offsetY"` // Offset from parent layer, Y coordinate.
Width float64 `json:"width"` // Layer width.
Height float64 `json:"height"` // Layer height.
Transform []float64 `json:"transform,omitempty"` // Transformation matrix for layer, default is identity matrix
AnchorX float64 `json:"anchorX,omitempty"` // Transform anchor point X, absent if no transform specified
AnchorY float64 `json:"anchorY,omitempty"` // Transform anchor point Y, absent if no transform specified
AnchorZ float64 `json:"anchorZ,omitempty"` // Transform anchor point Z, absent if no transform specified
PaintCount int64 `json:"paintCount"` // Indicates how many time this layer has painted.
DrawsContent bool `json:"drawsContent"` // Indicates whether this layer hosts any content, rather than being used for transform/scrolling purposes only.
Invisible bool `json:"invisible,omitempty"` // Set if layer is not visible.
ScrollRects []*ScrollRect `json:"scrollRects,omitempty"` // Rectangles scrolling on main thread only.
StickyPositionConstraint *StickyPositionConstraint `json:"stickyPositionConstraint,omitempty"` // Sticky position constraint information
}
// PaintProfile array of timings, one per paint step.
type PaintProfile []float64
// ScrollRectType reason for rectangle to force scrolling on the main thread.
type ScrollRectType string
// String returns the ScrollRectType as string value.
func (t ScrollRectType) String() string {
return string(t)
}
// ScrollRectType values.
const (
ScrollRectTypeRepaintsOnScroll ScrollRectType = "RepaintsOnScroll"
ScrollRectTypeTouchEventHandler ScrollRectType = "TouchEventHandler"
ScrollRectTypeWheelEventHandler ScrollRectType = "WheelEventHandler"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ScrollRectType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ScrollRectType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ScrollRectType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ScrollRectType(in.String()) {
case ScrollRectTypeRepaintsOnScroll:
*t = ScrollRectTypeRepaintsOnScroll
case ScrollRectTypeTouchEventHandler:
*t = ScrollRectTypeTouchEventHandler
case ScrollRectTypeWheelEventHandler:
*t = ScrollRectTypeWheelEventHandler
default:
in.AddError(errors.New("unknown ScrollRectType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ScrollRectType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -1,779 +0,0 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package log
import (
json "encoding/json"
network "github.com/knq/chromedp/cdp/network"
runtime "github.com/knq/chromedp/cdp/runtime"
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 easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(in *jlexer.Lexer, out *ViolationSetting) {
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 "name":
(out.Name).UnmarshalEasyJSON(in)
case "threshold":
out.Threshold = float64(in.Float64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(out *jwriter.Writer, in ViolationSetting) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"name\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.Name).MarshalEasyJSON(out)
}
{
const prefix string = ",\"threshold\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Float64(float64(in.Threshold))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ViolationSetting) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ViolationSetting) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ViolationSetting) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ViolationSetting) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(in *jlexer.Lexer, out *StopViolationsReportParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(out *jwriter.Writer, in StopViolationsReportParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v StopViolationsReportParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v StopViolationsReportParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *StopViolationsReportParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *StopViolationsReportParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(in *jlexer.Lexer, out *StartViolationsReportParams) {
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 "config":
if in.IsNull() {
in.Skip()
out.Config = nil
} else {
in.Delim('[')
if out.Config == nil {
if !in.IsDelim(']') {
out.Config = make([]*ViolationSetting, 0, 8)
} else {
out.Config = []*ViolationSetting{}
}
} else {
out.Config = (out.Config)[:0]
}
for !in.IsDelim(']') {
var v1 *ViolationSetting
if in.IsNull() {
in.Skip()
v1 = nil
} else {
if v1 == nil {
v1 = new(ViolationSetting)
}
(*v1).UnmarshalEasyJSON(in)
}
out.Config = append(out.Config, v1)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(out *jwriter.Writer, in StartViolationsReportParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"config\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
if in.Config == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v2, v3 := range in.Config {
if v2 > 0 {
out.RawByte(',')
}
if v3 == nil {
out.RawString("null")
} else {
(*v3).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v StartViolationsReportParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v StartViolationsReportParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *StartViolationsReportParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *StartViolationsReportParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(in *jlexer.Lexer, out *EventEntryAdded) {
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 "entry":
if in.IsNull() {
in.Skip()
out.Entry = nil
} else {
if out.Entry == nil {
out.Entry = new(Entry)
}
(*out.Entry).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(out *jwriter.Writer, in EventEntryAdded) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"entry\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
if in.Entry == nil {
out.RawString("null")
} else {
(*in.Entry).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EventEntryAdded) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventEntryAdded) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventEntryAdded) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventEntryAdded) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(in *jlexer.Lexer, out *Entry) {
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 "source":
(out.Source).UnmarshalEasyJSON(in)
case "level":
(out.Level).UnmarshalEasyJSON(in)
case "text":
out.Text = string(in.String())
case "timestamp":
if in.IsNull() {
in.Skip()
out.Timestamp = nil
} else {
if out.Timestamp == nil {
out.Timestamp = new(runtime.Timestamp)
}
(*out.Timestamp).UnmarshalEasyJSON(in)
}
case "url":
out.URL = string(in.String())
case "lineNumber":
out.LineNumber = int64(in.Int64())
case "stackTrace":
if in.IsNull() {
in.Skip()
out.StackTrace = nil
} else {
if out.StackTrace == nil {
out.StackTrace = new(runtime.StackTrace)
}
(*out.StackTrace).UnmarshalEasyJSON(in)
}
case "networkRequestId":
out.NetworkRequestID = network.RequestID(in.String())
case "workerId":
out.WorkerID = string(in.String())
case "args":
if in.IsNull() {
in.Skip()
out.Args = nil
} else {
in.Delim('[')
if out.Args == nil {
if !in.IsDelim(']') {
out.Args = make([]*runtime.RemoteObject, 0, 8)
} else {
out.Args = []*runtime.RemoteObject{}
}
} else {
out.Args = (out.Args)[:0]
}
for !in.IsDelim(']') {
var v4 *runtime.RemoteObject
if in.IsNull() {
in.Skip()
v4 = nil
} else {
if v4 == nil {
v4 = new(runtime.RemoteObject)
}
(*v4).UnmarshalEasyJSON(in)
}
out.Args = append(out.Args, v4)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(out *jwriter.Writer, in Entry) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"source\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.Source).MarshalEasyJSON(out)
}
{
const prefix string = ",\"level\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.Level).MarshalEasyJSON(out)
}
{
const prefix string = ",\"text\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Text))
}
{
const prefix string = ",\"timestamp\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
if in.Timestamp == nil {
out.RawString("null")
} else {
(*in.Timestamp).MarshalEasyJSON(out)
}
}
if in.URL != "" {
const prefix string = ",\"url\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.URL))
}
if in.LineNumber != 0 {
const prefix string = ",\"lineNumber\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.LineNumber))
}
if in.StackTrace != nil {
const prefix string = ",\"stackTrace\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(*in.StackTrace).MarshalEasyJSON(out)
}
if in.NetworkRequestID != "" {
const prefix string = ",\"networkRequestId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.NetworkRequestID))
}
if in.WorkerID != "" {
const prefix string = ",\"workerId\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.WorkerID))
}
if len(in.Args) != 0 {
const prefix string = ",\"args\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
{
out.RawByte('[')
for v5, v6 := range in.Args {
if v5 > 0 {
out.RawByte(',')
}
if v6 == nil {
out.RawString("null")
} else {
(*v6).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Entry) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Entry) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Entry) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Entry) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog4(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(in *jlexer.Lexer, out *EnableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog5(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(in *jlexer.Lexer, out *DisableParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog6(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(in *jlexer.Lexer, out *ClearParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(out *jwriter.Writer, in ClearParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v ClearParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpLog7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpLog7(l, v)
}

View File

@ -1,17 +0,0 @@
package log
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
)
// EventEntryAdded issued when new message was logged.
type EventEntryAdded struct {
Entry *Entry `json:"entry"` // The entry.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventLogEntryAdded,
}

View File

@ -1,96 +0,0 @@
// Package log provides the Chrome Debugging Protocol
// commands, types, and events for the Log domain.
//
// Provides access to log entries.
//
// Generated by the chromedp-gen command.
package log
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// ClearParams clears the log.
type ClearParams struct{}
// Clear clears the log.
func Clear() *ClearParams {
return &ClearParams{}
}
// Do executes Log.clear against the provided context and
// target handler.
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandLogClear, nil, nil)
}
// DisableParams disables log domain, prevents further log entries from being
// reported to the client.
type DisableParams struct{}
// Disable disables log domain, prevents further log entries from being
// reported to the client.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Log.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandLogDisable, nil, nil)
}
// EnableParams enables log domain, sends the entries collected so far to the
// client by means of the entryAdded notification.
type EnableParams struct{}
// Enable enables log domain, sends the entries collected so far to the
// client by means of the entryAdded notification.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Log.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandLogEnable, nil, nil)
}
// StartViolationsReportParams start violation reporting.
type StartViolationsReportParams struct {
Config []*ViolationSetting `json:"config"` // Configuration for violations.
}
// StartViolationsReport start violation reporting.
//
// parameters:
// config - Configuration for violations.
func StartViolationsReport(config []*ViolationSetting) *StartViolationsReportParams {
return &StartViolationsReportParams{
Config: config,
}
}
// Do executes Log.startViolationsReport against the provided context and
// target handler.
func (p *StartViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandLogStartViolationsReport, p, nil)
}
// StopViolationsReportParams stop violation reporting.
type StopViolationsReportParams struct{}
// StopViolationsReport stop violation reporting.
func StopViolationsReport() *StopViolationsReportParams {
return &StopViolationsReportParams{}
}
// Do executes Log.stopViolationsReport against the provided context and
// target handler.
func (p *StopViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandLogStopViolationsReport, nil, nil)
}

View File

@ -1,213 +0,0 @@
package log
import (
"errors"
"github.com/knq/chromedp/cdp/network"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// Entry log entry.
type Entry struct {
Source Source `json:"source"` // Log entry source.
Level Level `json:"level"` // Log entry severity.
Text string `json:"text"` // Logged text.
Timestamp *runtime.Timestamp `json:"timestamp"` // Timestamp when this entry was added.
URL string `json:"url,omitempty"` // URL of the resource if known.
LineNumber int64 `json:"lineNumber,omitempty"` // Line number in the resource.
StackTrace *runtime.StackTrace `json:"stackTrace,omitempty"` // JavaScript stack trace.
NetworkRequestID network.RequestID `json:"networkRequestId,omitempty"` // Identifier of the network request associated with this entry.
WorkerID string `json:"workerId,omitempty"` // Identifier of the worker associated with this entry.
Args []*runtime.RemoteObject `json:"args,omitempty"` // Call arguments.
}
// ViolationSetting violation configuration setting.
type ViolationSetting struct {
Name Violation `json:"name"` // Violation type.
Threshold float64 `json:"threshold"` // Time threshold to trigger upon.
}
// Source log entry source.
type Source string
// String returns the Source as string value.
func (t Source) String() string {
return string(t)
}
// Source values.
const (
SourceXML Source = "xml"
SourceJavascript Source = "javascript"
SourceNetwork Source = "network"
SourceStorage Source = "storage"
SourceAppcache Source = "appcache"
SourceRendering Source = "rendering"
SourceSecurity Source = "security"
SourceDeprecation Source = "deprecation"
SourceWorker Source = "worker"
SourceViolation Source = "violation"
SourceIntervention Source = "intervention"
SourceRecommendation Source = "recommendation"
SourceOther Source = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Source) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t Source) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Source) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch Source(in.String()) {
case SourceXML:
*t = SourceXML
case SourceJavascript:
*t = SourceJavascript
case SourceNetwork:
*t = SourceNetwork
case SourceStorage:
*t = SourceStorage
case SourceAppcache:
*t = SourceAppcache
case SourceRendering:
*t = SourceRendering
case SourceSecurity:
*t = SourceSecurity
case SourceDeprecation:
*t = SourceDeprecation
case SourceWorker:
*t = SourceWorker
case SourceViolation:
*t = SourceViolation
case SourceIntervention:
*t = SourceIntervention
case SourceRecommendation:
*t = SourceRecommendation
case SourceOther:
*t = SourceOther
default:
in.AddError(errors.New("unknown Source value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Source) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Level log entry severity.
type Level string
// String returns the Level as string value.
func (t Level) String() string {
return string(t)
}
// Level values.
const (
LevelVerbose Level = "verbose"
LevelInfo Level = "info"
LevelWarning Level = "warning"
LevelError Level = "error"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Level) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t Level) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Level) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch Level(in.String()) {
case LevelVerbose:
*t = LevelVerbose
case LevelInfo:
*t = LevelInfo
case LevelWarning:
*t = LevelWarning
case LevelError:
*t = LevelError
default:
in.AddError(errors.New("unknown Level value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Level) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Violation violation type.
type Violation string
// String returns the Violation as string value.
func (t Violation) String() string {
return string(t)
}
// Violation values.
const (
ViolationLongTask Violation = "longTask"
ViolationLongLayout Violation = "longLayout"
ViolationBlockedEvent Violation = "blockedEvent"
ViolationBlockedParser Violation = "blockedParser"
ViolationDiscouragedAPIUse Violation = "discouragedAPIUse"
ViolationHandler Violation = "handler"
ViolationRecurringHandler Violation = "recurringHandler"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Violation) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t Violation) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Violation) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch Violation(in.String()) {
case ViolationLongTask:
*t = ViolationLongTask
case ViolationLongLayout:
*t = ViolationLongLayout
case ViolationBlockedEvent:
*t = ViolationBlockedEvent
case ViolationBlockedParser:
*t = ViolationBlockedParser
case ViolationDiscouragedAPIUse:
*t = ViolationDiscouragedAPIUse
case ViolationHandler:
*t = ViolationHandler
case ViolationRecurringHandler:
*t = ViolationRecurringHandler
default:
in.AddError(errors.New("unknown Violation value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Violation) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

View File

@ -1,374 +0,0 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package memory
import (
json "encoding/json"
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 easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory(in *jlexer.Lexer, out *SimulatePressureNotificationParams) {
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 "level":
(out.Level).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory(out *jwriter.Writer, in SimulatePressureNotificationParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"level\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
(in.Level).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SimulatePressureNotificationParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SimulatePressureNotificationParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SimulatePressureNotificationParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SimulatePressureNotificationParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory1(in *jlexer.Lexer, out *SetPressureNotificationsSuppressedParams) {
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 "suppressed":
out.Suppressed = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory1(out *jwriter.Writer, in SetPressureNotificationsSuppressedParams) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"suppressed\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Bool(bool(in.Suppressed))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetPressureNotificationsSuppressedParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetPressureNotificationsSuppressedParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetPressureNotificationsSuppressedParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetPressureNotificationsSuppressedParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory2(in *jlexer.Lexer, out *PrepareForLeakDetectionParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory2(out *jwriter.Writer, in PrepareForLeakDetectionParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v PrepareForLeakDetectionParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v PrepareForLeakDetectionParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *PrepareForLeakDetectionParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *PrepareForLeakDetectionParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory3(in *jlexer.Lexer, out *GetDOMCountersReturns) {
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 "documents":
out.Documents = int64(in.Int64())
case "nodes":
out.Nodes = int64(in.Int64())
case "jsEventListeners":
out.JsEventListeners = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory3(out *jwriter.Writer, in GetDOMCountersReturns) {
out.RawByte('{')
first := true
_ = first
if in.Documents != 0 {
const prefix string = ",\"documents\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Documents))
}
if in.Nodes != 0 {
const prefix string = ",\"nodes\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Nodes))
}
if in.JsEventListeners != 0 {
const prefix string = ",\"jsEventListeners\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.JsEventListeners))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetDOMCountersReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetDOMCountersReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetDOMCountersReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetDOMCountersReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory4(in *jlexer.Lexer, out *GetDOMCountersParams) {
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 {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory4(out *jwriter.Writer, in GetDOMCountersParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetDOMCountersParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetDOMCountersParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpMemory4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetDOMCountersParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetDOMCountersParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpMemory4(l, v)
}

View File

@ -1,106 +0,0 @@
// Package memory provides the Chrome Debugging Protocol
// commands, types, and events for the Memory domain.
//
// Generated by the chromedp-gen command.
package memory
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// GetDOMCountersParams [no description].
type GetDOMCountersParams struct{}
// GetDOMCounters [no description].
func GetDOMCounters() *GetDOMCountersParams {
return &GetDOMCountersParams{}
}
// GetDOMCountersReturns return values.
type GetDOMCountersReturns struct {
Documents int64 `json:"documents,omitempty"`
Nodes int64 `json:"nodes,omitempty"`
JsEventListeners int64 `json:"jsEventListeners,omitempty"`
}
// Do executes Memory.getDOMCounters against the provided context and
// target handler.
//
// returns:
// documents
// nodes
// jsEventListeners
func (p *GetDOMCountersParams) Do(ctxt context.Context, h cdp.Handler) (documents int64, nodes int64, jsEventListeners int64, err error) {
// execute
var res GetDOMCountersReturns
err = h.Execute(ctxt, cdp.CommandMemoryGetDOMCounters, nil, &res)
if err != nil {
return 0, 0, 0, err
}
return res.Documents, res.Nodes, res.JsEventListeners, nil
}
// PrepareForLeakDetectionParams [no description].
type PrepareForLeakDetectionParams struct{}
// PrepareForLeakDetection [no description].
func PrepareForLeakDetection() *PrepareForLeakDetectionParams {
return &PrepareForLeakDetectionParams{}
}
// Do executes Memory.prepareForLeakDetection against the provided context and
// target handler.
func (p *PrepareForLeakDetectionParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandMemoryPrepareForLeakDetection, nil, nil)
}
// SetPressureNotificationsSuppressedParams enable/disable suppressing memory
// pressure notifications in all processes.
type SetPressureNotificationsSuppressedParams struct {
Suppressed bool `json:"suppressed"` // If true, memory pressure notifications will be suppressed.
}
// SetPressureNotificationsSuppressed enable/disable suppressing memory
// pressure notifications in all processes.
//
// parameters:
// suppressed - If true, memory pressure notifications will be suppressed.
func SetPressureNotificationsSuppressed(suppressed bool) *SetPressureNotificationsSuppressedParams {
return &SetPressureNotificationsSuppressedParams{
Suppressed: suppressed,
}
}
// Do executes Memory.setPressureNotificationsSuppressed against the provided context and
// target handler.
func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandMemorySetPressureNotificationsSuppressed, p, nil)
}
// SimulatePressureNotificationParams simulate a memory pressure notification
// in all processes.
type SimulatePressureNotificationParams struct {
Level PressureLevel `json:"level"` // Memory pressure level of the notification.
}
// SimulatePressureNotification simulate a memory pressure notification in
// all processes.
//
// parameters:
// level - Memory pressure level of the notification.
func SimulatePressureNotification(level PressureLevel) *SimulatePressureNotificationParams {
return &SimulatePressureNotificationParams{
Level: level,
}
}
// Do executes Memory.simulatePressureNotification against the provided context and
// target handler.
func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandMemorySimulatePressureNotification, p, nil)
}

View File

@ -1,53 +0,0 @@
package memory
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Code generated by chromedp-gen. DO NOT EDIT.
// PressureLevel memory pressure level.
type PressureLevel string
// String returns the PressureLevel as string value.
func (t PressureLevel) String() string {
return string(t)
}
// PressureLevel values.
const (
PressureLevelModerate PressureLevel = "moderate"
PressureLevelCritical PressureLevel = "critical"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t PressureLevel) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t PressureLevel) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *PressureLevel) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch PressureLevel(in.String()) {
case PressureLevelModerate:
*t = PressureLevelModerate
case PressureLevelCritical:
*t = PressureLevelCritical
default:
in.AddError(errors.New("unknown PressureLevel value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *PressureLevel) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,166 +0,0 @@
package network
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/page"
)
// EventDataReceived fired when data chunk was received over the network.
type EventDataReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
DataLength int64 `json:"dataLength"` // Data chunk length.
EncodedDataLength int64 `json:"encodedDataLength"` // Actual bytes received (might be less than dataLength for compressed encodings).
}
// EventEventSourceMessageReceived fired when EventSource message is
// received.
type EventEventSourceMessageReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
EventName string `json:"eventName"` // Message type.
EventID string `json:"eventId"` // Message identifier.
Data string `json:"data"` // Message content.
}
// EventLoadingFailed fired when HTTP request has failed to load.
type EventLoadingFailed struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Type page.ResourceType `json:"type"` // Resource type.
ErrorText string `json:"errorText"` // User friendly error message.
Canceled bool `json:"canceled,omitempty"` // True if loading was canceled.
BlockedReason BlockedReason `json:"blockedReason,omitempty"` // The reason why loading was blocked, if any.
}
// EventLoadingFinished fired when HTTP request has finished loading.
type EventLoadingFinished struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
EncodedDataLength float64 `json:"encodedDataLength"` // Total number of bytes received for this request.
}
// EventRequestIntercepted details of an intercepted HTTP request, which must
// be either allowed, blocked, modified or mocked.
type EventRequestIntercepted struct {
InterceptionID InterceptionID `json:"interceptionId"` // Each request the page makes will have a unique id, however if any redirects are encountered while processing that fetch, they will be reported with the same id as the original fetch. Likewise if HTTP authentication is needed then the same fetch id will be used.
Request *Request `json:"request"`
FrameID cdp.FrameID `json:"frameId"` // The id of the frame that initiated the request.
ResourceType page.ResourceType `json:"resourceType"` // How the requested resource will be used.
IsNavigationRequest bool `json:"isNavigationRequest"` // Whether this is a navigation request, which can abort the navigation completely.
RedirectURL string `json:"redirectUrl,omitempty"` // Redirect location, only sent if a redirect was intercepted.
AuthChallenge *AuthChallenge `json:"authChallenge,omitempty"` // Details of the Authorization Challenge encountered. If this is set then continueInterceptedRequest must contain an authChallengeResponse.
ResponseErrorReason ErrorReason `json:"responseErrorReason,omitempty"` // Response error if intercepted at response stage or if redirect occurred while intercepting request.
ResponseStatusCode int64 `json:"responseStatusCode,omitempty"` // Response code if intercepted at response stage or if redirect occurred while intercepting request or auth retry occurred.
ResponseHeaders Headers `json:"responseHeaders,omitempty"` // Response headers if intercepted at the response stage or if redirect occurred while intercepting request or auth retry occurred.
}
// EventRequestServedFromCache fired if request ended up loading from cache.
type EventRequestServedFromCache struct {
RequestID RequestID `json:"requestId"` // Request identifier.
}
// EventRequestWillBeSent fired when page is about to send HTTP request.
type EventRequestWillBeSent struct {
RequestID RequestID `json:"requestId"` // Request identifier.
LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. Empty string if the request is fetched from worker.
DocumentURL string `json:"documentURL"` // URL of the document this request is loaded for.
Request *Request `json:"request"` // Request data.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
WallTime *cdp.TimeSinceEpoch `json:"wallTime"` // Timestamp.
Initiator *Initiator `json:"initiator"` // Request initiator.
RedirectResponse *Response `json:"redirectResponse,omitempty"` // Redirect response data.
Type page.ResourceType `json:"type,omitempty"` // Type of this resource.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
}
// EventResourceChangedPriority fired when resource loading priority is
// changed.
type EventResourceChangedPriority struct {
RequestID RequestID `json:"requestId"` // Request identifier.
NewPriority ResourcePriority `json:"newPriority"` // New priority
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
}
// EventResponseReceived fired when HTTP response is available.
type EventResponseReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. Empty string if the request is fetched from worker.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Type page.ResourceType `json:"type"` // Resource type.
Response *Response `json:"response"` // Response data.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame identifier.
}
// EventWebSocketClosed fired when WebSocket is closed.
type EventWebSocketClosed struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
}
// EventWebSocketCreated fired upon WebSocket creation.
type EventWebSocketCreated struct {
RequestID RequestID `json:"requestId"` // Request identifier.
URL string `json:"url"` // WebSocket request URL.
Initiator *Initiator `json:"initiator,omitempty"` // Request initiator.
}
// EventWebSocketFrameError fired when WebSocket frame error occurs.
type EventWebSocketFrameError struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
ErrorMessage string `json:"errorMessage"` // WebSocket frame error message.
}
// EventWebSocketFrameReceived fired when WebSocket frame is received.
type EventWebSocketFrameReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Response *WebSocketFrame `json:"response"` // WebSocket response data.
}
// EventWebSocketFrameSent fired when WebSocket frame is sent.
type EventWebSocketFrameSent struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Response *WebSocketFrame `json:"response"` // WebSocket response data.
}
// EventWebSocketHandshakeResponseReceived fired when WebSocket handshake
// response becomes available.
type EventWebSocketHandshakeResponseReceived struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
Response *WebSocketResponse `json:"response"` // WebSocket response data.
}
// EventWebSocketWillSendHandshakeRequest fired when WebSocket is about to
// initiate handshake.
type EventWebSocketWillSendHandshakeRequest struct {
RequestID RequestID `json:"requestId"` // Request identifier.
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
WallTime *cdp.TimeSinceEpoch `json:"wallTime"` // UTC Timestamp.
Request *WebSocketRequest `json:"request"` // WebSocket request data.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventNetworkDataReceived,
cdp.EventNetworkEventSourceMessageReceived,
cdp.EventNetworkLoadingFailed,
cdp.EventNetworkLoadingFinished,
cdp.EventNetworkRequestIntercepted,
cdp.EventNetworkRequestServedFromCache,
cdp.EventNetworkRequestWillBeSent,
cdp.EventNetworkResourceChangedPriority,
cdp.EventNetworkResponseReceived,
cdp.EventNetworkWebSocketClosed,
cdp.EventNetworkWebSocketCreated,
cdp.EventNetworkWebSocketFrameError,
cdp.EventNetworkWebSocketFrameReceived,
cdp.EventNetworkWebSocketFrameSent,
cdp.EventNetworkWebSocketHandshakeResponseReceived,
cdp.EventNetworkWebSocketWillSendHandshakeRequest,
}

View File

@ -1,824 +0,0 @@
// Package network provides the Chrome Debugging Protocol
// commands, types, and events for the Network domain.
//
// Network domain allows tracking network activities of the page. It exposes
// information about http, file, data and other requests and responses, their
// headers, bodies, timing, etc.
//
// Generated by the chromedp-gen command.
package network
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
"encoding/base64"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/debugger"
)
// ClearBrowserCacheParams clears browser cache.
type ClearBrowserCacheParams struct{}
// ClearBrowserCache clears browser cache.
func ClearBrowserCache() *ClearBrowserCacheParams {
return &ClearBrowserCacheParams{}
}
// Do executes Network.clearBrowserCache against the provided context and
// target handler.
func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkClearBrowserCache, nil, nil)
}
// ClearBrowserCookiesParams clears browser cookies.
type ClearBrowserCookiesParams struct{}
// ClearBrowserCookies clears browser cookies.
func ClearBrowserCookies() *ClearBrowserCookiesParams {
return &ClearBrowserCookiesParams{}
}
// Do executes Network.clearBrowserCookies against the provided context and
// target handler.
func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkClearBrowserCookies, nil, nil)
}
// ContinueInterceptedRequestParams 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.
type ContinueInterceptedRequestParams struct {
InterceptionID InterceptionID `json:"interceptionId"`
ErrorReason ErrorReason `json:"errorReason,omitempty"` // 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.
RawResponse string `json:"rawResponse,omitempty"` // 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.
URL string `json:"url,omitempty"` // 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.
Method string `json:"method,omitempty"` // If set this allows the request method to be overridden. Must not be set in response to an authChallenge.
PostData string `json:"postData,omitempty"` // If set this allows postData to be set. Must not be set in response to an authChallenge.
Headers Headers `json:"headers,omitempty"` // If set this allows the request headers to be changed. Must not be set in response to an authChallenge.
AuthChallengeResponse *AuthChallengeResponse `json:"authChallengeResponse,omitempty"` // Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
}
// ContinueInterceptedRequest 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.
//
// parameters:
// interceptionID
func ContinueInterceptedRequest(interceptionID InterceptionID) *ContinueInterceptedRequestParams {
return &ContinueInterceptedRequestParams{
InterceptionID: interceptionID,
}
}
// WithErrorReason 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.
func (p ContinueInterceptedRequestParams) WithErrorReason(errorReason ErrorReason) *ContinueInterceptedRequestParams {
p.ErrorReason = errorReason
return &p
}
// WithRawResponse 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.
func (p ContinueInterceptedRequestParams) WithRawResponse(rawResponse string) *ContinueInterceptedRequestParams {
p.RawResponse = rawResponse
return &p
}
// WithURL 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.
func (p ContinueInterceptedRequestParams) WithURL(url string) *ContinueInterceptedRequestParams {
p.URL = url
return &p
}
// WithMethod if set this allows the request method to be overridden. Must
// not be set in response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithMethod(method string) *ContinueInterceptedRequestParams {
p.Method = method
return &p
}
// WithPostData if set this allows postData to be set. Must not be set in
// response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithPostData(postData string) *ContinueInterceptedRequestParams {
p.PostData = postData
return &p
}
// WithHeaders if set this allows the request headers to be changed. Must not
// be set in response to an authChallenge.
func (p ContinueInterceptedRequestParams) WithHeaders(headers Headers) *ContinueInterceptedRequestParams {
p.Headers = headers
return &p
}
// WithAuthChallengeResponse response to a requestIntercepted with an
// authChallenge. Must not be set otherwise.
func (p ContinueInterceptedRequestParams) WithAuthChallengeResponse(authChallengeResponse *AuthChallengeResponse) *ContinueInterceptedRequestParams {
p.AuthChallengeResponse = authChallengeResponse
return &p
}
// Do executes Network.continueInterceptedRequest against the provided context and
// target handler.
func (p *ContinueInterceptedRequestParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkContinueInterceptedRequest, p, nil)
}
// 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.
}
// DeleteCookies deletes browser cookies with matching name and url or
// domain/path pair.
//
// parameters:
// name - Name of the cookies to remove.
func DeleteCookies(name string) *DeleteCookiesParams {
return &DeleteCookiesParams{
Name: name,
}
}
// 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 *DeleteCookiesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkDeleteCookies, p, nil)
}
// DisableParams disables network tracking, prevents network events from
// being sent to the client.
type DisableParams struct{}
// Disable disables network tracking, prevents network events from being sent
// to the client.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Network.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkDisable, nil, nil)
}
// EmulateNetworkConditionsParams activates emulation of network conditions.
type EmulateNetworkConditionsParams struct {
Offline bool `json:"offline"` // True to emulate internet disconnection.
Latency float64 `json:"latency"` // Minimum latency from request sent to response headers received (ms).
DownloadThroughput float64 `json:"downloadThroughput"` // Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
UploadThroughput float64 `json:"uploadThroughput"` // Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.
ConnectionType ConnectionType `json:"connectionType,omitempty"` // Connection type if known.
}
// EmulateNetworkConditions activates emulation of network conditions.
//
// parameters:
// offline - True to emulate internet disconnection.
// latency - Minimum latency from request sent to response headers received (ms).
// downloadThroughput - Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
// uploadThroughput - Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.
func EmulateNetworkConditions(offline bool, latency float64, downloadThroughput float64, uploadThroughput float64) *EmulateNetworkConditionsParams {
return &EmulateNetworkConditionsParams{
Offline: offline,
Latency: latency,
DownloadThroughput: downloadThroughput,
UploadThroughput: uploadThroughput,
}
}
// WithConnectionType connection type if known.
func (p EmulateNetworkConditionsParams) WithConnectionType(connectionType ConnectionType) *EmulateNetworkConditionsParams {
p.ConnectionType = connectionType
return &p
}
// Do executes Network.emulateNetworkConditions against the provided context and
// target handler.
func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkEmulateNetworkConditions, p, nil)
}
// EnableParams enables network tracking, network events will now be
// delivered to the client.
type EnableParams struct {
MaxTotalBufferSize int64 `json:"maxTotalBufferSize,omitempty"` // Buffer size in bytes to use when preserving network payloads (XHRs, etc).
MaxResourceBufferSize int64 `json:"maxResourceBufferSize,omitempty"` // Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
}
// Enable enables network tracking, network events will now be delivered to
// the client.
//
// parameters:
func Enable() *EnableParams {
return &EnableParams{}
}
// WithMaxTotalBufferSize buffer size in bytes to use when preserving network
// payloads (XHRs, etc).
func (p EnableParams) WithMaxTotalBufferSize(maxTotalBufferSize int64) *EnableParams {
p.MaxTotalBufferSize = maxTotalBufferSize
return &p
}
// WithMaxResourceBufferSize per-resource buffer size in bytes to use when
// preserving network payloads (XHRs, etc).
func (p EnableParams) WithMaxResourceBufferSize(maxResourceBufferSize int64) *EnableParams {
p.MaxResourceBufferSize = maxResourceBufferSize
return &p
}
// Do executes Network.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkEnable, p, nil)
}
// GetAllCookiesParams returns all browser cookies. Depending on the backend
// support, will return detailed cookie information in the cookies field.
type GetAllCookiesParams struct{}
// GetAllCookies returns all browser cookies. Depending on the backend
// support, will return detailed cookie information in the cookies field.
func GetAllCookies() *GetAllCookiesParams {
return &GetAllCookiesParams{}
}
// GetAllCookiesReturns return values.
type GetAllCookiesReturns struct {
Cookies []*Cookie `json:"cookies,omitempty"` // Array of cookie objects.
}
// Do executes Network.getAllCookies against the provided context and
// target handler.
//
// returns:
// cookies - Array of cookie objects.
func (p *GetAllCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
// execute
var res GetAllCookiesReturns
err = h.Execute(ctxt, cdp.CommandNetworkGetAllCookies, nil, &res)
if err != nil {
return nil, err
}
return res.Cookies, nil
}
// GetCertificateParams returns the DER-encoded certificate.
type GetCertificateParams struct {
Origin string `json:"origin"` // Origin to get certificate for.
}
// GetCertificate returns the DER-encoded certificate.
//
// parameters:
// origin - Origin to get certificate for.
func GetCertificate(origin string) *GetCertificateParams {
return &GetCertificateParams{
Origin: origin,
}
}
// GetCertificateReturns return values.
type GetCertificateReturns struct {
TableNames []string `json:"tableNames,omitempty"`
}
// Do executes Network.getCertificate against the provided context and
// target handler.
//
// returns:
// tableNames
func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
// execute
var res GetCertificateReturns
err = h.Execute(ctxt, cdp.CommandNetworkGetCertificate, p, &res)
if err != nil {
return nil, err
}
return res.TableNames, nil
}
// GetCookiesParams returns all browser cookies for the current URL.
// Depending on the backend support, will return detailed cookie information in
// the cookies field.
type GetCookiesParams struct {
Urls []string `json:"urls,omitempty"` // The list of URLs for which applicable cookies will be fetched
}
// GetCookies returns all browser cookies for the current URL. Depending on
// the backend support, will return detailed cookie information in the cookies
// field.
//
// parameters:
func GetCookies() *GetCookiesParams {
return &GetCookiesParams{}
}
// WithUrls the list of URLs for which applicable cookies will be fetched.
func (p GetCookiesParams) WithUrls(urls []string) *GetCookiesParams {
p.Urls = urls
return &p
}
// GetCookiesReturns return values.
type GetCookiesReturns struct {
Cookies []*Cookie `json:"cookies,omitempty"` // Array of cookie objects.
}
// Do executes Network.getCookies against the provided context and
// target handler.
//
// returns:
// cookies - Array of cookie objects.
func (p *GetCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
// execute
var res GetCookiesReturns
err = h.Execute(ctxt, cdp.CommandNetworkGetCookies, p, &res)
if err != nil {
return nil, err
}
return res.Cookies, nil
}
// GetResponseBodyParams returns content served for the given request.
type GetResponseBodyParams struct {
RequestID RequestID `json:"requestId"` // Identifier of the network request to get content for.
}
// GetResponseBody returns content served for the given request.
//
// parameters:
// requestID - Identifier of the network request to get content for.
func GetResponseBody(requestID RequestID) *GetResponseBodyParams {
return &GetResponseBodyParams{
RequestID: requestID,
}
}
// GetResponseBodyReturns return values.
type GetResponseBodyReturns struct {
Body string `json:"body,omitempty"` // Response body.
Base64encoded bool `json:"base64Encoded,omitempty"` // True, if content was sent as base64.
}
// Do executes Network.getResponseBody against the provided context and
// target handler.
//
// returns:
// body - Response body.
func (p *GetResponseBodyParams) Do(ctxt context.Context, h cdp.Handler) (body []byte, err error) {
// execute
var res GetResponseBodyReturns
err = h.Execute(ctxt, cdp.CommandNetworkGetResponseBody, p, &res)
if err != nil {
return nil, err
}
// decode
var dec []byte
if res.Base64encoded {
dec, err = base64.StdEncoding.DecodeString(res.Body)
if err != nil {
return nil, err
}
} else {
dec = []byte(res.Body)
}
return dec, nil
}
// GetResponseBodyForInterceptionParams returns content served for the given
// currently intercepted request.
type GetResponseBodyForInterceptionParams struct {
InterceptionID InterceptionID `json:"interceptionId"` // Identifier for the intercepted request to get body for.
}
// GetResponseBodyForInterception returns content served for the given
// currently intercepted request.
//
// parameters:
// interceptionID - Identifier for the intercepted request to get body for.
func GetResponseBodyForInterception(interceptionID InterceptionID) *GetResponseBodyForInterceptionParams {
return &GetResponseBodyForInterceptionParams{
InterceptionID: interceptionID,
}
}
// GetResponseBodyForInterceptionReturns return values.
type GetResponseBodyForInterceptionReturns struct {
Body string `json:"body,omitempty"` // Response body.
Base64encoded bool `json:"base64Encoded,omitempty"` // True, if content was sent as base64.
}
// Do executes Network.getResponseBodyForInterception against the provided context and
// target handler.
//
// returns:
// body - Response body.
func (p *GetResponseBodyForInterceptionParams) Do(ctxt context.Context, h cdp.Handler) (body []byte, err error) {
// execute
var res GetResponseBodyForInterceptionReturns
err = h.Execute(ctxt, cdp.CommandNetworkGetResponseBodyForInterception, p, &res)
if err != nil {
return nil, err
}
// decode
var dec []byte
if res.Base64encoded {
dec, err = base64.StdEncoding.DecodeString(res.Body)
if err != nil {
return nil, err
}
} else {
dec = []byte(res.Body)
}
return dec, nil
}
// ReplayXHRParams 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.
type ReplayXHRParams struct {
RequestID RequestID `json:"requestId"` // Identifier of XHR to replay.
}
// ReplayXHR 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:
// requestID - Identifier of XHR to replay.
func ReplayXHR(requestID RequestID) *ReplayXHRParams {
return &ReplayXHRParams{
RequestID: requestID,
}
}
// Do executes Network.replayXHR against the provided context and
// target handler.
func (p *ReplayXHRParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkReplayXHR, p, nil)
}
// SearchInResponseBodyParams searches for given string in response content.
type SearchInResponseBodyParams struct {
RequestID RequestID `json:"requestId"` // Identifier of the network response to search.
Query string `json:"query"` // String to search for.
CaseSensitive bool `json:"caseSensitive,omitempty"` // If true, search is case sensitive.
IsRegex bool `json:"isRegex,omitempty"` // If true, treats string parameter as regex.
}
// SearchInResponseBody searches for given string in response content.
//
// parameters:
// requestID - Identifier of the network response to search.
// query - String to search for.
func SearchInResponseBody(requestID RequestID, query string) *SearchInResponseBodyParams {
return &SearchInResponseBodyParams{
RequestID: requestID,
Query: query,
}
}
// WithCaseSensitive if true, search is case sensitive.
func (p SearchInResponseBodyParams) WithCaseSensitive(caseSensitive bool) *SearchInResponseBodyParams {
p.CaseSensitive = caseSensitive
return &p
}
// WithIsRegex if true, treats string parameter as regex.
func (p SearchInResponseBodyParams) WithIsRegex(isRegex bool) *SearchInResponseBodyParams {
p.IsRegex = isRegex
return &p
}
// SearchInResponseBodyReturns return values.
type SearchInResponseBodyReturns struct {
Result []*debugger.SearchMatch `json:"result,omitempty"` // List of search matches.
}
// Do executes Network.searchInResponseBody against the provided context and
// target handler.
//
// returns:
// result - List of search matches.
func (p *SearchInResponseBodyParams) Do(ctxt context.Context, h cdp.Handler) (result []*debugger.SearchMatch, err error) {
// execute
var res SearchInResponseBodyReturns
err = h.Execute(ctxt, cdp.CommandNetworkSearchInResponseBody, p, &res)
if err != nil {
return nil, err
}
return res.Result, nil
}
// SetBlockedURLSParams blocks URLs from loading.
type SetBlockedURLSParams struct {
Urls []string `json:"urls"` // URL patterns to block. Wildcards ('*') are allowed.
}
// SetBlockedURLS blocks URLs from loading.
//
// parameters:
// urls - URL patterns to block. Wildcards ('*') are allowed.
func SetBlockedURLS(urls []string) *SetBlockedURLSParams {
return &SetBlockedURLSParams{
Urls: urls,
}
}
// Do executes Network.setBlockedURLs against the provided context and
// target handler.
func (p *SetBlockedURLSParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkSetBlockedURLS, p, nil)
}
// SetBypassServiceWorkerParams toggles ignoring of service worker for each
// request.
type SetBypassServiceWorkerParams struct {
Bypass bool `json:"bypass"` // Bypass service worker and load from network.
}
// SetBypassServiceWorker toggles ignoring of service worker for each
// request.
//
// parameters:
// bypass - Bypass service worker and load from network.
func SetBypassServiceWorker(bypass bool) *SetBypassServiceWorkerParams {
return &SetBypassServiceWorkerParams{
Bypass: bypass,
}
}
// Do executes Network.setBypassServiceWorker against the provided context and
// target handler.
func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkSetBypassServiceWorker, p, nil)
}
// SetCacheDisabledParams toggles ignoring cache for each request. If true,
// cache will not be used.
type SetCacheDisabledParams struct {
CacheDisabled bool `json:"cacheDisabled"` // Cache disabled state.
}
// SetCacheDisabled toggles ignoring cache for each request. If true, cache
// will not be used.
//
// parameters:
// cacheDisabled - Cache disabled state.
func SetCacheDisabled(cacheDisabled bool) *SetCacheDisabledParams {
return &SetCacheDisabledParams{
CacheDisabled: cacheDisabled,
}
}
// Do executes Network.setCacheDisabled against the provided context and
// target handler.
func (p *SetCacheDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkSetCacheDisabled, p, nil)
}
// SetCookieParams sets a cookie with the given cookie data; may overwrite
// equivalent cookies if they exist.
type SetCookieParams 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
}
// SetCookie sets a cookie with the given cookie data; may overwrite
// equivalent cookies if they exist.
//
// parameters:
// name - Cookie name.
// value - Cookie value.
func SetCookie(name string, value string) *SetCookieParams {
return &SetCookieParams{
Name: name,
Value: value,
}
}
// 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 cookie path.
func (p SetCookieParams) WithPath(path string) *SetCookieParams {
p.Path = path
return &p
}
// WithSecure true if cookie is secure.
func (p SetCookieParams) WithSecure(secure bool) *SetCookieParams {
p.Secure = secure
return &p
}
// WithHTTPOnly true if cookie is http-only.
func (p SetCookieParams) WithHTTPOnly(httpOnly bool) *SetCookieParams {
p.HTTPOnly = httpOnly
return &p
}
// WithSameSite cookie SameSite type.
func (p SetCookieParams) WithSameSite(sameSite CookieSameSite) *SetCookieParams {
p.SameSite = sameSite
return &p
}
// WithExpires cookie expiration date, session cookie if not set.
func (p SetCookieParams) WithExpires(expires *cdp.TimeSinceEpoch) *SetCookieParams {
p.Expires = expires
return &p
}
// SetCookieReturns return values.
type SetCookieReturns struct {
Success bool `json:"success,omitempty"` // True if successfully set cookie.
}
// Do executes Network.setCookie against the provided context and
// target handler.
//
// returns:
// success - True if successfully set cookie.
func (p *SetCookieParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
// execute
var res SetCookieReturns
err = h.Execute(ctxt, cdp.CommandNetworkSetCookie, p, &res)
if err != nil {
return false, err
}
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)
}
// SetDataSizeLimitsForTestParams for testing.
type SetDataSizeLimitsForTestParams struct {
MaxTotalSize int64 `json:"maxTotalSize"` // Maximum total buffer size.
MaxResourceSize int64 `json:"maxResourceSize"` // Maximum per-resource size.
}
// SetDataSizeLimitsForTest for testing.
//
// parameters:
// maxTotalSize - Maximum total buffer size.
// maxResourceSize - Maximum per-resource size.
func SetDataSizeLimitsForTest(maxTotalSize int64, maxResourceSize int64) *SetDataSizeLimitsForTestParams {
return &SetDataSizeLimitsForTestParams{
MaxTotalSize: maxTotalSize,
MaxResourceSize: maxResourceSize,
}
}
// Do executes Network.setDataSizeLimitsForTest against the provided context and
// target handler.
func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkSetDataSizeLimitsForTest, p, nil)
}
// SetExtraHTTPHeadersParams specifies whether to always send extra HTTP
// headers with the requests from this page.
type SetExtraHTTPHeadersParams struct {
Headers Headers `json:"headers"` // Map with extra HTTP headers.
}
// SetExtraHTTPHeaders specifies whether to always send extra HTTP headers
// with the requests from this page.
//
// parameters:
// headers - Map with extra HTTP headers.
func SetExtraHTTPHeaders(headers Headers) *SetExtraHTTPHeadersParams {
return &SetExtraHTTPHeadersParams{
Headers: headers,
}
}
// Do executes Network.setExtraHTTPHeaders against the provided context and
// target handler.
func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkSetExtraHTTPHeaders, p, nil)
}
// SetRequestInterceptionParams sets the requests to intercept that match a
// the provided patterns and optionally resource types.
type SetRequestInterceptionParams struct {
Patterns []*RequestPattern `json:"patterns"` // Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call.
}
// SetRequestInterception sets the requests to intercept that match a the
// provided patterns and optionally resource types.
//
// parameters:
// patterns - Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call.
func SetRequestInterception(patterns []*RequestPattern) *SetRequestInterceptionParams {
return &SetRequestInterceptionParams{
Patterns: patterns,
}
}
// Do executes Network.setRequestInterception against the provided context and
// target handler.
func (p *SetRequestInterceptionParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkSetRequestInterception, p, nil)
}
// SetUserAgentOverrideParams allows overriding user agent with the given
// string.
type SetUserAgentOverrideParams struct {
UserAgent string `json:"userAgent"` // User agent to use.
}
// SetUserAgentOverride allows overriding user agent with the given string.
//
// parameters:
// userAgent - User agent to use.
func SetUserAgentOverride(userAgent string) *SetUserAgentOverrideParams {
return &SetUserAgentOverrideParams{
UserAgent: userAgent,
}
}
// Do executes Network.setUserAgentOverride against the provided context and
// target handler.
func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandNetworkSetUserAgentOverride, p, nil)
}

View File

@ -1,732 +0,0 @@
package network
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/page"
"github.com/knq/chromedp/cdp/runtime"
"github.com/knq/chromedp/cdp/security"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// RequestID unique request identifier.
type RequestID string
// String returns the RequestID as string value.
func (t RequestID) String() string {
return string(t)
}
// InterceptionID unique intercepted request identifier.
type InterceptionID string
// String returns the InterceptionID as string value.
func (t InterceptionID) String() string {
return string(t)
}
// ErrorReason network level fetch failure reason.
type ErrorReason string
// String returns the ErrorReason as string value.
func (t ErrorReason) String() string {
return string(t)
}
// ErrorReason values.
const (
ErrorReasonFailed ErrorReason = "Failed"
ErrorReasonAborted ErrorReason = "Aborted"
ErrorReasonTimedOut ErrorReason = "TimedOut"
ErrorReasonAccessDenied ErrorReason = "AccessDenied"
ErrorReasonConnectionClosed ErrorReason = "ConnectionClosed"
ErrorReasonConnectionReset ErrorReason = "ConnectionReset"
ErrorReasonConnectionRefused ErrorReason = "ConnectionRefused"
ErrorReasonConnectionAborted ErrorReason = "ConnectionAborted"
ErrorReasonConnectionFailed ErrorReason = "ConnectionFailed"
ErrorReasonNameNotResolved ErrorReason = "NameNotResolved"
ErrorReasonInternetDisconnected ErrorReason = "InternetDisconnected"
ErrorReasonAddressUnreachable ErrorReason = "AddressUnreachable"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ErrorReason) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ErrorReason) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ErrorReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ErrorReason(in.String()) {
case ErrorReasonFailed:
*t = ErrorReasonFailed
case ErrorReasonAborted:
*t = ErrorReasonAborted
case ErrorReasonTimedOut:
*t = ErrorReasonTimedOut
case ErrorReasonAccessDenied:
*t = ErrorReasonAccessDenied
case ErrorReasonConnectionClosed:
*t = ErrorReasonConnectionClosed
case ErrorReasonConnectionReset:
*t = ErrorReasonConnectionReset
case ErrorReasonConnectionRefused:
*t = ErrorReasonConnectionRefused
case ErrorReasonConnectionAborted:
*t = ErrorReasonConnectionAborted
case ErrorReasonConnectionFailed:
*t = ErrorReasonConnectionFailed
case ErrorReasonNameNotResolved:
*t = ErrorReasonNameNotResolved
case ErrorReasonInternetDisconnected:
*t = ErrorReasonInternetDisconnected
case ErrorReasonAddressUnreachable:
*t = ErrorReasonAddressUnreachable
default:
in.AddError(errors.New("unknown ErrorReason value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ErrorReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Headers request / response headers as keys / values of JSON object.
type Headers map[string]interface{}
// ConnectionType the underlying connection technology that the browser is
// supposedly using.
type ConnectionType string
// String returns the ConnectionType as string value.
func (t ConnectionType) String() string {
return string(t)
}
// ConnectionType values.
const (
ConnectionTypeNone ConnectionType = "none"
ConnectionTypeCellular2g ConnectionType = "cellular2g"
ConnectionTypeCellular3g ConnectionType = "cellular3g"
ConnectionTypeCellular4g ConnectionType = "cellular4g"
ConnectionTypeBluetooth ConnectionType = "bluetooth"
ConnectionTypeEthernet ConnectionType = "ethernet"
ConnectionTypeWifi ConnectionType = "wifi"
ConnectionTypeWimax ConnectionType = "wimax"
ConnectionTypeOther ConnectionType = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ConnectionType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ConnectionType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ConnectionType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ConnectionType(in.String()) {
case ConnectionTypeNone:
*t = ConnectionTypeNone
case ConnectionTypeCellular2g:
*t = ConnectionTypeCellular2g
case ConnectionTypeCellular3g:
*t = ConnectionTypeCellular3g
case ConnectionTypeCellular4g:
*t = ConnectionTypeCellular4g
case ConnectionTypeBluetooth:
*t = ConnectionTypeBluetooth
case ConnectionTypeEthernet:
*t = ConnectionTypeEthernet
case ConnectionTypeWifi:
*t = ConnectionTypeWifi
case ConnectionTypeWimax:
*t = ConnectionTypeWimax
case ConnectionTypeOther:
*t = ConnectionTypeOther
default:
in.AddError(errors.New("unknown ConnectionType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ConnectionType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// CookieSameSite represents the cookie's 'SameSite' status:
// https://tools.ietf.org/html/draft-west-first-party-cookies.
type CookieSameSite string
// String returns the CookieSameSite as string value.
func (t CookieSameSite) String() string {
return string(t)
}
// CookieSameSite values.
const (
CookieSameSiteStrict CookieSameSite = "Strict"
CookieSameSiteLax CookieSameSite = "Lax"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t CookieSameSite) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t CookieSameSite) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *CookieSameSite) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch CookieSameSite(in.String()) {
case CookieSameSiteStrict:
*t = CookieSameSiteStrict
case CookieSameSiteLax:
*t = CookieSameSiteLax
default:
in.AddError(errors.New("unknown CookieSameSite value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *CookieSameSite) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// ResourceTiming timing information for the request.
type ResourceTiming struct {
RequestTime float64 `json:"requestTime"` // Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime.
ProxyStart float64 `json:"proxyStart"` // Started resolving proxy.
ProxyEnd float64 `json:"proxyEnd"` // Finished resolving proxy.
DNSStart float64 `json:"dnsStart"` // Started DNS address resolve.
DNSEnd float64 `json:"dnsEnd"` // Finished DNS address resolve.
ConnectStart float64 `json:"connectStart"` // Started connecting to the remote host.
ConnectEnd float64 `json:"connectEnd"` // Connected to the remote host.
SslStart float64 `json:"sslStart"` // Started SSL handshake.
SslEnd float64 `json:"sslEnd"` // Finished SSL handshake.
WorkerStart float64 `json:"workerStart"` // Started running ServiceWorker.
WorkerReady float64 `json:"workerReady"` // Finished Starting ServiceWorker.
SendStart float64 `json:"sendStart"` // Started sending request.
SendEnd float64 `json:"sendEnd"` // Finished sending request.
PushStart float64 `json:"pushStart"` // Time the server started pushing request.
PushEnd float64 `json:"pushEnd"` // Time the server finished pushing request.
ReceiveHeadersEnd float64 `json:"receiveHeadersEnd"` // Finished receiving response headers.
}
// ResourcePriority loading priority of a resource request.
type ResourcePriority string
// String returns the ResourcePriority as string value.
func (t ResourcePriority) String() string {
return string(t)
}
// ResourcePriority values.
const (
ResourcePriorityVeryLow ResourcePriority = "VeryLow"
ResourcePriorityLow ResourcePriority = "Low"
ResourcePriorityMedium ResourcePriority = "Medium"
ResourcePriorityHigh ResourcePriority = "High"
ResourcePriorityVeryHigh ResourcePriority = "VeryHigh"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ResourcePriority) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ResourcePriority) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ResourcePriority) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ResourcePriority(in.String()) {
case ResourcePriorityVeryLow:
*t = ResourcePriorityVeryLow
case ResourcePriorityLow:
*t = ResourcePriorityLow
case ResourcePriorityMedium:
*t = ResourcePriorityMedium
case ResourcePriorityHigh:
*t = ResourcePriorityHigh
case ResourcePriorityVeryHigh:
*t = ResourcePriorityVeryHigh
default:
in.AddError(errors.New("unknown ResourcePriority value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ResourcePriority) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Request HTTP request data.
type Request struct {
URL string `json:"url"` // Request URL.
Method string `json:"method"` // HTTP request method.
Headers Headers `json:"headers"` // HTTP request headers.
PostData string `json:"postData,omitempty"` // HTTP POST request data.
MixedContentType security.MixedContentType `json:"mixedContentType,omitempty"` // The mixed content type of the request.
InitialPriority ResourcePriority `json:"initialPriority"` // Priority of the resource request at the time request is sent.
ReferrerPolicy ReferrerPolicy `json:"referrerPolicy"` // The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/
IsLinkPreload bool `json:"isLinkPreload,omitempty"` // Whether is loaded via link preload.
}
// SignedCertificateTimestamp details of a signed certificate timestamp
// (SCT).
type SignedCertificateTimestamp struct {
Status string `json:"status"` // Validation status.
Origin string `json:"origin"` // Origin.
LogDescription string `json:"logDescription"` // Log name / description.
LogID string `json:"logId"` // Log ID.
Timestamp *cdp.TimeSinceEpoch `json:"timestamp"` // Issuance date.
HashAlgorithm string `json:"hashAlgorithm"` // Hash algorithm.
SignatureAlgorithm string `json:"signatureAlgorithm"` // Signature algorithm.
SignatureData string `json:"signatureData"` // Signature data.
}
// SecurityDetails security details about a request.
type SecurityDetails struct {
Protocol string `json:"protocol"` // Protocol name (e.g. "TLS 1.2" or "QUIC").
KeyExchange string `json:"keyExchange"` // Key Exchange used by the connection, or the empty string if not applicable.
KeyExchangeGroup string `json:"keyExchangeGroup,omitempty"` // (EC)DH group used by the connection, if applicable.
Cipher string `json:"cipher"` // Cipher name.
Mac string `json:"mac,omitempty"` // TLS MAC. Note that AEAD ciphers do not have separate MACs.
CertificateID security.CertificateID `json:"certificateId"` // Certificate ID value.
SubjectName string `json:"subjectName"` // Certificate subject name.
SanList []string `json:"sanList"` // Subject Alternative Name (SAN) DNS names and IP addresses.
Issuer string `json:"issuer"` // Name of the issuing CA.
ValidFrom *cdp.TimeSinceEpoch `json:"validFrom"` // Certificate valid from date.
ValidTo *cdp.TimeSinceEpoch `json:"validTo"` // Certificate valid to (expiration) date
SignedCertificateTimestampList []*SignedCertificateTimestamp `json:"signedCertificateTimestampList"` // List of signed certificate timestamps (SCTs).
}
// BlockedReason the reason why request was blocked.
type BlockedReason string
// String returns the BlockedReason as string value.
func (t BlockedReason) String() string {
return string(t)
}
// BlockedReason values.
const (
BlockedReasonCsp BlockedReason = "csp"
BlockedReasonMixedContent BlockedReason = "mixed-content"
BlockedReasonOrigin BlockedReason = "origin"
BlockedReasonInspector BlockedReason = "inspector"
BlockedReasonSubresourceFilter BlockedReason = "subresource-filter"
BlockedReasonOther BlockedReason = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t BlockedReason) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t BlockedReason) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *BlockedReason) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch BlockedReason(in.String()) {
case BlockedReasonCsp:
*t = BlockedReasonCsp
case BlockedReasonMixedContent:
*t = BlockedReasonMixedContent
case BlockedReasonOrigin:
*t = BlockedReasonOrigin
case BlockedReasonInspector:
*t = BlockedReasonInspector
case BlockedReasonSubresourceFilter:
*t = BlockedReasonSubresourceFilter
case BlockedReasonOther:
*t = BlockedReasonOther
default:
in.AddError(errors.New("unknown BlockedReason value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *BlockedReason) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Response HTTP response data.
type Response struct {
URL string `json:"url"` // Response URL. This URL can be different from CachedResource.url in case of redirect.
Status int64 `json:"status"` // HTTP response status code.
StatusText string `json:"statusText"` // HTTP response status text.
Headers Headers `json:"headers"` // HTTP response headers.
HeadersText string `json:"headersText,omitempty"` // HTTP response headers text.
MimeType string `json:"mimeType"` // Resource mimeType as determined by the browser.
RequestHeaders Headers `json:"requestHeaders,omitempty"` // Refined HTTP request headers that were actually transmitted over the network.
RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text.
ConnectionReused bool `json:"connectionReused"` // Specifies whether physical connection was actually reused for this request.
ConnectionID float64 `json:"connectionId"` // Physical connection id that was actually used for this request.
RemoteIPAddress string `json:"remoteIPAddress,omitempty"` // Remote IP address.
RemotePort int64 `json:"remotePort,omitempty"` // Remote port.
FromDiskCache bool `json:"fromDiskCache,omitempty"` // Specifies that the request was served from the disk cache.
FromServiceWorker bool `json:"fromServiceWorker,omitempty"` // Specifies that the request was served from the ServiceWorker.
EncodedDataLength float64 `json:"encodedDataLength"` // Total number of bytes received for this request so far.
Timing *ResourceTiming `json:"timing,omitempty"` // Timing information for the given request.
Protocol string `json:"protocol,omitempty"` // Protocol used to fetch this request.
SecurityState security.State `json:"securityState"` // Security state of the request resource.
SecurityDetails *SecurityDetails `json:"securityDetails,omitempty"` // Security details for the request.
}
// WebSocketRequest webSocket request data.
type WebSocketRequest struct {
Headers Headers `json:"headers"` // HTTP request headers.
}
// WebSocketResponse webSocket response data.
type WebSocketResponse struct {
Status int64 `json:"status"` // HTTP response status code.
StatusText string `json:"statusText"` // HTTP response status text.
Headers Headers `json:"headers"` // HTTP response headers.
HeadersText string `json:"headersText,omitempty"` // HTTP response headers text.
RequestHeaders Headers `json:"requestHeaders,omitempty"` // HTTP request headers.
RequestHeadersText string `json:"requestHeadersText,omitempty"` // HTTP request headers text.
}
// WebSocketFrame webSocket frame data.
type WebSocketFrame struct {
Opcode float64 `json:"opcode"` // WebSocket frame opcode.
Mask bool `json:"mask"` // WebSocke frame mask.
PayloadData string `json:"payloadData"` // WebSocke frame payload data.
}
// CachedResource information about the cached resource.
type CachedResource struct {
URL string `json:"url"` // Resource URL. This is the url of the original network request.
Type page.ResourceType `json:"type"` // Type of this resource.
Response *Response `json:"response,omitempty"` // Cached response data.
BodySize float64 `json:"bodySize"` // Cached response body size.
}
// Initiator information about the request initiator.
type Initiator struct {
Type InitiatorType `json:"type"` // Type of this initiator.
Stack *runtime.StackTrace `json:"stack,omitempty"` // Initiator JavaScript stack trace, set for Script only.
URL string `json:"url,omitempty"` // Initiator URL, set for Parser type or for Script type (when script is importing module).
LineNumber float64 `json:"lineNumber,omitempty"` // Initiator line number, set for Parser type or for Script type (when script is importing module) (0-based).
}
// Cookie cookie object.
type Cookie struct {
Name string `json:"name"` // Cookie name.
Value string `json:"value"` // Cookie value.
Domain string `json:"domain"` // Cookie domain.
Path string `json:"path"` // Cookie path.
Expires float64 `json:"expires"` // Cookie expiration date as the number of seconds since the UNIX epoch.
Size int64 `json:"size"` // Cookie size.
HTTPOnly bool `json:"httpOnly"` // True if cookie is http-only.
Secure bool `json:"secure"` // True if cookie is secure.
Session bool `json:"session"` // True in case of session cookie.
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.
Origin string `json:"origin"` // Origin of the challenger.
Scheme string `json:"scheme"` // The authentication scheme used, such as basic or digest
Realm string `json:"realm"` // The realm of the challenge. May be empty.
}
// AuthChallengeResponse response to an AuthChallenge.
type AuthChallengeResponse struct {
Response AuthChallengeResponseResponse `json:"response"` // The decision on what to do in response to the authorization challenge. Default means deferring to the default behavior of the net stack, which will likely either the Cancel authentication or display a popup dialog box.
Username string `json:"username,omitempty"` // The username to provide, possibly empty. Should only be set if response is ProvideCredentials.
Password string `json:"password,omitempty"` // The password to provide, possibly empty. Should only be set if response is ProvideCredentials.
}
// InterceptionStage stages of the interception to begin intercepting.
// Request will intercept before the request is sent. Response will intercept
// after the response is received.
type InterceptionStage string
// String returns the InterceptionStage as string value.
func (t InterceptionStage) String() string {
return string(t)
}
// InterceptionStage values.
const (
InterceptionStageRequest InterceptionStage = "Request"
InterceptionStageHeadersReceived InterceptionStage = "HeadersReceived"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t InterceptionStage) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t InterceptionStage) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *InterceptionStage) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch InterceptionStage(in.String()) {
case InterceptionStageRequest:
*t = InterceptionStageRequest
case InterceptionStageHeadersReceived:
*t = InterceptionStageHeadersReceived
default:
in.AddError(errors.New("unknown InterceptionStage value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *InterceptionStage) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// RequestPattern request pattern for interception.
type RequestPattern struct {
URLPattern string `json:"urlPattern,omitempty"` // Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is backslash. Omitting is equivalent to "*".
ResourceType page.ResourceType `json:"resourceType,omitempty"` // If set, only requests for matching resource types will be intercepted.
InterceptionStage InterceptionStage `json:"interceptionStage,omitempty"` // Stage at which to begin intercepting requests. Default is Request.
}
// ReferrerPolicy the referrer policy of the request, as defined in
// https://www.w3.org/TR/referrer-policy/.
type ReferrerPolicy string
// String returns the ReferrerPolicy as string value.
func (t ReferrerPolicy) String() string {
return string(t)
}
// ReferrerPolicy values.
const (
ReferrerPolicyUnsafeURL ReferrerPolicy = "unsafe-url"
ReferrerPolicyNoReferrerWhenDowngrade ReferrerPolicy = "no-referrer-when-downgrade"
ReferrerPolicyNoReferrer ReferrerPolicy = "no-referrer"
ReferrerPolicyOrigin ReferrerPolicy = "origin"
ReferrerPolicyOriginWhenCrossOrigin ReferrerPolicy = "origin-when-cross-origin"
ReferrerPolicySameOrigin ReferrerPolicy = "same-origin"
ReferrerPolicyStrictOrigin ReferrerPolicy = "strict-origin"
ReferrerPolicyStrictOriginWhenCrossOrigin ReferrerPolicy = "strict-origin-when-cross-origin"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t ReferrerPolicy) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t ReferrerPolicy) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ReferrerPolicy) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ReferrerPolicy(in.String()) {
case ReferrerPolicyUnsafeURL:
*t = ReferrerPolicyUnsafeURL
case ReferrerPolicyNoReferrerWhenDowngrade:
*t = ReferrerPolicyNoReferrerWhenDowngrade
case ReferrerPolicyNoReferrer:
*t = ReferrerPolicyNoReferrer
case ReferrerPolicyOrigin:
*t = ReferrerPolicyOrigin
case ReferrerPolicyOriginWhenCrossOrigin:
*t = ReferrerPolicyOriginWhenCrossOrigin
case ReferrerPolicySameOrigin:
*t = ReferrerPolicySameOrigin
case ReferrerPolicyStrictOrigin:
*t = ReferrerPolicyStrictOrigin
case ReferrerPolicyStrictOriginWhenCrossOrigin:
*t = ReferrerPolicyStrictOriginWhenCrossOrigin
default:
in.AddError(errors.New("unknown ReferrerPolicy value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *ReferrerPolicy) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// InitiatorType type of this initiator.
type InitiatorType string
// String returns the InitiatorType as string value.
func (t InitiatorType) String() string {
return string(t)
}
// InitiatorType values.
const (
InitiatorTypeParser InitiatorType = "parser"
InitiatorTypeScript InitiatorType = "script"
InitiatorTypePreload InitiatorType = "preload"
InitiatorTypeOther InitiatorType = "other"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t InitiatorType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t InitiatorType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *InitiatorType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch InitiatorType(in.String()) {
case InitiatorTypeParser:
*t = InitiatorTypeParser
case InitiatorTypeScript:
*t = InitiatorTypeScript
case InitiatorTypePreload:
*t = InitiatorTypePreload
case InitiatorTypeOther:
*t = InitiatorTypeOther
default:
in.AddError(errors.New("unknown InitiatorType value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *InitiatorType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// AuthChallengeSource source of the authentication challenge.
type AuthChallengeSource string
// String returns the AuthChallengeSource as string value.
func (t AuthChallengeSource) String() string {
return string(t)
}
// AuthChallengeSource values.
const (
AuthChallengeSourceServer AuthChallengeSource = "Server"
AuthChallengeSourceProxy AuthChallengeSource = "Proxy"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AuthChallengeSource) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AuthChallengeSource) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AuthChallengeSource) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AuthChallengeSource(in.String()) {
case AuthChallengeSourceServer:
*t = AuthChallengeSourceServer
case AuthChallengeSourceProxy:
*t = AuthChallengeSourceProxy
default:
in.AddError(errors.New("unknown AuthChallengeSource value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AuthChallengeSource) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// AuthChallengeResponseResponse the decision on what to do in response to
// the authorization challenge. Default means deferring to the default behavior
// of the net stack, which will likely either the Cancel authentication or
// display a popup dialog box.
type AuthChallengeResponseResponse string
// String returns the AuthChallengeResponseResponse as string value.
func (t AuthChallengeResponseResponse) String() string {
return string(t)
}
// AuthChallengeResponseResponse values.
const (
AuthChallengeResponseResponseDefault AuthChallengeResponseResponse = "Default"
AuthChallengeResponseResponseCancelAuth AuthChallengeResponseResponse = "CancelAuth"
AuthChallengeResponseResponseProvideCredentials AuthChallengeResponseResponse = "ProvideCredentials"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t AuthChallengeResponseResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t AuthChallengeResponseResponse) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *AuthChallengeResponseResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch AuthChallengeResponseResponse(in.String()) {
case AuthChallengeResponseResponseDefault:
*t = AuthChallengeResponseResponseDefault
case AuthChallengeResponseResponseCancelAuth:
*t = AuthChallengeResponseResponseCancelAuth
case AuthChallengeResponseResponseProvideCredentials:
*t = AuthChallengeResponseResponseProvideCredentials
default:
in.AddError(errors.New("unknown AuthChallengeResponseResponse value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *AuthChallengeResponseResponse) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
package overlay
// Code generated by chromedp-gen. DO NOT EDIT.
import (
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/page"
)
// EventInspectNodeRequested fired when the node should be inspected. This
// happens after call to setInspectMode or when user manually inspects an
// element.
type EventInspectNodeRequested struct {
BackendNodeID cdp.BackendNodeID `json:"backendNodeId"` // Id of the node to inspect.
}
// EventNodeHighlightRequested fired when the node should be highlighted.
// This happens after call to setInspectMode.
type EventNodeHighlightRequested struct {
NodeID cdp.NodeID `json:"nodeId"`
}
// EventScreenshotRequested fired when user asks to capture screenshot of
// some area on the page.
type EventScreenshotRequested struct {
Viewport *page.Viewport `json:"viewport"` // Viewport to capture, in CSS.
}
// EventTypes all event types in the domain.
var EventTypes = []cdp.MethodType{
cdp.EventOverlayInspectNodeRequested,
cdp.EventOverlayNodeHighlightRequested,
cdp.EventOverlayScreenshotRequested,
}

View File

@ -1,449 +0,0 @@
// Package overlay provides the Chrome Debugging Protocol
// commands, types, and events for the Overlay domain.
//
// This domain provides various functionality related to drawing atop the
// inspected page.
//
// Generated by the chromedp-gen command.
package overlay
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/dom"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
)
// DisableParams disables domain notifications.
type DisableParams struct{}
// Disable disables domain notifications.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Overlay.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayDisable, nil, nil)
}
// EnableParams enables domain notifications.
type EnableParams struct{}
// Enable enables domain notifications.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Overlay.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayEnable, nil, nil)
}
// GetHighlightObjectForTestParams for testing.
type GetHighlightObjectForTestParams struct {
NodeID cdp.NodeID `json:"nodeId"` // Id of the node to get highlight object for.
}
// GetHighlightObjectForTest for testing.
//
// parameters:
// nodeID - Id of the node to get highlight object for.
func GetHighlightObjectForTest(nodeID cdp.NodeID) *GetHighlightObjectForTestParams {
return &GetHighlightObjectForTestParams{
NodeID: nodeID,
}
}
// GetHighlightObjectForTestReturns return values.
type GetHighlightObjectForTestReturns struct {
Highlight easyjson.RawMessage `json:"highlight,omitempty"`
}
// Do executes Overlay.getHighlightObjectForTest against the provided context and
// target handler.
//
// returns:
// highlight - Highlight data for the node.
func (p *GetHighlightObjectForTestParams) Do(ctxt context.Context, h cdp.Handler) (highlight easyjson.RawMessage, err error) {
// execute
var res GetHighlightObjectForTestReturns
err = h.Execute(ctxt, cdp.CommandOverlayGetHighlightObjectForTest, p, &res)
if err != nil {
return nil, err
}
return res.Highlight, nil
}
// HideHighlightParams hides any highlight.
type HideHighlightParams struct{}
// HideHighlight hides any highlight.
func HideHighlight() *HideHighlightParams {
return &HideHighlightParams{}
}
// Do executes Overlay.hideHighlight against the provided context and
// target handler.
func (p *HideHighlightParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHideHighlight, nil, nil)
}
// HighlightFrameParams highlights owner element of the frame with given id.
type HighlightFrameParams struct {
FrameID cdp.FrameID `json:"frameId"` // Identifier of the frame to highlight.
ContentColor *cdp.RGBA `json:"contentColor,omitempty"` // The content box highlight fill color (default: transparent).
ContentOutlineColor *cdp.RGBA `json:"contentOutlineColor,omitempty"` // The content box highlight outline color (default: transparent).
}
// HighlightFrame highlights owner element of the frame with given id.
//
// parameters:
// frameID - Identifier of the frame to highlight.
func HighlightFrame(frameID cdp.FrameID) *HighlightFrameParams {
return &HighlightFrameParams{
FrameID: frameID,
}
}
// WithContentColor the content box highlight fill color (default:
// transparent).
func (p HighlightFrameParams) WithContentColor(contentColor *cdp.RGBA) *HighlightFrameParams {
p.ContentColor = contentColor
return &p
}
// WithContentOutlineColor the content box highlight outline color (default:
// transparent).
func (p HighlightFrameParams) WithContentOutlineColor(contentOutlineColor *cdp.RGBA) *HighlightFrameParams {
p.ContentOutlineColor = contentOutlineColor
return &p
}
// Do executes Overlay.highlightFrame against the provided context and
// target handler.
func (p *HighlightFrameParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHighlightFrame, p, nil)
}
// HighlightNodeParams highlights DOM node with given id or with the given
// JavaScript object wrapper. Either nodeId or objectId must be specified.
type HighlightNodeParams struct {
HighlightConfig *HighlightConfig `json:"highlightConfig"` // A descriptor for the highlight appearance.
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Identifier of the node to highlight.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Identifier of the backend node to highlight.
ObjectID runtime.RemoteObjectID `json:"objectId,omitempty"` // JavaScript object id of the node to be highlighted.
}
// HighlightNode highlights DOM node with given id or with the given
// JavaScript object wrapper. Either nodeId or objectId must be specified.
//
// parameters:
// highlightConfig - A descriptor for the highlight appearance.
func HighlightNode(highlightConfig *HighlightConfig) *HighlightNodeParams {
return &HighlightNodeParams{
HighlightConfig: highlightConfig,
}
}
// WithNodeID identifier of the node to highlight.
func (p HighlightNodeParams) WithNodeID(nodeID cdp.NodeID) *HighlightNodeParams {
p.NodeID = nodeID
return &p
}
// WithBackendNodeID identifier of the backend node to highlight.
func (p HighlightNodeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *HighlightNodeParams {
p.BackendNodeID = backendNodeID
return &p
}
// WithObjectID JavaScript object id of the node to be highlighted.
func (p HighlightNodeParams) WithObjectID(objectID runtime.RemoteObjectID) *HighlightNodeParams {
p.ObjectID = objectID
return &p
}
// Do executes Overlay.highlightNode against the provided context and
// target handler.
func (p *HighlightNodeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHighlightNode, p, nil)
}
// HighlightQuadParams highlights given quad. Coordinates are absolute with
// respect to the main frame viewport.
type HighlightQuadParams struct {
Quad dom.Quad `json:"quad"` // Quad to highlight
Color *cdp.RGBA `json:"color,omitempty"` // The highlight fill color (default: transparent).
OutlineColor *cdp.RGBA `json:"outlineColor,omitempty"` // The highlight outline color (default: transparent).
}
// HighlightQuad highlights given quad. Coordinates are absolute with respect
// to the main frame viewport.
//
// parameters:
// quad - Quad to highlight
func HighlightQuad(quad dom.Quad) *HighlightQuadParams {
return &HighlightQuadParams{
Quad: quad,
}
}
// WithColor the highlight fill color (default: transparent).
func (p HighlightQuadParams) WithColor(color *cdp.RGBA) *HighlightQuadParams {
p.Color = color
return &p
}
// WithOutlineColor the highlight outline color (default: transparent).
func (p HighlightQuadParams) WithOutlineColor(outlineColor *cdp.RGBA) *HighlightQuadParams {
p.OutlineColor = outlineColor
return &p
}
// Do executes Overlay.highlightQuad against the provided context and
// target handler.
func (p *HighlightQuadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHighlightQuad, p, nil)
}
// HighlightRectParams highlights given rectangle. Coordinates are absolute
// with respect to the main frame viewport.
type HighlightRectParams struct {
X int64 `json:"x"` // X coordinate
Y int64 `json:"y"` // Y coordinate
Width int64 `json:"width"` // Rectangle width
Height int64 `json:"height"` // Rectangle height
Color *cdp.RGBA `json:"color,omitempty"` // The highlight fill color (default: transparent).
OutlineColor *cdp.RGBA `json:"outlineColor,omitempty"` // The highlight outline color (default: transparent).
}
// HighlightRect highlights given rectangle. Coordinates are absolute with
// respect to the main frame viewport.
//
// parameters:
// x - X coordinate
// y - Y coordinate
// width - Rectangle width
// height - Rectangle height
func HighlightRect(x int64, y int64, width int64, height int64) *HighlightRectParams {
return &HighlightRectParams{
X: x,
Y: y,
Width: width,
Height: height,
}
}
// WithColor the highlight fill color (default: transparent).
func (p HighlightRectParams) WithColor(color *cdp.RGBA) *HighlightRectParams {
p.Color = color
return &p
}
// WithOutlineColor the highlight outline color (default: transparent).
func (p HighlightRectParams) WithOutlineColor(outlineColor *cdp.RGBA) *HighlightRectParams {
p.OutlineColor = outlineColor
return &p
}
// Do executes Overlay.highlightRect against the provided context and
// target handler.
func (p *HighlightRectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlayHighlightRect, p, nil)
}
// SetInspectModeParams enters the 'inspect' mode. In this mode, elements
// that user is hovering over are highlighted. Backend then generates
// 'inspectNodeRequested' event upon element selection.
type SetInspectModeParams struct {
Mode InspectMode `json:"mode"` // Set an inspection mode.
HighlightConfig *HighlightConfig `json:"highlightConfig,omitempty"` // A descriptor for the highlight appearance of hovered-over nodes. May be omitted if enabled == false.
}
// SetInspectMode enters the 'inspect' mode. In this mode, elements that user
// is hovering over are highlighted. Backend then generates
// 'inspectNodeRequested' event upon element selection.
//
// parameters:
// mode - Set an inspection mode.
func SetInspectMode(mode InspectMode) *SetInspectModeParams {
return &SetInspectModeParams{
Mode: mode,
}
}
// WithHighlightConfig a descriptor for the highlight appearance of
// hovered-over nodes. May be omitted if enabled == false.
func (p SetInspectModeParams) WithHighlightConfig(highlightConfig *HighlightConfig) *SetInspectModeParams {
p.HighlightConfig = highlightConfig
return &p
}
// Do executes Overlay.setInspectMode against the provided context and
// target handler.
func (p *SetInspectModeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetInspectMode, p, nil)
}
// SetPausedInDebuggerMessageParams [no description].
type SetPausedInDebuggerMessageParams struct {
Message string `json:"message,omitempty"` // The message to display, also triggers resume and step over controls.
}
// SetPausedInDebuggerMessage [no description].
//
// parameters:
func SetPausedInDebuggerMessage() *SetPausedInDebuggerMessageParams {
return &SetPausedInDebuggerMessageParams{}
}
// WithMessage the message to display, also triggers resume and step over
// controls.
func (p SetPausedInDebuggerMessageParams) WithMessage(message string) *SetPausedInDebuggerMessageParams {
p.Message = message
return &p
}
// Do executes Overlay.setPausedInDebuggerMessage against the provided context and
// target handler.
func (p *SetPausedInDebuggerMessageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetPausedInDebuggerMessage, p, nil)
}
// SetShowDebugBordersParams requests that backend shows debug borders on
// layers.
type SetShowDebugBordersParams struct {
Show bool `json:"show"` // True for showing debug borders
}
// SetShowDebugBorders requests that backend shows debug borders on layers.
//
// parameters:
// show - True for showing debug borders
func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
return &SetShowDebugBordersParams{
Show: show,
}
}
// Do executes Overlay.setShowDebugBorders against the provided context and
// target handler.
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowDebugBorders, p, nil)
}
// SetShowFPSCounterParams requests that backend shows the FPS counter.
type SetShowFPSCounterParams struct {
Show bool `json:"show"` // True for showing the FPS counter
}
// SetShowFPSCounter requests that backend shows the FPS counter.
//
// parameters:
// show - True for showing the FPS counter
func SetShowFPSCounter(show bool) *SetShowFPSCounterParams {
return &SetShowFPSCounterParams{
Show: show,
}
}
// Do executes Overlay.setShowFPSCounter against the provided context and
// target handler.
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowFPSCounter, p, nil)
}
// SetShowPaintRectsParams requests that backend shows paint rectangles.
type SetShowPaintRectsParams struct {
Result bool `json:"result"` // True for showing paint rectangles
}
// SetShowPaintRects requests that backend shows paint rectangles.
//
// parameters:
// result - True for showing paint rectangles
func SetShowPaintRects(result bool) *SetShowPaintRectsParams {
return &SetShowPaintRectsParams{
Result: result,
}
}
// Do executes Overlay.setShowPaintRects against the provided context and
// target handler.
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowPaintRects, p, nil)
}
// SetShowScrollBottleneckRectsParams requests that backend shows scroll
// bottleneck rects.
type SetShowScrollBottleneckRectsParams struct {
Show bool `json:"show"` // True for showing scroll bottleneck rects
}
// SetShowScrollBottleneckRects requests that backend shows scroll bottleneck
// rects.
//
// parameters:
// show - True for showing scroll bottleneck rects
func SetShowScrollBottleneckRects(show bool) *SetShowScrollBottleneckRectsParams {
return &SetShowScrollBottleneckRectsParams{
Show: show,
}
}
// Do executes Overlay.setShowScrollBottleneckRects against the provided context and
// target handler.
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowScrollBottleneckRects, p, nil)
}
// SetShowViewportSizeOnResizeParams paints viewport size upon main frame
// resize.
type SetShowViewportSizeOnResizeParams struct {
Show bool `json:"show"` // Whether to paint size or not.
}
// SetShowViewportSizeOnResize paints viewport size upon main frame resize.
//
// parameters:
// show - Whether to paint size or not.
func SetShowViewportSizeOnResize(show bool) *SetShowViewportSizeOnResizeParams {
return &SetShowViewportSizeOnResizeParams{
Show: show,
}
}
// Do executes Overlay.setShowViewportSizeOnResize against the provided context and
// target handler.
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetShowViewportSizeOnResize, p, nil)
}
// SetSuspendedParams [no description].
type SetSuspendedParams struct {
Suspended bool `json:"suspended"` // Whether overlay should be suspended and not consume any resources until resumed.
}
// SetSuspended [no description].
//
// parameters:
// suspended - Whether overlay should be suspended and not consume any resources until resumed.
func SetSuspended(suspended bool) *SetSuspendedParams {
return &SetSuspendedParams{
Suspended: suspended,
}
}
// Do executes Overlay.setSuspended against the provided context and
// target handler.
func (p *SetSuspendedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandOverlaySetSuspended, p, nil)
}

View File

@ -1,74 +0,0 @@
package overlay
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// HighlightConfig configuration data for the highlighting of page elements.
type HighlightConfig struct {
ShowInfo bool `json:"showInfo,omitempty"` // Whether the node info tooltip should be shown (default: false).
ShowRulers bool `json:"showRulers,omitempty"` // Whether the rulers should be shown (default: false).
ShowExtensionLines bool `json:"showExtensionLines,omitempty"` // Whether the extension lines from node to the rulers should be shown (default: false).
DisplayAsMaterial bool `json:"displayAsMaterial,omitempty"`
ContentColor *cdp.RGBA `json:"contentColor,omitempty"` // The content box highlight fill color (default: transparent).
PaddingColor *cdp.RGBA `json:"paddingColor,omitempty"` // The padding highlight fill color (default: transparent).
BorderColor *cdp.RGBA `json:"borderColor,omitempty"` // The border highlight fill color (default: transparent).
MarginColor *cdp.RGBA `json:"marginColor,omitempty"` // The margin highlight fill color (default: transparent).
EventTargetColor *cdp.RGBA `json:"eventTargetColor,omitempty"` // The event target element highlight fill color (default: transparent).
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].
type InspectMode string
// String returns the InspectMode as string value.
func (t InspectMode) String() string {
return string(t)
}
// InspectMode values.
const (
InspectModeSearchForNode InspectMode = "searchForNode"
InspectModeSearchForUAShadowDOM InspectMode = "searchForUAShadowDOM"
InspectModeNone InspectMode = "none"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t InspectMode) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t InspectMode) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *InspectMode) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch InspectMode(in.String()) {
case InspectModeSearchForNode:
*t = InspectModeSearchForNode
case InspectModeSearchForUAShadowDOM:
*t = InspectModeSearchForUAShadowDOM
case InspectModeNone:
*t = InspectModeNone
default:
in.AddError(errors.New("unknown InspectMode value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *InspectMode) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

Some files were not shown because too many files have changed in this diff Show More