Updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-11-02 11:49:15 +07:00
parent 89723e0ce3
commit 289f0eeb04
14 changed files with 1045 additions and 826 deletions

View File

@ -91,6 +91,7 @@ const (
CommandPageGetNavigationHistory MethodType = "Page.getNavigationHistory"
CommandPageNavigateToHistoryEntry MethodType = "Page.navigateToHistoryEntry"
CommandPageGetResourceTree MethodType = "Page.getResourceTree"
CommandPageGetFrameTree MethodType = "Page.getFrameTree"
CommandPageGetResourceContent MethodType = "Page.getResourceContent"
CommandPageSearchInResource MethodType = "Page.searchInResource"
CommandPageSetDocumentContent MethodType = "Page.setDocumentContent"
@ -603,6 +604,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandPageNavigateToHistoryEntry
case CommandPageGetResourceTree:
*t = CommandPageGetResourceTree
case CommandPageGetFrameTree:
*t = CommandPageGetFrameTree
case CommandPageGetResourceContent:
*t = CommandPageGetResourceContent
case CommandPageSearchInResource:

View File

@ -125,6 +125,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandPageGetResourceTree:
v = new(page.GetResourceTreeReturns)
case cdp.CommandPageGetFrameTree:
v = new(page.GetFrameTreeReturns)
case cdp.CommandPageGetResourceContent:
v = new(page.GetResourceContentReturns)

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,6 @@ 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"
@ -233,14 +232,6 @@ type StyleDeclarationEdit struct {
Text string `json:"text"` // New style text.
}
// 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.
}
// 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,

View File

@ -1132,14 +1132,14 @@ func (p *SetFileInputFilesParams) Do(ctxt context.Context, h cdp.Handler) (err e
return h.Execute(ctxt, cdp.CommandDOMSetFileInputFiles, p, nil)
}
// GetBoxModelParams returns boxes for the currently selected nodes.
// GetBoxModelParams returns boxes for the given node.
type GetBoxModelParams struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Identifier of the node.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Identifier of the backend node.
ObjectID runtime.RemoteObjectID `json:"objectId,omitempty"` // JavaScript object id of the node wrapper.
}
// GetBoxModel returns boxes for the currently selected nodes.
// GetBoxModel returns boxes for the given node.
//
// parameters:
func GetBoxModel() *GetBoxModelParams {

View File

@ -4,7 +4,6 @@ package domsnapshot
import (
json "encoding/json"
css "github.com/knq/chromedp/cdp/css"
dom "github.com/knq/chromedp/cdp/dom"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
@ -135,21 +134,21 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot1(in *jlexer.Lexer,
in.Delim('[')
if out.InlineTextNodes == nil {
if !in.IsDelim(']') {
out.InlineTextNodes = make([]*css.InlineTextBox, 0, 8)
out.InlineTextNodes = make([]*InlineTextBox, 0, 8)
} else {
out.InlineTextNodes = []*css.InlineTextBox{}
out.InlineTextNodes = []*InlineTextBox{}
}
} else {
out.InlineTextNodes = (out.InlineTextNodes)[:0]
}
for !in.IsDelim(']') {
var v1 *css.InlineTextBox
var v1 *InlineTextBox
if in.IsNull() {
in.Skip()
v1 = nil
} else {
if v1 == nil {
v1 = new(css.InlineTextBox)
v1 = new(InlineTextBox)
}
(*v1).UnmarshalEasyJSON(in)
}
@ -255,7 +254,102 @@ func (v *LayoutTreeNode) UnmarshalJSON(data []byte) error {
func (v *LayoutTreeNode) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot2(in *jlexer.Lexer, out *GetSnapshotReturns) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot2(in *jlexer.Lexer, out *InlineTextBox) {
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 "boundingBox":
if in.IsNull() {
in.Skip()
out.BoundingBox = nil
} else {
if out.BoundingBox == nil {
out.BoundingBox = new(dom.Rect)
}
(*out.BoundingBox).UnmarshalEasyJSON(in)
}
case "startCharacterIndex":
out.StartCharacterIndex = int64(in.Int64())
case "numCharacters":
out.NumCharacters = int64(in.Int64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot2(out *jwriter.Writer, in InlineTextBox) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"boundingBox\":")
if in.BoundingBox == nil {
out.RawString("null")
} else {
(*in.BoundingBox).MarshalEasyJSON(out)
}
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"startCharacterIndex\":")
out.Int64(int64(in.StartCharacterIndex))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"numCharacters\":")
out.Int64(int64(in.NumCharacters))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v InlineTextBox) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v InlineTextBox) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *InlineTextBox) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *InlineTextBox) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot3(in *jlexer.Lexer, out *GetSnapshotReturns) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -377,7 +471,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot2(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot2(out *jwriter.Writer, in GetSnapshotReturns) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot3(out *jwriter.Writer, in GetSnapshotReturns) {
out.RawByte('{')
first := true
_ = first
@ -456,27 +550,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot2(out *jwriter.Writ
// MarshalJSON supports json.Marshaler interface
func (v GetSnapshotReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot2(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetSnapshotReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot2(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetSnapshotReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot2(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetSnapshotReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot2(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot3(in *jlexer.Lexer, out *GetSnapshotParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot4(in *jlexer.Lexer, out *GetSnapshotParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -528,7 +622,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot3(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot3(out *jwriter.Writer, in GetSnapshotParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot4(out *jwriter.Writer, in GetSnapshotParams) {
out.RawByte('{')
first := true
_ = first
@ -555,27 +649,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot3(out *jwriter.Writ
// MarshalJSON supports json.Marshaler interface
func (v GetSnapshotParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot3(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetSnapshotParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot3(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetSnapshotParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot3(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetSnapshotParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot3(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot4(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot4(in *jlexer.Lexer, out *DOMNode) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot5(in *jlexer.Lexer, out *DOMNode) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -723,7 +817,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot4(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot4(out *jwriter.Writer, in DOMNode) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot5(out *jwriter.Writer, in DOMNode) {
out.RawByte('{')
first := true
_ = first
@ -954,27 +1048,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot4(out *jwriter.Writ
// MarshalJSON supports json.Marshaler interface
func (v DOMNode) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot4(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot5(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DOMNode) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot4(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot5(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DOMNode) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot4(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot5(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DOMNode) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot4(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot5(in *jlexer.Lexer, out *ComputedStyle) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot6(in *jlexer.Lexer, out *ComputedStyle) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1034,7 +1128,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot5(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot5(out *jwriter.Writer, in ComputedStyle) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot6(out *jwriter.Writer, in ComputedStyle) {
out.RawByte('{')
first := true
_ = first
@ -1065,23 +1159,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot5(out *jwriter.Writ
// MarshalJSON supports json.Marshaler interface
func (v ComputedStyle) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot5(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ComputedStyle) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot5(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomsnapshot6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ComputedStyle) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot5(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ComputedStyle) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot5(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomsnapshot6(l, v)
}

View File

@ -4,7 +4,6 @@ package domsnapshot
import (
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/css"
"github.com/knq/chromedp/cdp/dom"
)
@ -36,13 +35,21 @@ type DOMNode struct {
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 []*css.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.
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

View File

@ -4666,6 +4666,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpNetwork40(in *jlexer.Lexer, ou
}
(*out.Request).UnmarshalEasyJSON(in)
}
case "frameId":
(out.FrameID).UnmarshalEasyJSON(in)
case "resourceType":
(out.ResourceType).UnmarshalEasyJSON(in)
case "isNavigationRequest":
@ -4744,6 +4746,12 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpNetwork40(out *jwriter.Writer,
out.RawByte(',')
}
first = false
out.RawString("\"frameId\":")
out.String(string(in.FrameID))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"resourceType\":")
(in.ResourceType).MarshalEasyJSON(out)
if !first {

View File

@ -18,7 +18,7 @@ type EventResourceChangedPriority struct {
// 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 form worker.
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.
@ -37,7 +37,7 @@ type EventRequestServedFromCache struct {
// 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 form worker.
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.
@ -135,6 +135,7 @@ type EventEventSourceMessageReceived struct {
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.
RedirectHeaders Headers `json:"redirectHeaders,omitempty"` // HTTP response headers, only sent if a redirect was intercepted.

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,8 @@ type EventLoadEventFired struct {
// EventLifecycleEvent fired for top level page lifecycle events such as
// navigation, load, paint, etc.
type EventLifecycleEvent struct {
FrameID cdp.FrameID `json:"frameId"` // Id of the frame.
FrameID cdp.FrameID `json:"frameId"` // Id of the frame.
LoaderID cdp.LoaderID `json:"loaderId"` // Loader identifier. Empty string if the request is fetched from worker.
Name string `json:"name"`
Timestamp *cdp.MonotonicTime `json:"timestamp"`
}

View File

@ -334,6 +334,35 @@ func (p *GetResourceTreeParams) Do(ctxt context.Context, h cdp.Handler) (frameTr
return res.FrameTree, nil
}
// GetFrameTreeParams returns present frame tree structure.
type GetFrameTreeParams struct{}
// GetFrameTree returns present frame tree structure.
func GetFrameTree() *GetFrameTreeParams {
return &GetFrameTreeParams{}
}
// GetFrameTreeReturns return values.
type GetFrameTreeReturns struct {
FrameTree *FrameTree `json:"frameTree,omitempty"` // Present frame tree structure.
}
// Do executes Page.getFrameTree against the provided context and
// target handler.
//
// returns:
// frameTree - Present frame tree structure.
func (p *GetFrameTreeParams) Do(ctxt context.Context, h cdp.Handler) (frameTree *FrameTree, err error) {
// execute
var res GetFrameTreeReturns
err = h.Execute(ctxt, cdp.CommandPageGetFrameTree, nil, &res)
if err != nil {
return nil, err
}
return res.FrameTree, nil
}
// GetResourceContentParams returns content of the given resource.
type GetResourceContentParams struct {
FrameID cdp.FrameID `json:"frameId"` // Frame id to get resource for.

View File

@ -105,6 +105,12 @@ type FrameResourceTree struct {
Resources []*FrameResource `json:"resources"` // Information about frame resources.
}
// FrameTree information about the Frame hierarchy.
type FrameTree struct {
Frame *cdp.Frame `json:"frame"` // Frame information for this tree item.
ChildFrames []*FrameTree `json:"childFrames,omitempty"` // Child frames.
}
// ScriptIdentifier unique script identifier.
type ScriptIdentifier string
@ -261,53 +267,6 @@ type AppManifestError struct {
Column int64 `json:"column"` // Error column.
}
// NavigationResponse proceed: allow the navigation; Cancel: cancel the
// navigation; CancelAndIgnore: cancels the navigation and makes the requester
// of the navigation acts like the request was never made.
type NavigationResponse string
// String returns the NavigationResponse as string value.
func (t NavigationResponse) String() string {
return string(t)
}
// NavigationResponse values.
const (
NavigationResponseProceed NavigationResponse = "Proceed"
NavigationResponseCancel NavigationResponse = "Cancel"
NavigationResponseCancelAndIgnore NavigationResponse = "CancelAndIgnore"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t NavigationResponse) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t NavigationResponse) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *NavigationResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch NavigationResponse(in.String()) {
case NavigationResponseProceed:
*t = NavigationResponseProceed
case NavigationResponseCancel:
*t = NavigationResponseCancel
case NavigationResponseCancelAndIgnore:
*t = NavigationResponseCancelAndIgnore
default:
in.AddError(errors.New("unknown NavigationResponse value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *NavigationResponse) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// LayoutViewport layout viewport position and dimensions.
type LayoutViewport struct {
PageX int64 `json:"pageX"` // Horizontal offset relative to the document (CSS pixels).

File diff suppressed because it is too large Load Diff