Updating to latest protocol.json
This commit is contained in:
parent
148e24a615
commit
149612cd65
|
@ -13,20 +13,6 @@ import (
|
|||
"github.com/knq/chromedp/cdp/runtime"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// DisableParams disables animation domain notifications.
|
||||
type DisableParams struct{}
|
||||
|
||||
|
@ -41,54 +27,18 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandAnimationDisable, nil, nil)
|
||||
}
|
||||
|
||||
// GetPlaybackRateParams gets the playback rate of the document timeline.
|
||||
type GetPlaybackRateParams struct{}
|
||||
// EnableParams enables animation domain notifications.
|
||||
type EnableParams struct{}
|
||||
|
||||
// GetPlaybackRate gets the playback rate of the document timeline.
|
||||
func GetPlaybackRate() *GetPlaybackRateParams {
|
||||
return &GetPlaybackRateParams{}
|
||||
// Enable enables animation domain notifications.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// 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
|
||||
// Do executes Animation.enable 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
|
||||
}
|
||||
|
||||
// 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)
|
||||
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.
|
||||
|
@ -127,81 +77,33 @@ func (p *GetCurrentTimeParams) Do(ctxt context.Context, h cdp.Handler) (currentT
|
|||
return res.CurrentTime, 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.
|
||||
// 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{}
|
||||
}
|
||||
|
||||
// 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,
|
||||
}
|
||||
// GetPlaybackRateReturns return values.
|
||||
type GetPlaybackRateReturns struct {
|
||||
PlaybackRate float64 `json:"playbackRate,omitempty"` // Playback rate for animations on page.
|
||||
}
|
||||
|
||||
// Do executes Animation.setPaused against the provided context and
|
||||
// Do executes Animation.getPlaybackRate 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)
|
||||
}
|
||||
|
||||
// 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,
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
return res.PlaybackRate, nil
|
||||
}
|
||||
|
||||
// ReleaseAnimationsParams releases a set of animations to no longer be
|
||||
|
@ -262,3 +164,101 @@ func (p *ResolveAnimationParams) Do(ctxt context.Context, h cdp.Handler) (remote
|
|||
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -6,6 +6,11 @@ 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.
|
||||
|
@ -16,14 +21,9 @@ type EventAnimationStarted struct {
|
|||
Animation *Animation `json:"animation"` // Animation that was started.
|
||||
}
|
||||
|
||||
// EventAnimationCanceled event for when an animation has been cancelled.
|
||||
type EventAnimationCanceled struct {
|
||||
ID string `json:"id"` // Id of the animation that was cancelled.
|
||||
}
|
||||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventAnimationAnimationCanceled,
|
||||
cdp.EventAnimationAnimationCreated,
|
||||
cdp.EventAnimationAnimationStarted,
|
||||
cdp.EventAnimationAnimationCanceled,
|
||||
}
|
||||
|
|
|
@ -12,39 +12,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// EnableParams enables application cache domain notifications.
|
||||
type EnableParams struct{}
|
||||
|
||||
|
@ -59,43 +26,6 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandApplicationCacheEnable, nil, 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
|
||||
}
|
||||
|
||||
// GetApplicationCacheForFrameParams returns relevant application cache data
|
||||
// for the document in given frame.
|
||||
type GetApplicationCacheForFrameParams struct {
|
||||
|
@ -133,3 +63,73 @@ func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h cdp.Handl
|
|||
|
||||
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
|
||||
}
|
||||
|
|
|
@ -29,6 +29,79 @@ 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 {
|
||||
|
@ -69,43 +142,6 @@ func (p *GetWindowForTargetParams) Do(ctxt context.Context, h cdp.Handler) (wind
|
|||
return res.WindowID, res.Bounds, 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
|
||||
}
|
||||
|
||||
// SetWindowBoundsParams set position and/or size of the browser window.
|
||||
type SetWindowBoundsParams struct {
|
||||
WindowID WindowID `json:"windowId"` // Browser window id.
|
||||
|
@ -129,39 +165,3 @@ func SetWindowBounds(windowID WindowID, bounds *Bounds) *SetWindowBoundsParams {
|
|||
func (p *SetWindowBoundsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandBrowserSetWindowBounds, p, 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
|
||||
}
|
||||
|
|
|
@ -12,86 +12,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// DeleteCacheParams deletes a cache.
|
||||
type DeleteCacheParams struct {
|
||||
CacheID CacheID `json:"cacheId"` // Id of cache for deletion.
|
||||
|
@ -137,6 +57,42 @@ 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.
|
||||
|
@ -175,3 +131,47 @@ func (p *RequestCachedResponseParams) Do(ctxt context.Context, h cdp.Handler) (r
|
|||
|
||||
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
|
||||
}
|
||||
|
|
3347
cdp/cdp.go
3347
cdp/cdp.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
844
cdp/css/css.go
844
cdp/css/css.go
|
@ -21,6 +21,138 @@ import (
|
|||
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.
|
||||
|
@ -39,18 +171,152 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandCSSEnable, nil, 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{}
|
||||
// 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.
|
||||
}
|
||||
|
||||
// Do executes CSS.disable against the provided context and
|
||||
// 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 *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandCSSDisable, nil, nil)
|
||||
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
|
||||
|
@ -101,84 +367,34 @@ func (p *GetMatchedStylesForNodeParams) Do(ctxt context.Context, h cdp.Handler)
|
|||
return res.InlineStyle, res.AttributesStyle, res.MatchedCSSRules, res.PseudoElements, res.Inherited, res.CSSKeyframesRules, 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"`
|
||||
// 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{}
|
||||
}
|
||||
|
||||
// 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,
|
||||
}
|
||||
// GetMediaQueriesReturns return values.
|
||||
type GetMediaQueriesReturns struct {
|
||||
Medias []*Media `json:"medias,omitempty"`
|
||||
}
|
||||
|
||||
// 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
|
||||
// Do executes CSS.getMediaQueries 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) {
|
||||
// medias
|
||||
func (p *GetMediaQueriesParams) Do(ctxt context.Context, h cdp.Handler) (medias []*Media, 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
|
||||
}
|
||||
|
||||
// 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)
|
||||
var res GetMediaQueriesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandCSSGetMediaQueries, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.ComputedStyle, nil
|
||||
return res.Medias, nil
|
||||
}
|
||||
|
||||
// GetPlatformFontsForNodeParams requests information about platform fonts
|
||||
|
@ -257,121 +473,33 @@ func (p *GetStyleSheetTextParams) Do(ctxt context.Context, h cdp.Handler) (text
|
|||
return res.Text, nil
|
||||
}
|
||||
|
||||
// CollectClassNamesParams returns all class names from specified stylesheet.
|
||||
type CollectClassNamesParams struct {
|
||||
StyleSheetID StyleSheetID `json:"styleSheetId"`
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// CollectClassNames returns all class names from specified stylesheet.
|
||||
// SetEffectivePropertyValueForNode find a rule with the given active
|
||||
// property for the given node and set the new value for this property.
|
||||
//
|
||||
// parameters:
|
||||
// styleSheetID
|
||||
func CollectClassNames(styleSheetID StyleSheetID) *CollectClassNamesParams {
|
||||
return &CollectClassNamesParams{
|
||||
StyleSheetID: styleSheetID,
|
||||
// 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,
|
||||
}
|
||||
}
|
||||
|
||||
// CollectClassNamesReturns return values.
|
||||
type CollectClassNamesReturns struct {
|
||||
ClassNames []string `json:"classNames,omitempty"` // Class name list.
|
||||
}
|
||||
|
||||
// Do executes CSS.collectClassNames against the provided context and
|
||||
// Do executes CSS.setEffectivePropertyValueForNode 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
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.
|
||||
|
@ -416,44 +544,6 @@ func (p *SetKeyframeKeyParams) Do(ctxt context.Context, h cdp.Handler) (keyText
|
|||
return res.KeyText, 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
|
||||
}
|
||||
|
||||
// SetMediaTextParams modifies the rule selector.
|
||||
type SetMediaTextParams struct {
|
||||
StyleSheetID StyleSheetID `json:"styleSheetId"`
|
||||
|
@ -496,213 +586,123 @@ func (p *SetMediaTextParams) Do(ctxt context.Context, h cdp.Handler) (media *Med
|
|||
return res.Media, 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.
|
||||
// SetRuleSelectorParams modifies the rule selector.
|
||||
type SetRuleSelectorParams struct {
|
||||
StyleSheetID StyleSheetID `json:"styleSheetId"`
|
||||
Range *SourceRange `json:"range"`
|
||||
Selector string `json:"selector"`
|
||||
}
|
||||
|
||||
// CreateStyleSheet creates a new special "via-inspector" stylesheet in the
|
||||
// frame with given frameId.
|
||||
// SetRuleSelector modifies the rule selector.
|
||||
//
|
||||
// parameters:
|
||||
// frameID - Identifier of the frame where "via-inspector" stylesheet should be created.
|
||||
func CreateStyleSheet(frameID cdp.FrameID) *CreateStyleSheetParams {
|
||||
return &CreateStyleSheetParams{
|
||||
FrameID: frameID,
|
||||
// styleSheetID
|
||||
// range
|
||||
// selector
|
||||
func SetRuleSelector(styleSheetID StyleSheetID, rangeVal *SourceRange, selector string) *SetRuleSelectorParams {
|
||||
return &SetRuleSelectorParams{
|
||||
StyleSheetID: styleSheetID,
|
||||
Range: rangeVal,
|
||||
Selector: selector,
|
||||
}
|
||||
}
|
||||
|
||||
// CreateStyleSheetReturns return values.
|
||||
type CreateStyleSheetReturns struct {
|
||||
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // Identifier of the created "via-inspector" stylesheet.
|
||||
// SetRuleSelectorReturns return values.
|
||||
type SetRuleSelectorReturns struct {
|
||||
SelectorList *SelectorList `json:"selectorList,omitempty"` // The resulting selector list after modification.
|
||||
}
|
||||
|
||||
// Do executes CSS.createStyleSheet against the provided context and
|
||||
// Do executes CSS.setRuleSelector 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) {
|
||||
// selectorList - The resulting selector list after modification.
|
||||
func (p *SetRuleSelectorParams) Do(ctxt context.Context, h cdp.Handler) (selectorList *SelectorList, err error) {
|
||||
// execute
|
||||
var res CreateStyleSheetReturns
|
||||
err = h.Execute(ctxt, cdp.CommandCSSCreateStyleSheet, p, &res)
|
||||
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.StyleSheetID, nil
|
||||
return res.SourceMapURL, nil
|
||||
}
|
||||
|
||||
// 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.
|
||||
// SetStyleTextsParams applies specified style edits one after another in the
|
||||
// given order.
|
||||
type SetStyleTextsParams struct {
|
||||
Edits []*StyleDeclarationEdit `json:"edits"`
|
||||
}
|
||||
|
||||
// AddRule inserts a new rule with the given ruleText in a stylesheet with
|
||||
// given styleSheetId, at the position specified by location.
|
||||
// SetStyleTexts applies specified style edits one after another in the given
|
||||
// order.
|
||||
//
|
||||
// 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,
|
||||
// edits
|
||||
func SetStyleTexts(edits []*StyleDeclarationEdit) *SetStyleTextsParams {
|
||||
return &SetStyleTextsParams{
|
||||
Edits: edits,
|
||||
}
|
||||
}
|
||||
|
||||
// AddRuleReturns return values.
|
||||
type AddRuleReturns struct {
|
||||
Rule *Rule `json:"rule,omitempty"` // The newly created rule.
|
||||
// SetStyleTextsReturns return values.
|
||||
type SetStyleTextsReturns struct {
|
||||
Styles []*Style `json:"styles,omitempty"` // The resulting styles after modification.
|
||||
}
|
||||
|
||||
// Do executes CSS.addRule against the provided context and
|
||||
// Do executes CSS.setStyleTexts 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) {
|
||||
// styles - The resulting styles after modification.
|
||||
func (p *SetStyleTextsParams) Do(ctxt context.Context, h cdp.Handler) (styles []*Style, err error) {
|
||||
// execute
|
||||
var res AddRuleReturns
|
||||
err = h.Execute(ctxt, cdp.CommandCSSAddRule, p, &res)
|
||||
var res SetStyleTextsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandCSSSetStyleTexts, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Rule, 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 []PseudoClass `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 []PseudoClass) *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)
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
return res.Styles, nil
|
||||
}
|
||||
|
||||
// StartRuleUsageTrackingParams enables the selector recording.
|
||||
|
@ -719,37 +719,6 @@ func (p *StartRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.Handler) (
|
|||
return h.Execute(ctxt, cdp.CommandCSSStartRuleUsageTracking, nil, 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
|
||||
}
|
||||
|
||||
// StopRuleUsageTrackingParams the list of rules with an indication of
|
||||
// whether these were used.
|
||||
type StopRuleUsageTrackingParams struct{}
|
||||
|
@ -780,3 +749,34 @@ func (p *StopRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.Handler) (r
|
|||
|
||||
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
|
||||
}
|
||||
|
|
|
@ -5531,16 +5531,16 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss49(in *jlexer.Lexer, out *F
|
|||
in.Delim('[')
|
||||
if out.ForcedPseudoClasses == nil {
|
||||
if !in.IsDelim(']') {
|
||||
out.ForcedPseudoClasses = make([]PseudoClass, 0, 4)
|
||||
out.ForcedPseudoClasses = make([]string, 0, 4)
|
||||
} else {
|
||||
out.ForcedPseudoClasses = []PseudoClass{}
|
||||
out.ForcedPseudoClasses = []string{}
|
||||
}
|
||||
} else {
|
||||
out.ForcedPseudoClasses = (out.ForcedPseudoClasses)[:0]
|
||||
}
|
||||
for !in.IsDelim(']') {
|
||||
var v67 PseudoClass
|
||||
(v67).UnmarshalEasyJSON(in)
|
||||
var v67 string
|
||||
v67 = string(in.String())
|
||||
out.ForcedPseudoClasses = append(out.ForcedPseudoClasses, v67)
|
||||
in.WantComma()
|
||||
}
|
||||
|
@ -5586,7 +5586,7 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss49(out *jwriter.Writer, in
|
|||
if v68 > 0 {
|
||||
out.RawByte(',')
|
||||
}
|
||||
(v69).MarshalEasyJSON(out)
|
||||
out.String(string(v69))
|
||||
}
|
||||
out.RawByte(']')
|
||||
}
|
||||
|
|
|
@ -6,13 +6,19 @@ 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{}
|
||||
|
||||
// EventFontsUpdated fires whenever a web font gets loaded.
|
||||
type EventFontsUpdated 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.
|
||||
|
@ -20,12 +26,6 @@ type EventStyleSheetChanged struct {
|
|||
StyleSheetID StyleSheetID `json:"styleSheetId"`
|
||||
}
|
||||
|
||||
// EventStyleSheetAdded fired whenever an active document stylesheet is
|
||||
// added.
|
||||
type EventStyleSheetAdded struct {
|
||||
Header *StyleSheetHeader `json:"header"` // Added stylesheet metainfo.
|
||||
}
|
||||
|
||||
// EventStyleSheetRemoved fired whenever an active document stylesheet is
|
||||
// removed.
|
||||
type EventStyleSheetRemoved struct {
|
||||
|
@ -34,9 +34,9 @@ type EventStyleSheetRemoved struct {
|
|||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventCSSMediaQueryResultChanged,
|
||||
cdp.EventCSSFontsUpdated,
|
||||
cdp.EventCSSStyleSheetChanged,
|
||||
cdp.EventCSSMediaQueryResultChanged,
|
||||
cdp.EventCSSStyleSheetAdded,
|
||||
cdp.EventCSSStyleSheetChanged,
|
||||
cdp.EventCSSStyleSheetRemoved,
|
||||
}
|
||||
|
|
|
@ -283,51 +283,3 @@ func (t *MediaSource) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
func (t *MediaSource) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// PseudoClass [no description].
|
||||
type PseudoClass string
|
||||
|
||||
// String returns the PseudoClass as string value.
|
||||
func (t PseudoClass) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// PseudoClass values.
|
||||
const (
|
||||
PseudoClassActive PseudoClass = "active"
|
||||
PseudoClassFocus PseudoClass = "focus"
|
||||
PseudoClassHover PseudoClass = "hover"
|
||||
PseudoClassVisited PseudoClass = "visited"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t PseudoClass) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t PseudoClass) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *PseudoClass) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch PseudoClass(in.String()) {
|
||||
case PseudoClassActive:
|
||||
*t = PseudoClassActive
|
||||
case PseudoClassFocus:
|
||||
*t = PseudoClassFocus
|
||||
case PseudoClassHover:
|
||||
*t = PseudoClassHover
|
||||
case PseudoClassVisited:
|
||||
*t = PseudoClassVisited
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown PseudoClass value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *PseudoClass) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
|
|
@ -13,22 +13,6 @@ import (
|
|||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// DisableParams disables database tracking, prevents database events from
|
||||
// being sent to the client.
|
||||
type DisableParams struct{}
|
||||
|
@ -45,40 +29,20 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandDatabaseDisable, nil, nil)
|
||||
}
|
||||
|
||||
// GetDatabaseTableNamesParams [no description].
|
||||
type GetDatabaseTableNamesParams struct {
|
||||
DatabaseID ID `json:"databaseId"`
|
||||
// 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{}
|
||||
}
|
||||
|
||||
// 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
|
||||
// Do executes Database.enable 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
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandDatabaseEnable, nil, nil)
|
||||
}
|
||||
|
||||
// ExecuteSQLParams [no description].
|
||||
|
@ -123,3 +87,39 @@ func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.Handler) (columnNames
|
|||
|
||||
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
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -8,45 +8,6 @@ import (
|
|||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// EventBreakpointResolved fired when breakpoint is resolved to an actual
|
||||
// script and location.
|
||||
type EventBreakpointResolved struct {
|
||||
|
@ -69,11 +30,50 @@ type EventPaused struct {
|
|||
// 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.EventDebuggerScriptParsed,
|
||||
cdp.EventDebuggerScriptFailedToParse,
|
||||
cdp.EventDebuggerBreakpointResolved,
|
||||
cdp.EventDebuggerPaused,
|
||||
cdp.EventDebuggerResumed,
|
||||
cdp.EventDebuggerScriptFailedToParse,
|
||||
cdp.EventDebuggerScriptParsed,
|
||||
}
|
||||
|
|
|
@ -12,6 +12,21 @@ import (
|
|||
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
|
||||
|
@ -38,18 +53,3 @@ func SetDeviceOrientationOverride(alpha float64, beta float64, gamma float64) *S
|
|||
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandDeviceOrientationSetDeviceOrientationOverride, p, nil)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
|
1838
cdp/dom/dom.go
1838
cdp/dom/dom.go
File diff suppressed because it is too large
Load Diff
|
@ -6,18 +6,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventDocumentUpdated fired when Document has been totally updated. Node
|
||||
// ids are no longer valid.
|
||||
type EventDocumentUpdated struct{}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// EventAttributeModified fired when Element's attribute is modified.
|
||||
type EventAttributeModified struct {
|
||||
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
|
||||
|
@ -31,12 +19,6 @@ type EventAttributeRemoved struct {
|
|||
Name string `json:"name"` // A ttribute name.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// EventCharacterDataModified mirrors DOMCharacterDataModified event.
|
||||
type EventCharacterDataModified struct {
|
||||
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has changed.
|
||||
|
@ -63,16 +45,20 @@ type EventChildNodeRemoved struct {
|
|||
NodeID cdp.NodeID `json:"nodeId"` // Id of the node that has been removed.
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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.
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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
|
||||
|
@ -89,26 +75,40 @@ type EventPseudoElementRemoved struct {
|
|||
PseudoElementID cdp.NodeID `json:"pseudoElementId"` // The removed pseudo element id.
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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.EventDOMDocumentUpdated,
|
||||
cdp.EventDOMSetChildNodes,
|
||||
cdp.EventDOMAttributeModified,
|
||||
cdp.EventDOMAttributeRemoved,
|
||||
cdp.EventDOMInlineStyleInvalidated,
|
||||
cdp.EventDOMCharacterDataModified,
|
||||
cdp.EventDOMChildNodeCountUpdated,
|
||||
cdp.EventDOMChildNodeInserted,
|
||||
cdp.EventDOMChildNodeRemoved,
|
||||
cdp.EventDOMShadowRootPushed,
|
||||
cdp.EventDOMShadowRootPopped,
|
||||
cdp.EventDOMDistributedNodesUpdated,
|
||||
cdp.EventDOMDocumentUpdated,
|
||||
cdp.EventDOMInlineStyleInvalidated,
|
||||
cdp.EventDOMPseudoElementAdded,
|
||||
cdp.EventDOMPseudoElementRemoved,
|
||||
cdp.EventDOMDistributedNodesUpdated,
|
||||
cdp.EventDOMSetChildNodes,
|
||||
cdp.EventDOMShadowRootPopped,
|
||||
cdp.EventDOMShadowRootPushed,
|
||||
}
|
||||
|
|
|
@ -17,201 +17,6 @@ import (
|
|||
"github.com/knq/chromedp/cdp/runtime"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// GetEventListenersParams returns event listeners of the given object.
|
||||
type GetEventListenersParams struct {
|
||||
ObjectID runtime.RemoteObjectID `json:"objectId"` // Identifier of the object to return listeners for.
|
||||
|
@ -265,3 +70,198 @@ func (p *GetEventListenersParams) Do(ctxt context.Context, h cdp.Handler) (liste
|
|||
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -14,38 +14,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// ClearParams [no description].
|
||||
type ClearParams struct {
|
||||
StorageID *StorageID `json:"storageId"`
|
||||
|
@ -67,6 +35,38 @@ 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"`
|
||||
|
@ -103,6 +103,30 @@ func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h cdp.Handler) (entr
|
|||
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"`
|
||||
|
@ -129,27 +153,3 @@ func SetDOMStorageItem(storageID *StorageID, key string, value string) *SetDOMSt
|
|||
func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandDOMStorageSetDOMStorageItem, p, 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)
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventDomStorageItemsCleared [no description].
|
||||
type EventDomStorageItemsCleared struct {
|
||||
// EventDomStorageItemAdded [no description].
|
||||
type EventDomStorageItemAdded struct {
|
||||
StorageID *StorageID `json:"storageId"`
|
||||
Key string `json:"key"`
|
||||
NewValue string `json:"newValue"`
|
||||
}
|
||||
|
||||
// EventDomStorageItemRemoved [no description].
|
||||
|
@ -17,13 +19,6 @@ type EventDomStorageItemRemoved struct {
|
|||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
// EventDomStorageItemAdded [no description].
|
||||
type EventDomStorageItemAdded struct {
|
||||
StorageID *StorageID `json:"storageId"`
|
||||
Key string `json:"key"`
|
||||
NewValue string `json:"newValue"`
|
||||
}
|
||||
|
||||
// EventDomStorageItemUpdated [no description].
|
||||
type EventDomStorageItemUpdated struct {
|
||||
StorageID *StorageID `json:"storageId"`
|
||||
|
@ -32,10 +27,15 @@ type EventDomStorageItemUpdated struct {
|
|||
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.EventDOMStorageDomStorageItemsCleared,
|
||||
cdp.EventDOMStorageDomStorageItemRemoved,
|
||||
cdp.EventDOMStorageDomStorageItemAdded,
|
||||
cdp.EventDOMStorageDomStorageItemRemoved,
|
||||
cdp.EventDOMStorageDomStorageItemUpdated,
|
||||
cdp.EventDOMStorageDomStorageItemsCleared,
|
||||
}
|
||||
|
|
|
@ -16,6 +16,131 @@ import (
|
|||
"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
|
||||
|
@ -115,164 +240,6 @@ func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler)
|
|||
return h.Execute(ctxt, cdp.CommandEmulationSetDeviceMetricsOverride, p, 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// SetEmitTouchEventsForMouseParams [no description].
|
||||
type SetEmitTouchEventsForMouseParams struct {
|
||||
Enabled bool `json:"enabled"` // Whether touch emulation based on mouse input should be enabled.
|
||||
|
@ -323,54 +290,139 @@ func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h cdp.Handler) (err er
|
|||
return h.Execute(ctxt, cdp.CommandEmulationSetEmulatedMedia, p, 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).
|
||||
// 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
|
||||
}
|
||||
|
||||
// SetCPUThrottlingRate enables CPU throttling to emulate slow CPUs.
|
||||
// SetGeolocationOverride overrides the Geolocation Position or Error.
|
||||
// Omitting any of the parameters emulates position unavailable.
|
||||
//
|
||||
// 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,
|
||||
}
|
||||
func SetGeolocationOverride() *SetGeolocationOverrideParams {
|
||||
return &SetGeolocationOverrideParams{}
|
||||
}
|
||||
|
||||
// Do executes Emulation.setCPUThrottlingRate against the provided context and
|
||||
// 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 *SetCPUThrottlingRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetCPUThrottlingRate, p, nil)
|
||||
func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandEmulationSetGeolocationOverride, p, nil)
|
||||
}
|
||||
|
||||
// CanEmulateParams tells whether emulation is supported.
|
||||
type CanEmulateParams struct{}
|
||||
|
||||
// CanEmulate tells whether emulation is supported.
|
||||
func CanEmulate() *CanEmulateParams {
|
||||
return &CanEmulateParams{}
|
||||
// SetNavigatorOverridesParams overrides value returned by the javascript
|
||||
// navigator object.
|
||||
type SetNavigatorOverridesParams struct {
|
||||
Platform string `json:"platform"` // The platform navigator.platform should return.
|
||||
}
|
||||
|
||||
// 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.
|
||||
// SetNavigatorOverrides overrides value returned by the javascript navigator
|
||||
// object.
|
||||
//
|
||||
// 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
|
||||
// parameters:
|
||||
// platform - The platform navigator.platform should return.
|
||||
func SetNavigatorOverrides(platform string) *SetNavigatorOverridesParams {
|
||||
return &SetNavigatorOverridesParams{
|
||||
Platform: platform,
|
||||
}
|
||||
}
|
||||
|
||||
return res.Result, nil
|
||||
// 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
|
||||
|
@ -429,55 +481,3 @@ func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.Handler) (vi
|
|||
|
||||
return res.VirtualTimeBase, 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
|
|
@ -6,16 +6,16 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventVirtualTimeBudgetExpired notification sent after the virtual time
|
||||
// budget for the current VirtualTimePolicy has run out.
|
||||
type EventVirtualTimeBudgetExpired struct{}
|
||||
|
||||
// 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 {
|
||||
|
@ -24,7 +24,7 @@ type EventVirtualTimePaused struct {
|
|||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventEmulationVirtualTimeBudgetExpired,
|
||||
cdp.EventEmulationVirtualTimeAdvanced,
|
||||
cdp.EventEmulationVirtualTimeBudgetExpired,
|
||||
cdp.EventEmulationVirtualTimePaused,
|
||||
}
|
||||
|
|
|
@ -6,19 +6,19 @@ 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.
|
||||
}
|
||||
|
||||
// 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{}
|
||||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventHeadlessExperimentalNeedsBeginFramesChanged,
|
||||
cdp.EventHeadlessExperimentalMainFrameReadyForScreenshots,
|
||||
cdp.EventHeadlessExperimentalNeedsBeginFramesChanged,
|
||||
}
|
||||
|
|
|
@ -17,34 +17,6 @@ import (
|
|||
"github.com/knq/chromedp/cdp/runtime"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
@ -123,3 +95,31 @@ func (p *BeginFrameParams) Do(ctxt context.Context, h cdp.Handler) (hasDamage bo
|
|||
}
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -11,14 +11,10 @@ type EventAddHeapSnapshotChunk struct {
|
|||
Chunk string `json:"chunk"`
|
||||
}
|
||||
|
||||
// EventResetProfiles [no description].
|
||||
type EventResetProfiles struct{}
|
||||
|
||||
// EventReportHeapSnapshotProgress [no description].
|
||||
type EventReportHeapSnapshotProgress struct {
|
||||
Done int64 `json:"done"`
|
||||
Total int64 `json:"total"`
|
||||
Finished bool `json:"finished,omitempty"`
|
||||
// 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
|
||||
|
@ -31,17 +27,21 @@ type EventLastSeenObjectID struct {
|
|||
Timestamp float64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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.EventHeapProfilerResetProfiles,
|
||||
cdp.EventHeapProfilerReportHeapSnapshotProgress,
|
||||
cdp.EventHeapProfilerLastSeenObjectID,
|
||||
cdp.EventHeapProfilerHeapStatsUpdate,
|
||||
cdp.EventHeapProfilerLastSeenObjectID,
|
||||
cdp.EventHeapProfilerReportHeapSnapshotProgress,
|
||||
cdp.EventHeapProfilerResetProfiles,
|
||||
}
|
||||
|
|
|
@ -13,18 +13,41 @@ import (
|
|||
"github.com/knq/chromedp/cdp/runtime"
|
||||
)
|
||||
|
||||
// EnableParams [no description].
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable [no description].
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
// 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.
|
||||
}
|
||||
|
||||
// Do executes HeapProfiler.enable against the provided context and
|
||||
// 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 *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerEnable, nil, nil)
|
||||
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].
|
||||
|
@ -41,6 +64,154 @@ 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"`
|
||||
|
@ -65,6 +236,35 @@ func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler)
|
|||
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.
|
||||
|
@ -114,203 +314,3 @@ func (p TakeHeapSnapshotParams) WithReportProgress(reportProgress bool) *TakeHea
|
|||
func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandHeapProfilerTakeHeapSnapshot, 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
|
|
@ -1437,7 +1437,126 @@ func (v *DisableParams) UnmarshalJSON(data []byte) error {
|
|||
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb12(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(in *jlexer.Lexer, out *DeleteDatabaseParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(in *jlexer.Lexer, out *DeleteObjectStoreEntriesParams) {
|
||||
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 "securityOrigin":
|
||||
out.SecurityOrigin = string(in.String())
|
||||
case "databaseName":
|
||||
out.DatabaseName = string(in.String())
|
||||
case "objectStoreName":
|
||||
out.ObjectStoreName = string(in.String())
|
||||
case "keyRange":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
out.KeyRange = nil
|
||||
} else {
|
||||
if out.KeyRange == nil {
|
||||
out.KeyRange = new(KeyRange)
|
||||
}
|
||||
(*out.KeyRange).UnmarshalEasyJSON(in)
|
||||
}
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
in.WantComma()
|
||||
}
|
||||
in.Delim('}')
|
||||
if isTopLevel {
|
||||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(out *jwriter.Writer, in DeleteObjectStoreEntriesParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
{
|
||||
const prefix string = ",\"securityOrigin\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.SecurityOrigin))
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"databaseName\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.DatabaseName))
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"objectStoreName\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.ObjectStoreName))
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"keyRange\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
if in.KeyRange == nil {
|
||||
out.RawString("null")
|
||||
} else {
|
||||
(*in.KeyRange).MarshalEasyJSON(out)
|
||||
}
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v DeleteObjectStoreEntriesParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v DeleteObjectStoreEntriesParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *DeleteObjectStoreEntriesParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *DeleteObjectStoreEntriesParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(in *jlexer.Lexer, out *DeleteDatabaseParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -1470,7 +1589,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(in *jlexer.Lexer,
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(out *jwriter.Writer, in DeleteDatabaseParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(out *jwriter.Writer, in DeleteDatabaseParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -1500,27 +1619,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(out *jwriter.Write
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v DeleteDatabaseParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v DeleteDatabaseParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb13(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *DeleteDatabaseParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *DeleteDatabaseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb13(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(in *jlexer.Lexer, out *DatabaseWithObjectStores) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(in *jlexer.Lexer, out *DatabaseWithObjectStores) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -1584,7 +1703,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(in *jlexer.Lexer,
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(out *jwriter.Writer, in DatabaseWithObjectStores) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(out *jwriter.Writer, in DatabaseWithObjectStores) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -1639,27 +1758,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(out *jwriter.Write
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v DatabaseWithObjectStores) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v DatabaseWithObjectStores) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb14(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *DatabaseWithObjectStores) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *DatabaseWithObjectStores) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb14(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(in *jlexer.Lexer, out *DataEntry) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(in *jlexer.Lexer, out *DataEntry) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -1718,7 +1837,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(in *jlexer.Lexer,
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(out *jwriter.Writer, in DataEntry) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(out *jwriter.Writer, in DataEntry) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -1770,27 +1889,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(out *jwriter.Write
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v DataEntry) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v DataEntry) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb15(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *DataEntry) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *DataEntry) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb15(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(l, v)
|
||||
}
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(in *jlexer.Lexer, out *ClearObjectStoreParams) {
|
||||
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb17(in *jlexer.Lexer, out *ClearObjectStoreParams) {
|
||||
isTopLevel := in.IsStart()
|
||||
if in.IsNull() {
|
||||
if isTopLevel {
|
||||
|
@ -1825,7 +1944,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(in *jlexer.Lexer,
|
|||
in.Consumed()
|
||||
}
|
||||
}
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(out *jwriter.Writer, in ClearObjectStoreParams) {
|
||||
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb17(out *jwriter.Writer, in ClearObjectStoreParams) {
|
||||
out.RawByte('{')
|
||||
first := true
|
||||
_ = first
|
||||
|
@ -1865,23 +1984,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(out *jwriter.Write
|
|||
// MarshalJSON supports json.Marshaler interface
|
||||
func (v ClearObjectStoreParams) MarshalJSON() ([]byte, error) {
|
||||
w := jwriter.Writer{}
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(&w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb17(&w, v)
|
||||
return w.Buffer.BuildBytes(), w.Error
|
||||
}
|
||||
|
||||
// MarshalEasyJSON supports easyjson.Marshaler interface
|
||||
func (v ClearObjectStoreParams) MarshalEasyJSON(w *jwriter.Writer) {
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb16(w, v)
|
||||
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpIndexeddb17(w, v)
|
||||
}
|
||||
|
||||
// UnmarshalJSON supports json.Unmarshaler interface
|
||||
func (v *ClearObjectStoreParams) UnmarshalJSON(data []byte) error {
|
||||
r := jlexer.Lexer{Data: data}
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(&r, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb17(&r, v)
|
||||
return r.Error()
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
||||
func (v *ClearObjectStoreParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb16(l, v)
|
||||
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpIndexeddb17(l, v)
|
||||
}
|
||||
|
|
|
@ -12,18 +12,86 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EnableParams enables events from backend.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enables events from backend.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
// 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.
|
||||
}
|
||||
|
||||
// Do executes IndexedDB.enable against the provided context and
|
||||
// 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 *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandIndexedDBEnable, nil, nil)
|
||||
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.
|
||||
|
@ -40,80 +108,18 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandIndexedDBDisable, nil, nil)
|
||||
}
|
||||
|
||||
// RequestDatabaseNamesParams requests database names for given security
|
||||
// origin.
|
||||
type RequestDatabaseNamesParams struct {
|
||||
SecurityOrigin string `json:"securityOrigin"` // Security origin.
|
||||
// EnableParams enables events from backend.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enables events from backend.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// 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
|
||||
// Do executes IndexedDB.enable 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
|
||||
}
|
||||
|
||||
// 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
|
||||
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.
|
||||
|
@ -176,53 +182,78 @@ func (p *RequestDataParams) Do(ctxt context.Context, h cdp.Handler) (objectStore
|
|||
return res.ObjectStoreDataEntries, res.HasMore, nil
|
||||
}
|
||||
|
||||
// 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 {
|
||||
// RequestDatabaseParams requests database with given name in given frame.
|
||||
type RequestDatabaseParams struct {
|
||||
SecurityOrigin string `json:"securityOrigin"` // Security origin.
|
||||
DatabaseName string `json:"databaseName"` // Database name.
|
||||
}
|
||||
|
||||
// DeleteDatabase deletes a database.
|
||||
// RequestDatabase requests database with given name in given frame.
|
||||
//
|
||||
// parameters:
|
||||
// securityOrigin - Security origin.
|
||||
// databaseName - Database name.
|
||||
func DeleteDatabase(securityOrigin string, databaseName string) *DeleteDatabaseParams {
|
||||
return &DeleteDatabaseParams{
|
||||
func RequestDatabase(securityOrigin string, databaseName string) *RequestDatabaseParams {
|
||||
return &RequestDatabaseParams{
|
||||
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)
|
||||
// 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
|
||||
}
|
||||
|
|
|
@ -12,28 +12,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// DispatchKeyEventParams dispatches a key event to the page.
|
||||
type DispatchKeyEventParams struct {
|
||||
Type KeyType `json:"type"` // Type of the key event.
|
||||
|
@ -330,6 +308,28 @@ func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h cdp.Handle
|
|||
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 {
|
||||
|
|
|
@ -12,20 +12,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// DisableParams disables inspector domain notifications.
|
||||
type DisableParams struct{}
|
||||
|
||||
|
@ -39,3 +25,17 @@ func Disable() *DisableParams {
|
|||
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)
|
||||
}
|
||||
|
|
42
cdp/io/io.go
42
cdp/io/io.go
|
@ -15,6 +15,27 @@ import (
|
|||
"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.
|
||||
|
@ -70,27 +91,6 @@ func (p *ReadParams) Do(ctxt context.Context, h cdp.Handler) (data string, eof b
|
|||
return res.Data, res.EOF, nil
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// ResolveBlobParams return UUID of Blob object specified by a remote object
|
||||
// id.
|
||||
type ResolveBlobParams struct {
|
||||
|
|
|
@ -7,19 +7,19 @@ import (
|
|||
"github.com/knq/chromedp/cdp/dom"
|
||||
)
|
||||
|
||||
// EventLayerTreeDidChange [no description].
|
||||
type EventLayerTreeDidChange struct {
|
||||
Layers []*Layer `json:"layers,omitempty"` // Layer tree, absent if not in the comspositing mode.
|
||||
}
|
||||
|
||||
// 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.EventLayerTreeLayerTreeDidChange,
|
||||
cdp.EventLayerTreeLayerPainted,
|
||||
cdp.EventLayerTreeLayerTreeDidChange,
|
||||
}
|
||||
|
|
|
@ -14,34 +14,6 @@ import (
|
|||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// CompositingReasonsParams provides the reasons why the given layer was
|
||||
// composited.
|
||||
type CompositingReasonsParams struct {
|
||||
|
@ -80,40 +52,32 @@ func (p *CompositingReasonsParams) Do(ctxt context.Context, h cdp.Handler) (comp
|
|||
return res.CompositingReasons, nil
|
||||
}
|
||||
|
||||
// MakeSnapshotParams returns the layer snapshot identifier.
|
||||
type MakeSnapshotParams struct {
|
||||
LayerID LayerID `json:"layerId"` // The id of the layer.
|
||||
// DisableParams disables compositing tree inspection.
|
||||
type DisableParams struct{}
|
||||
|
||||
// Disable disables compositing tree inspection.
|
||||
func Disable() *DisableParams {
|
||||
return &DisableParams{}
|
||||
}
|
||||
|
||||
// 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
|
||||
// Do executes LayerTree.disable 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
|
||||
}
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandLayerTreeDisable, nil, nil)
|
||||
}
|
||||
|
||||
return res.SnapshotID, 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.
|
||||
|
@ -152,25 +116,40 @@ func (p *LoadSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID
|
|||
return res.SnapshotID, nil
|
||||
}
|
||||
|
||||
// ReleaseSnapshotParams releases layer snapshot captured by the back-end.
|
||||
type ReleaseSnapshotParams struct {
|
||||
SnapshotID SnapshotID `json:"snapshotId"` // The id of the layer snapshot.
|
||||
// MakeSnapshotParams returns the layer snapshot identifier.
|
||||
type MakeSnapshotParams struct {
|
||||
LayerID LayerID `json:"layerId"` // The id of the layer.
|
||||
}
|
||||
|
||||
// ReleaseSnapshot releases layer snapshot captured by the back-end.
|
||||
// MakeSnapshot returns the layer snapshot identifier.
|
||||
//
|
||||
// parameters:
|
||||
// snapshotID - The id of the layer snapshot.
|
||||
func ReleaseSnapshot(snapshotID SnapshotID) *ReleaseSnapshotParams {
|
||||
return &ReleaseSnapshotParams{
|
||||
SnapshotID: snapshotID,
|
||||
// layerID - The id of the layer.
|
||||
func MakeSnapshot(layerID LayerID) *MakeSnapshotParams {
|
||||
return &MakeSnapshotParams{
|
||||
LayerID: layerID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes LayerTree.releaseSnapshot against the provided context and
|
||||
// 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.
|
||||
func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandLayerTreeReleaseSnapshot, p, nil)
|
||||
//
|
||||
// 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].
|
||||
|
@ -231,6 +210,27 @@ func (p *ProfileSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (timings
|
|||
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 {
|
||||
|
|
|
@ -14,20 +14,18 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EnableParams enables log domain, sends the entries collected so far to the
|
||||
// client by means of the entryAdded notification.
|
||||
type EnableParams struct{}
|
||||
// ClearParams clears the log.
|
||||
type ClearParams 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{}
|
||||
// Clear clears the log.
|
||||
func Clear() *ClearParams {
|
||||
return &ClearParams{}
|
||||
}
|
||||
|
||||
// Do executes Log.enable against the provided context and
|
||||
// Do executes Log.clear 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)
|
||||
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
|
||||
|
@ -46,18 +44,20 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandLogDisable, nil, nil)
|
||||
}
|
||||
|
||||
// ClearParams clears the log.
|
||||
type ClearParams struct{}
|
||||
// EnableParams enables log domain, sends the entries collected so far to the
|
||||
// client by means of the entryAdded notification.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Clear clears the log.
|
||||
func Clear() *ClearParams {
|
||||
return &ClearParams{}
|
||||
// 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.clear against the provided context and
|
||||
// Do executes Log.enable 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)
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandLogEnable, nil, nil)
|
||||
}
|
||||
|
||||
// StartViolationsReportParams start violation reporting.
|
||||
|
|
|
@ -7,43 +7,6 @@ import (
|
|||
"github.com/knq/chromedp/cdp/page"
|
||||
)
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// EventRequestServedFromCache fired if request ended up loading from cache.
|
||||
type EventRequestServedFromCache struct {
|
||||
RequestID RequestID `json:"requestId"` // Request identifier.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// EventDataReceived fired when data chunk was received over the network.
|
||||
type EventDataReceived struct {
|
||||
RequestID RequestID `json:"requestId"` // Request identifier.
|
||||
|
@ -52,11 +15,14 @@ type EventDataReceived struct {
|
|||
EncodedDataLength int64 `json:"encodedDataLength"` // Actual bytes received (might be less than dataLength for compressed encodings).
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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.
|
||||
|
@ -69,65 +35,11 @@ type EventLoadingFailed struct {
|
|||
BlockedReason BlockedReason `json:"blockedReason,omitempty"` // The reason why loading was blocked, if any.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// EventWebSocketClosed fired when WebSocket is closed.
|
||||
type EventWebSocketClosed struct {
|
||||
RequestID RequestID `json:"requestId"` // Request identifier.
|
||||
Timestamp *cdp.MonotonicTime `json:"timestamp"` // Timestamp.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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
|
||||
|
@ -145,22 +57,110 @@ type EventRequestIntercepted struct {
|
|||
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.EventNetworkResourceChangedPriority,
|
||||
cdp.EventNetworkRequestWillBeSent,
|
||||
cdp.EventNetworkRequestServedFromCache,
|
||||
cdp.EventNetworkResponseReceived,
|
||||
cdp.EventNetworkDataReceived,
|
||||
cdp.EventNetworkLoadingFinished,
|
||||
cdp.EventNetworkLoadingFailed,
|
||||
cdp.EventNetworkWebSocketWillSendHandshakeRequest,
|
||||
cdp.EventNetworkWebSocketHandshakeResponseReceived,
|
||||
cdp.EventNetworkWebSocketCreated,
|
||||
cdp.EventNetworkWebSocketClosed,
|
||||
cdp.EventNetworkWebSocketFrameReceived,
|
||||
cdp.EventNetworkWebSocketFrameError,
|
||||
cdp.EventNetworkWebSocketFrameSent,
|
||||
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,
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,12 +7,6 @@ import (
|
|||
"github.com/knq/chromedp/cdp/page"
|
||||
)
|
||||
|
||||
// EventNodeHighlightRequested fired when the node should be highlighted.
|
||||
// This happens after call to setInspectMode.
|
||||
type EventNodeHighlightRequested struct {
|
||||
NodeID cdp.NodeID `json:"nodeId"`
|
||||
}
|
||||
|
||||
// EventInspectNodeRequested fired when the node should be inspected. This
|
||||
// happens after call to setInspectMode or when user manually inspects an
|
||||
// element.
|
||||
|
@ -20,6 +14,12 @@ 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 {
|
||||
|
@ -28,7 +28,7 @@ type EventScreenshotRequested struct {
|
|||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventOverlayNodeHighlightRequested,
|
||||
cdp.EventOverlayInspectNodeRequested,
|
||||
cdp.EventOverlayNodeHighlightRequested,
|
||||
cdp.EventOverlayScreenshotRequested,
|
||||
}
|
||||
|
|
|
@ -18,20 +18,6 @@ import (
|
|||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// DisableParams disables domain notifications.
|
||||
type DisableParams struct{}
|
||||
|
||||
|
@ -46,192 +32,186 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandOverlayDisable, nil, nil)
|
||||
}
|
||||
|
||||
// SetShowPaintRectsParams requests that backend shows paint rectangles.
|
||||
type SetShowPaintRectsParams struct {
|
||||
Result bool `json:"result"` // True for showing paint rectangles
|
||||
// EnableParams enables domain notifications.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enables domain notifications.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// SetShowPaintRects requests that backend shows paint rectangles.
|
||||
// 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:
|
||||
// result - True for showing paint rectangles
|
||||
func SetShowPaintRects(result bool) *SetShowPaintRectsParams {
|
||||
return &SetShowPaintRectsParams{
|
||||
Result: result,
|
||||
// nodeID - Id of the node to get highlight object for.
|
||||
func GetHighlightObjectForTest(nodeID cdp.NodeID) *GetHighlightObjectForTestParams {
|
||||
return &GetHighlightObjectForTestParams{
|
||||
NodeID: nodeID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Overlay.setShowPaintRects against the provided context and
|
||||
// GetHighlightObjectForTestReturns return values.
|
||||
type GetHighlightObjectForTestReturns struct {
|
||||
Highlight easyjson.RawMessage `json:"highlight,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Overlay.getHighlightObjectForTest 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)
|
||||
//
|
||||
// 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
|
||||
}
|
||||
|
||||
// SetShowDebugBordersParams requests that backend shows debug borders on
|
||||
// layers.
|
||||
type SetShowDebugBordersParams struct {
|
||||
Show bool `json:"show"` // True for showing debug borders
|
||||
// HideHighlightParams hides any highlight.
|
||||
type HideHighlightParams struct{}
|
||||
|
||||
// HideHighlight hides any highlight.
|
||||
func HideHighlight() *HideHighlightParams {
|
||||
return &HideHighlightParams{}
|
||||
}
|
||||
|
||||
// SetShowDebugBorders requests that backend shows debug borders on layers.
|
||||
// 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:
|
||||
// show - True for showing debug borders
|
||||
func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
|
||||
return &SetShowDebugBordersParams{
|
||||
Show: show,
|
||||
// frameID - Identifier of the frame to highlight.
|
||||
func HighlightFrame(frameID cdp.FrameID) *HighlightFrameParams {
|
||||
return &HighlightFrameParams{
|
||||
FrameID: frameID,
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
// WithContentColor the content box highlight fill color (default:
|
||||
// transparent).
|
||||
func (p HighlightFrameParams) WithContentColor(contentColor *cdp.RGBA) *HighlightFrameParams {
|
||||
p.ContentColor = contentColor
|
||||
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)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
// 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.setInspectMode against the provided context and
|
||||
// Do executes Overlay.highlightFrame 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)
|
||||
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
|
||||
|
@ -280,170 +260,190 @@ func (p *HighlightRectParams) Do(ctxt context.Context, h cdp.Handler) (err error
|
|||
return h.Execute(ctxt, cdp.CommandOverlayHighlightRect, 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).
|
||||
// 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.
|
||||
}
|
||||
|
||||
// HighlightQuad highlights given quad. Coordinates are absolute with respect
|
||||
// to the main frame viewport.
|
||||
// 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:
|
||||
// quad - Quad to highlight
|
||||
func HighlightQuad(quad dom.Quad) *HighlightQuadParams {
|
||||
return &HighlightQuadParams{
|
||||
Quad: quad,
|
||||
// mode - Set an inspection mode.
|
||||
func SetInspectMode(mode InspectMode) *SetInspectModeParams {
|
||||
return &SetInspectModeParams{
|
||||
Mode: mode,
|
||||
}
|
||||
}
|
||||
|
||||
// WithColor the highlight fill color (default: transparent).
|
||||
func (p HighlightQuadParams) WithColor(color *cdp.RGBA) *HighlightQuadParams {
|
||||
p.Color = color
|
||||
// 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
|
||||
}
|
||||
|
||||
// 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
|
||||
// Do executes Overlay.setInspectMode 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)
|
||||
func (p *SetInspectModeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandOverlaySetInspectMode, 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.
|
||||
// SetPausedInDebuggerMessageParams [no description].
|
||||
type SetPausedInDebuggerMessageParams struct {
|
||||
Message string `json:"message,omitempty"` // The message to display, also triggers resume and step over controls.
|
||||
}
|
||||
|
||||
// HighlightNode highlights DOM node with given id or with the given
|
||||
// JavaScript object wrapper. Either nodeId or objectId must be specified.
|
||||
// SetPausedInDebuggerMessage [no description].
|
||||
//
|
||||
// parameters:
|
||||
// highlightConfig - A descriptor for the highlight appearance.
|
||||
func HighlightNode(highlightConfig *HighlightConfig) *HighlightNodeParams {
|
||||
return &HighlightNodeParams{
|
||||
HighlightConfig: highlightConfig,
|
||||
}
|
||||
func SetPausedInDebuggerMessage() *SetPausedInDebuggerMessageParams {
|
||||
return &SetPausedInDebuggerMessageParams{}
|
||||
}
|
||||
|
||||
// WithNodeID identifier of the node to highlight.
|
||||
func (p HighlightNodeParams) WithNodeID(nodeID cdp.NodeID) *HighlightNodeParams {
|
||||
p.NodeID = nodeID
|
||||
// WithMessage the message to display, also triggers resume and step over
|
||||
// controls.
|
||||
func (p SetPausedInDebuggerMessageParams) WithMessage(message string) *SetPausedInDebuggerMessageParams {
|
||||
p.Message = message
|
||||
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
|
||||
// Do executes Overlay.setPausedInDebuggerMessage 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)
|
||||
func (p *SetPausedInDebuggerMessageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandOverlaySetPausedInDebuggerMessage, p, 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).
|
||||
// SetShowDebugBordersParams requests that backend shows debug borders on
|
||||
// layers.
|
||||
type SetShowDebugBordersParams struct {
|
||||
Show bool `json:"show"` // True for showing debug borders
|
||||
}
|
||||
|
||||
// HighlightFrame highlights owner element of the frame with given id.
|
||||
// SetShowDebugBorders requests that backend shows debug borders on layers.
|
||||
//
|
||||
// parameters:
|
||||
// frameID - Identifier of the frame to highlight.
|
||||
func HighlightFrame(frameID cdp.FrameID) *HighlightFrameParams {
|
||||
return &HighlightFrameParams{
|
||||
FrameID: frameID,
|
||||
// show - True for showing debug borders
|
||||
func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
|
||||
return &SetShowDebugBordersParams{
|
||||
Show: show,
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
// Do executes Overlay.setShowDebugBorders 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)
|
||||
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandOverlaySetShowDebugBorders, p, nil)
|
||||
}
|
||||
|
||||
// HideHighlightParams hides any highlight.
|
||||
type HideHighlightParams struct{}
|
||||
|
||||
// HideHighlight hides any highlight.
|
||||
func HideHighlight() *HideHighlightParams {
|
||||
return &HideHighlightParams{}
|
||||
// SetShowFPSCounterParams requests that backend shows the FPS counter.
|
||||
type SetShowFPSCounterParams struct {
|
||||
Show bool `json:"show"` // True for showing the FPS counter
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// GetHighlightObjectForTestParams for testing.
|
||||
type GetHighlightObjectForTestParams struct {
|
||||
NodeID cdp.NodeID `json:"nodeId"` // Id of the node to get highlight object for.
|
||||
}
|
||||
|
||||
// GetHighlightObjectForTest for testing.
|
||||
// SetShowFPSCounter requests that backend shows the FPS counter.
|
||||
//
|
||||
// parameters:
|
||||
// nodeID - Id of the node to get highlight object for.
|
||||
func GetHighlightObjectForTest(nodeID cdp.NodeID) *GetHighlightObjectForTestParams {
|
||||
return &GetHighlightObjectForTestParams{
|
||||
NodeID: nodeID,
|
||||
// show - True for showing the FPS counter
|
||||
func SetShowFPSCounter(show bool) *SetShowFPSCounterParams {
|
||||
return &SetShowFPSCounterParams{
|
||||
Show: show,
|
||||
}
|
||||
}
|
||||
|
||||
// GetHighlightObjectForTestReturns return values.
|
||||
type GetHighlightObjectForTestReturns struct {
|
||||
Highlight easyjson.RawMessage `json:"highlight,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Overlay.getHighlightObjectForTest against the provided context and
|
||||
// Do executes Overlay.setShowFPSCounter 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
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -1680,6 +1680,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPage18(in *jlexer.Lexer, out *
|
|||
out.PageRanges = string(in.String())
|
||||
case "ignoreInvalidPageRanges":
|
||||
out.IgnoreInvalidPageRanges = bool(in.Bool())
|
||||
case "headerTemplate":
|
||||
out.HeaderTemplate = string(in.String())
|
||||
case "footerTemplate":
|
||||
out.FooterTemplate = string(in.String())
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -1814,6 +1818,26 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPage18(out *jwriter.Writer, in
|
|||
}
|
||||
out.Bool(bool(in.IgnoreInvalidPageRanges))
|
||||
}
|
||||
if in.HeaderTemplate != "" {
|
||||
const prefix string = ",\"headerTemplate\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.HeaderTemplate))
|
||||
}
|
||||
if in.FooterTemplate != "" {
|
||||
const prefix string = ",\"footerTemplate\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.FooterTemplate))
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
|
|
|
@ -12,20 +12,6 @@ type EventDomContentEventFired struct {
|
|||
Timestamp *cdp.MonotonicTime `json:"timestamp"`
|
||||
}
|
||||
|
||||
// EventLoadEventFired [no description].
|
||||
type EventLoadEventFired struct {
|
||||
Timestamp *cdp.MonotonicTime `json:"timestamp"`
|
||||
}
|
||||
|
||||
// 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.
|
||||
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"`
|
||||
}
|
||||
|
||||
// EventFrameAttached fired when frame has been attached to its parent.
|
||||
type EventFrameAttached struct {
|
||||
FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has been attached.
|
||||
|
@ -33,15 +19,33 @@ type EventFrameAttached struct {
|
|||
Stack *runtime.StackTrace `json:"stack,omitempty"` // JavaScript stack trace of when frame was attached, only set if frame initiated from script.
|
||||
}
|
||||
|
||||
// EventFrameClearedScheduledNavigation fired when frame no longer has a
|
||||
// scheduled navigation.
|
||||
type EventFrameClearedScheduledNavigation struct {
|
||||
FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has cleared its scheduled navigation.
|
||||
}
|
||||
|
||||
// EventFrameDetached fired when frame has been detached from its parent.
|
||||
type EventFrameDetached struct {
|
||||
FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has been detached.
|
||||
}
|
||||
|
||||
// EventFrameNavigated fired once navigation of the frame has completed.
|
||||
// Frame is now associated with the new loader.
|
||||
type EventFrameNavigated struct {
|
||||
Frame *cdp.Frame `json:"frame"` // Frame object.
|
||||
}
|
||||
|
||||
// EventFrameDetached fired when frame has been detached from its parent.
|
||||
type EventFrameDetached struct {
|
||||
FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has been detached.
|
||||
// EventFrameResized [no description].
|
||||
type EventFrameResized struct{}
|
||||
|
||||
// EventFrameScheduledNavigation fired when frame schedules a potential
|
||||
// navigation.
|
||||
type EventFrameScheduledNavigation struct {
|
||||
FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has scheduled a navigation.
|
||||
Delay float64 `json:"delay"` // Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start.
|
||||
Reason FrameScheduledNavigationReason `json:"reason"` // The reason for the navigation.
|
||||
URL string `json:"url"` // The destination URL for the scheduled navigation.
|
||||
}
|
||||
|
||||
// EventFrameStartedLoading fired when frame has started loading.
|
||||
|
@ -54,23 +58,18 @@ type EventFrameStoppedLoading struct {
|
|||
FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has stopped loading.
|
||||
}
|
||||
|
||||
// EventFrameScheduledNavigation fired when frame schedules a potential
|
||||
// navigation.
|
||||
type EventFrameScheduledNavigation struct {
|
||||
FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has scheduled a navigation.
|
||||
Delay float64 `json:"delay"` // Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start.
|
||||
Reason FrameScheduledNavigationReason `json:"reason"` // The reason for the navigation.
|
||||
URL string `json:"url"` // The destination URL for the scheduled navigation.
|
||||
}
|
||||
// EventInterstitialHidden fired when interstitial page was hidden.
|
||||
type EventInterstitialHidden struct{}
|
||||
|
||||
// EventFrameClearedScheduledNavigation fired when frame no longer has a
|
||||
// scheduled navigation.
|
||||
type EventFrameClearedScheduledNavigation struct {
|
||||
FrameID cdp.FrameID `json:"frameId"` // Id of the frame that has cleared its scheduled navigation.
|
||||
}
|
||||
// EventInterstitialShown fired when interstitial page was shown.
|
||||
type EventInterstitialShown struct{}
|
||||
|
||||
// EventFrameResized [no description].
|
||||
type EventFrameResized struct{}
|
||||
// EventJavascriptDialogClosed fired when a JavaScript initiated dialog
|
||||
// (alert, confirm, prompt, or onbeforeunload) has been closed.
|
||||
type EventJavascriptDialogClosed struct {
|
||||
Result bool `json:"result"` // Whether dialog was confirmed.
|
||||
UserInput string `json:"userInput"` // User input in case of prompt.
|
||||
}
|
||||
|
||||
// EventJavascriptDialogOpening fired when a JavaScript initiated dialog
|
||||
// (alert, confirm, prompt, or onbeforeunload) is about to open.
|
||||
|
@ -81,11 +80,18 @@ type EventJavascriptDialogOpening struct {
|
|||
DefaultPrompt string `json:"defaultPrompt,omitempty"` // Default dialog prompt.
|
||||
}
|
||||
|
||||
// EventJavascriptDialogClosed fired when a JavaScript initiated dialog
|
||||
// (alert, confirm, prompt, or onbeforeunload) has been closed.
|
||||
type EventJavascriptDialogClosed struct {
|
||||
Result bool `json:"result"` // Whether dialog was confirmed.
|
||||
UserInput string `json:"userInput"` // User input in case of prompt.
|
||||
// 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.
|
||||
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"`
|
||||
}
|
||||
|
||||
// EventLoadEventFired [no description].
|
||||
type EventLoadEventFired struct {
|
||||
Timestamp *cdp.MonotonicTime `json:"timestamp"`
|
||||
}
|
||||
|
||||
// EventScreencastFrame compressed image data requested by the
|
||||
|
@ -102,12 +108,6 @@ type EventScreencastVisibilityChanged struct {
|
|||
Visible bool `json:"visible"` // True if the page is visible.
|
||||
}
|
||||
|
||||
// EventInterstitialShown fired when interstitial page was shown.
|
||||
type EventInterstitialShown struct{}
|
||||
|
||||
// EventInterstitialHidden fired when interstitial page was hidden.
|
||||
type EventInterstitialHidden struct{}
|
||||
|
||||
// EventWindowOpen fired when a new window is going to be opened, via
|
||||
// window.open(), link click, form submission, etc.
|
||||
type EventWindowOpen struct {
|
||||
|
@ -120,21 +120,21 @@ type EventWindowOpen struct {
|
|||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventPageDomContentEventFired,
|
||||
cdp.EventPageLoadEventFired,
|
||||
cdp.EventPageLifecycleEvent,
|
||||
cdp.EventPageFrameAttached,
|
||||
cdp.EventPageFrameNavigated,
|
||||
cdp.EventPageFrameClearedScheduledNavigation,
|
||||
cdp.EventPageFrameDetached,
|
||||
cdp.EventPageFrameNavigated,
|
||||
cdp.EventPageFrameResized,
|
||||
cdp.EventPageFrameScheduledNavigation,
|
||||
cdp.EventPageFrameStartedLoading,
|
||||
cdp.EventPageFrameStoppedLoading,
|
||||
cdp.EventPageFrameScheduledNavigation,
|
||||
cdp.EventPageFrameClearedScheduledNavigation,
|
||||
cdp.EventPageFrameResized,
|
||||
cdp.EventPageJavascriptDialogOpening,
|
||||
cdp.EventPageInterstitialHidden,
|
||||
cdp.EventPageInterstitialShown,
|
||||
cdp.EventPageJavascriptDialogClosed,
|
||||
cdp.EventPageJavascriptDialogOpening,
|
||||
cdp.EventPageLifecycleEvent,
|
||||
cdp.EventPageLoadEventFired,
|
||||
cdp.EventPageScreencastFrame,
|
||||
cdp.EventPageScreencastVisibilityChanged,
|
||||
cdp.EventPageInterstitialShown,
|
||||
cdp.EventPageInterstitialHidden,
|
||||
cdp.EventPageWindowOpen,
|
||||
}
|
||||
|
|
1397
cdp/page/page.go
1397
cdp/page/page.go
File diff suppressed because it is too large
Load Diff
|
@ -394,48 +394,6 @@ func (t *CaptureScreenshotFormat) UnmarshalJSON(buf []byte) error {
|
|||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// ScreencastFormat image compression format.
|
||||
type ScreencastFormat string
|
||||
|
||||
// String returns the ScreencastFormat as string value.
|
||||
func (t ScreencastFormat) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// ScreencastFormat values.
|
||||
const (
|
||||
ScreencastFormatJpeg ScreencastFormat = "jpeg"
|
||||
ScreencastFormatPng ScreencastFormat = "png"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t ScreencastFormat) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t ScreencastFormat) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *ScreencastFormat) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch ScreencastFormat(in.String()) {
|
||||
case ScreencastFormatJpeg:
|
||||
*t = ScreencastFormatJpeg
|
||||
case ScreencastFormatPng:
|
||||
*t = ScreencastFormatPng
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown ScreencastFormat value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *ScreencastFormat) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// SetDownloadBehaviorBehavior whether to allow all or deny all download
|
||||
// requests, or use default Chrome behavior if available (otherwise deny).
|
||||
type SetDownloadBehaviorBehavior string
|
||||
|
@ -481,3 +439,45 @@ func (t *SetDownloadBehaviorBehavior) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
|||
func (t *SetDownloadBehaviorBehavior) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// ScreencastFormat image compression format.
|
||||
type ScreencastFormat string
|
||||
|
||||
// String returns the ScreencastFormat as string value.
|
||||
func (t ScreencastFormat) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// ScreencastFormat values.
|
||||
const (
|
||||
ScreencastFormatJpeg ScreencastFormat = "jpeg"
|
||||
ScreencastFormatPng ScreencastFormat = "png"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t ScreencastFormat) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t ScreencastFormat) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *ScreencastFormat) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch ScreencastFormat(in.String()) {
|
||||
case ScreencastFormatJpeg:
|
||||
*t = ScreencastFormatJpeg
|
||||
case ScreencastFormatPng:
|
||||
*t = ScreencastFormatPng
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown ScreencastFormat value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *ScreencastFormat) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
|
|
@ -12,20 +12,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EnableParams enable collecting and reporting metrics.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enable collecting and reporting metrics.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes Performance.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.CommandPerformanceEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disable collecting and reporting metrics.
|
||||
type DisableParams struct{}
|
||||
|
||||
|
@ -40,6 +26,20 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandPerformanceDisable, nil, nil)
|
||||
}
|
||||
|
||||
// EnableParams enable collecting and reporting metrics.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enable collecting and reporting metrics.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes Performance.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.CommandPerformanceEnable, nil, nil)
|
||||
}
|
||||
|
||||
// GetMetricsParams retrieve current values of run-time metrics.
|
||||
type GetMetricsParams struct{}
|
||||
|
||||
|
|
|
@ -7,14 +7,6 @@ import (
|
|||
"github.com/knq/chromedp/cdp/debugger"
|
||||
)
|
||||
|
||||
// EventConsoleProfileStarted sent when new profile recording is started
|
||||
// using console.profile() call.
|
||||
type EventConsoleProfileStarted struct {
|
||||
ID string `json:"id"`
|
||||
Location *debugger.Location `json:"location"` // Location of console.profile().
|
||||
Title string `json:"title,omitempty"` // Profile title passed as an argument to console.profile().
|
||||
}
|
||||
|
||||
// EventConsoleProfileFinished [no description].
|
||||
type EventConsoleProfileFinished struct {
|
||||
ID string `json:"id"`
|
||||
|
@ -23,8 +15,16 @@ type EventConsoleProfileFinished struct {
|
|||
Title string `json:"title,omitempty"` // Profile title passed as an argument to console.profile().
|
||||
}
|
||||
|
||||
// EventConsoleProfileStarted sent when new profile recording is started
|
||||
// using console.profile() call.
|
||||
type EventConsoleProfileStarted struct {
|
||||
ID string `json:"id"`
|
||||
Location *debugger.Location `json:"location"` // Location of console.profile().
|
||||
Title string `json:"title,omitempty"` // Profile title passed as an argument to console.profile().
|
||||
}
|
||||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventProfilerConsoleProfileStarted,
|
||||
cdp.EventProfilerConsoleProfileFinished,
|
||||
cdp.EventProfilerConsoleProfileStarted,
|
||||
}
|
||||
|
|
|
@ -12,6 +12,20 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// DisableParams [no description].
|
||||
type DisableParams struct{}
|
||||
|
||||
// Disable [no description].
|
||||
func Disable() *DisableParams {
|
||||
return &DisableParams{}
|
||||
}
|
||||
|
||||
// Do executes Profiler.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.CommandProfilerDisable, nil, nil)
|
||||
}
|
||||
|
||||
// EnableParams [no description].
|
||||
type EnableParams struct{}
|
||||
|
||||
|
@ -26,18 +40,35 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandProfilerEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams [no description].
|
||||
type DisableParams struct{}
|
||||
// GetBestEffortCoverageParams collect coverage data for the current isolate.
|
||||
// The coverage data may be incomplete due to garbage collection.
|
||||
type GetBestEffortCoverageParams struct{}
|
||||
|
||||
// Disable [no description].
|
||||
func Disable() *DisableParams {
|
||||
return &DisableParams{}
|
||||
// GetBestEffortCoverage collect coverage data for the current isolate. The
|
||||
// coverage data may be incomplete due to garbage collection.
|
||||
func GetBestEffortCoverage() *GetBestEffortCoverageParams {
|
||||
return &GetBestEffortCoverageParams{}
|
||||
}
|
||||
|
||||
// Do executes Profiler.disable against the provided context and
|
||||
// GetBestEffortCoverageReturns return values.
|
||||
type GetBestEffortCoverageReturns struct {
|
||||
Result []*ScriptCoverage `json:"result,omitempty"` // Coverage data for the current isolate.
|
||||
}
|
||||
|
||||
// Do executes Profiler.getBestEffortCoverage against the provided context and
|
||||
// target handler.
|
||||
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandProfilerDisable, nil, nil)
|
||||
//
|
||||
// returns:
|
||||
// result - Coverage data for the current isolate.
|
||||
func (p *GetBestEffortCoverageParams) Do(ctxt context.Context, h cdp.Handler) (result []*ScriptCoverage, err error) {
|
||||
// execute
|
||||
var res GetBestEffortCoverageReturns
|
||||
err = h.Execute(ctxt, cdp.CommandProfilerGetBestEffortCoverage, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Result, nil
|
||||
}
|
||||
|
||||
// SetSamplingIntervalParams changes CPU profiler sampling interval. Must be
|
||||
|
@ -77,35 +108,6 @@ func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandProfilerStart, nil, nil)
|
||||
}
|
||||
|
||||
// StopParams [no description].
|
||||
type StopParams struct{}
|
||||
|
||||
// Stop [no description].
|
||||
func Stop() *StopParams {
|
||||
return &StopParams{}
|
||||
}
|
||||
|
||||
// StopReturns return values.
|
||||
type StopReturns struct {
|
||||
Profile *Profile `json:"profile,omitempty"` // Recorded profile.
|
||||
}
|
||||
|
||||
// Do executes Profiler.stop against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// profile - Recorded profile.
|
||||
func (p *StopParams) Do(ctxt context.Context, h cdp.Handler) (profile *Profile, err error) {
|
||||
// execute
|
||||
var res StopReturns
|
||||
err = h.Execute(ctxt, cdp.CommandProfilerStop, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Profile, nil
|
||||
}
|
||||
|
||||
// StartPreciseCoverageParams enable precise code coverage. Coverage data for
|
||||
// JavaScript executed before enabling precise code coverage may be incomplete.
|
||||
// Enabling prevents running optimized code and resets execution counters.
|
||||
|
@ -142,6 +144,49 @@ func (p *StartPreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (er
|
|||
return h.Execute(ctxt, cdp.CommandProfilerStartPreciseCoverage, p, nil)
|
||||
}
|
||||
|
||||
// StartTypeProfileParams enable type profile.
|
||||
type StartTypeProfileParams struct{}
|
||||
|
||||
// StartTypeProfile enable type profile.
|
||||
func StartTypeProfile() *StartTypeProfileParams {
|
||||
return &StartTypeProfileParams{}
|
||||
}
|
||||
|
||||
// Do executes Profiler.startTypeProfile against the provided context and
|
||||
// target handler.
|
||||
func (p *StartTypeProfileParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandProfilerStartTypeProfile, nil, nil)
|
||||
}
|
||||
|
||||
// StopParams [no description].
|
||||
type StopParams struct{}
|
||||
|
||||
// Stop [no description].
|
||||
func Stop() *StopParams {
|
||||
return &StopParams{}
|
||||
}
|
||||
|
||||
// StopReturns return values.
|
||||
type StopReturns struct {
|
||||
Profile *Profile `json:"profile,omitempty"` // Recorded profile.
|
||||
}
|
||||
|
||||
// Do executes Profiler.stop against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// profile - Recorded profile.
|
||||
func (p *StopParams) Do(ctxt context.Context, h cdp.Handler) (profile *Profile, err error) {
|
||||
// execute
|
||||
var res StopReturns
|
||||
err = h.Execute(ctxt, cdp.CommandProfilerStop, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Profile, nil
|
||||
}
|
||||
|
||||
// StopPreciseCoverageParams disable precise code coverage. Disabling
|
||||
// releases unnecessary execution count records and allows executing optimized
|
||||
// code.
|
||||
|
@ -159,6 +204,22 @@ func (p *StopPreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (err
|
|||
return h.Execute(ctxt, cdp.CommandProfilerStopPreciseCoverage, nil, nil)
|
||||
}
|
||||
|
||||
// StopTypeProfileParams disable type profile. Disabling releases type
|
||||
// profile data collected so far.
|
||||
type StopTypeProfileParams struct{}
|
||||
|
||||
// StopTypeProfile disable type profile. Disabling releases type profile data
|
||||
// collected so far.
|
||||
func StopTypeProfile() *StopTypeProfileParams {
|
||||
return &StopTypeProfileParams{}
|
||||
}
|
||||
|
||||
// Do executes Profiler.stopTypeProfile against the provided context and
|
||||
// target handler.
|
||||
func (p *StopTypeProfileParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandProfilerStopTypeProfile, nil, nil)
|
||||
}
|
||||
|
||||
// TakePreciseCoverageParams collect coverage data for the current isolate,
|
||||
// and resets execution counters. Precise code coverage needs to have started.
|
||||
type TakePreciseCoverageParams struct{}
|
||||
|
@ -190,67 +251,6 @@ func (p *TakePreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (res
|
|||
return res.Result, nil
|
||||
}
|
||||
|
||||
// GetBestEffortCoverageParams collect coverage data for the current isolate.
|
||||
// The coverage data may be incomplete due to garbage collection.
|
||||
type GetBestEffortCoverageParams struct{}
|
||||
|
||||
// GetBestEffortCoverage collect coverage data for the current isolate. The
|
||||
// coverage data may be incomplete due to garbage collection.
|
||||
func GetBestEffortCoverage() *GetBestEffortCoverageParams {
|
||||
return &GetBestEffortCoverageParams{}
|
||||
}
|
||||
|
||||
// GetBestEffortCoverageReturns return values.
|
||||
type GetBestEffortCoverageReturns struct {
|
||||
Result []*ScriptCoverage `json:"result,omitempty"` // Coverage data for the current isolate.
|
||||
}
|
||||
|
||||
// Do executes Profiler.getBestEffortCoverage against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// result - Coverage data for the current isolate.
|
||||
func (p *GetBestEffortCoverageParams) Do(ctxt context.Context, h cdp.Handler) (result []*ScriptCoverage, err error) {
|
||||
// execute
|
||||
var res GetBestEffortCoverageReturns
|
||||
err = h.Execute(ctxt, cdp.CommandProfilerGetBestEffortCoverage, nil, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Result, nil
|
||||
}
|
||||
|
||||
// StartTypeProfileParams enable type profile.
|
||||
type StartTypeProfileParams struct{}
|
||||
|
||||
// StartTypeProfile enable type profile.
|
||||
func StartTypeProfile() *StartTypeProfileParams {
|
||||
return &StartTypeProfileParams{}
|
||||
}
|
||||
|
||||
// Do executes Profiler.startTypeProfile against the provided context and
|
||||
// target handler.
|
||||
func (p *StartTypeProfileParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandProfilerStartTypeProfile, nil, nil)
|
||||
}
|
||||
|
||||
// StopTypeProfileParams disable type profile. Disabling releases type
|
||||
// profile data collected so far.
|
||||
type StopTypeProfileParams struct{}
|
||||
|
||||
// StopTypeProfile disable type profile. Disabling releases type profile data
|
||||
// collected so far.
|
||||
func StopTypeProfile() *StopTypeProfileParams {
|
||||
return &StopTypeProfileParams{}
|
||||
}
|
||||
|
||||
// Do executes Profiler.stopTypeProfile against the provided context and
|
||||
// target handler.
|
||||
func (p *StopTypeProfileParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandProfilerStopTypeProfile, nil, nil)
|
||||
}
|
||||
|
||||
// TakeTypeProfileParams collect type profile.
|
||||
type TakeTypeProfileParams struct{}
|
||||
|
||||
|
|
|
@ -7,6 +7,28 @@ import (
|
|||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EventConsoleAPICalled issued when console API was called.
|
||||
type EventConsoleAPICalled struct {
|
||||
Type APIType `json:"type"` // Type of the call.
|
||||
Args []*RemoteObject `json:"args"` // Call arguments.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId"` // Identifier of the context where the call was made.
|
||||
Timestamp *Timestamp `json:"timestamp"` // Call timestamp.
|
||||
StackTrace *StackTrace `json:"stackTrace,omitempty"` // Stack trace captured when the call was made.
|
||||
Context string `json:"context,omitempty"` // Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context.
|
||||
}
|
||||
|
||||
// EventExceptionRevoked issued when unhandled exception was revoked.
|
||||
type EventExceptionRevoked struct {
|
||||
Reason string `json:"reason"` // Reason describing why exception was revoked.
|
||||
ExceptionID int64 `json:"exceptionId"` // The id of revoked exception, as reported in exceptionThrown.
|
||||
}
|
||||
|
||||
// EventExceptionThrown issued when exception was thrown and unhandled.
|
||||
type EventExceptionThrown struct {
|
||||
Timestamp *Timestamp `json:"timestamp"` // Timestamp of the exception.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails"`
|
||||
}
|
||||
|
||||
// EventExecutionContextCreated issued when new execution context is created.
|
||||
type EventExecutionContextCreated struct {
|
||||
Context *ExecutionContextDescription `json:"context"` // A newly created execution context.
|
||||
|
@ -21,28 +43,6 @@ type EventExecutionContextDestroyed struct {
|
|||
// cleared in browser.
|
||||
type EventExecutionContextsCleared struct{}
|
||||
|
||||
// EventExceptionThrown issued when exception was thrown and unhandled.
|
||||
type EventExceptionThrown struct {
|
||||
Timestamp *Timestamp `json:"timestamp"` // Timestamp of the exception.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails"`
|
||||
}
|
||||
|
||||
// EventExceptionRevoked issued when unhandled exception was revoked.
|
||||
type EventExceptionRevoked struct {
|
||||
Reason string `json:"reason"` // Reason describing why exception was revoked.
|
||||
ExceptionID int64 `json:"exceptionId"` // The id of revoked exception, as reported in exceptionThrown.
|
||||
}
|
||||
|
||||
// EventConsoleAPICalled issued when console API was called.
|
||||
type EventConsoleAPICalled struct {
|
||||
Type APIType `json:"type"` // Type of the call.
|
||||
Args []*RemoteObject `json:"args"` // Call arguments.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId"` // Identifier of the context where the call was made.
|
||||
Timestamp *Timestamp `json:"timestamp"` // Call timestamp.
|
||||
StackTrace *StackTrace `json:"stackTrace,omitempty"` // Stack trace captured when the call was made.
|
||||
Context string `json:"context,omitempty"` // Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context.
|
||||
}
|
||||
|
||||
// EventInspectRequested issued when object should be inspected (for example,
|
||||
// as a result of inspect() command line API call).
|
||||
type EventInspectRequested struct {
|
||||
|
@ -52,11 +52,11 @@ type EventInspectRequested struct {
|
|||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventRuntimeConsoleAPICalled,
|
||||
cdp.EventRuntimeExceptionRevoked,
|
||||
cdp.EventRuntimeExceptionThrown,
|
||||
cdp.EventRuntimeExecutionContextCreated,
|
||||
cdp.EventRuntimeExecutionContextDestroyed,
|
||||
cdp.EventRuntimeExecutionContextsCleared,
|
||||
cdp.EventRuntimeExceptionThrown,
|
||||
cdp.EventRuntimeExceptionRevoked,
|
||||
cdp.EventRuntimeConsoleAPICalled,
|
||||
cdp.EventRuntimeInspectRequested,
|
||||
}
|
||||
|
|
|
@ -19,108 +19,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EvaluateParams evaluates expression on global object.
|
||||
type EvaluateParams struct {
|
||||
Expression string `json:"expression"` // Expression to evaluate.
|
||||
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release multiple objects.
|
||||
IncludeCommandLineAPI bool `json:"includeCommandLineAPI,omitempty"` // Determines whether Command Line API should be available during the evaluation.
|
||||
Silent bool `json:"silent,omitempty"` // In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
|
||||
ContextID ExecutionContextID `json:"contextId,omitempty"` // Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
|
||||
ReturnByValue bool `json:"returnByValue,omitempty"` // Whether the result is expected to be a JSON object that should be sent by value.
|
||||
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
|
||||
UserGesture bool `json:"userGesture,omitempty"` // Whether execution should be treated as initiated by user in the UI.
|
||||
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should await for resulting value and return once awaited promise is resolved.
|
||||
}
|
||||
|
||||
// Evaluate evaluates expression on global object.
|
||||
//
|
||||
// parameters:
|
||||
// expression - Expression to evaluate.
|
||||
func Evaluate(expression string) *EvaluateParams {
|
||||
return &EvaluateParams{
|
||||
Expression: expression,
|
||||
}
|
||||
}
|
||||
|
||||
// WithObjectGroup symbolic group name that can be used to release multiple
|
||||
// objects.
|
||||
func (p EvaluateParams) WithObjectGroup(objectGroup string) *EvaluateParams {
|
||||
p.ObjectGroup = objectGroup
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithIncludeCommandLineAPI determines whether Command Line API should be
|
||||
// available during the evaluation.
|
||||
func (p EvaluateParams) WithIncludeCommandLineAPI(includeCommandLineAPI bool) *EvaluateParams {
|
||||
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 EvaluateParams) WithSilent(silent bool) *EvaluateParams {
|
||||
p.Silent = silent
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithContextID specifies in which execution context to perform evaluation.
|
||||
// If the parameter is omitted the evaluation will be performed in the context
|
||||
// of the inspected page.
|
||||
func (p EvaluateParams) WithContextID(contextID ExecutionContextID) *EvaluateParams {
|
||||
p.ContextID = contextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithReturnByValue whether the result is expected to be a JSON object that
|
||||
// should be sent by value.
|
||||
func (p EvaluateParams) WithReturnByValue(returnByValue bool) *EvaluateParams {
|
||||
p.ReturnByValue = returnByValue
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithGeneratePreview whether preview should be generated for the result.
|
||||
func (p EvaluateParams) WithGeneratePreview(generatePreview bool) *EvaluateParams {
|
||||
p.GeneratePreview = generatePreview
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithUserGesture whether execution should be treated as initiated by user
|
||||
// in the UI.
|
||||
func (p EvaluateParams) WithUserGesture(userGesture bool) *EvaluateParams {
|
||||
p.UserGesture = userGesture
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithAwaitPromise whether execution should await for resulting value and
|
||||
// return once awaited promise is resolved.
|
||||
func (p EvaluateParams) WithAwaitPromise(awaitPromise bool) *EvaluateParams {
|
||||
p.AwaitPromise = awaitPromise
|
||||
return &p
|
||||
}
|
||||
|
||||
// EvaluateReturns return values.
|
||||
type EvaluateReturns struct {
|
||||
Result *RemoteObject `json:"result,omitempty"` // Evaluation result.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
|
||||
}
|
||||
|
||||
// Do executes Runtime.evaluate against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// result - Evaluation result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *EvaluateParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res EvaluateReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeEvaluate, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// AwaitPromiseParams add handler to promise with given promise object id.
|
||||
type AwaitPromiseParams struct {
|
||||
PromiseObjectID RemoteObjectID `json:"promiseObjectId"` // Identifier of the promise.
|
||||
|
@ -287,6 +185,208 @@ func (p *CallFunctionOnParams) Do(ctxt context.Context, h cdp.Handler) (result *
|
|||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// CompileScriptParams compiles expression.
|
||||
type CompileScriptParams struct {
|
||||
Expression string `json:"expression"` // Expression to compile.
|
||||
SourceURL string `json:"sourceURL"` // Source url to be set for the script.
|
||||
PersistScript bool `json:"persistScript"` // Specifies whether the compiled script should be persisted.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
|
||||
}
|
||||
|
||||
// CompileScript compiles expression.
|
||||
//
|
||||
// parameters:
|
||||
// expression - Expression to compile.
|
||||
// sourceURL - Source url to be set for the script.
|
||||
// persistScript - Specifies whether the compiled script should be persisted.
|
||||
func CompileScript(expression string, sourceURL string, persistScript bool) *CompileScriptParams {
|
||||
return &CompileScriptParams{
|
||||
Expression: expression,
|
||||
SourceURL: sourceURL,
|
||||
PersistScript: persistScript,
|
||||
}
|
||||
}
|
||||
|
||||
// WithExecutionContextID specifies in which execution context to perform
|
||||
// script run. If the parameter is omitted the evaluation will be performed in
|
||||
// the context of the inspected page.
|
||||
func (p CompileScriptParams) WithExecutionContextID(executionContextID ExecutionContextID) *CompileScriptParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// CompileScriptReturns return values.
|
||||
type CompileScriptReturns struct {
|
||||
ScriptID ScriptID `json:"scriptId,omitempty"` // Id of the script.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
|
||||
}
|
||||
|
||||
// Do executes Runtime.compileScript against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// scriptID - Id of the script.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *CompileScriptParams) Do(ctxt context.Context, h cdp.Handler) (scriptID ScriptID, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res CompileScriptReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeCompileScript, p, &res)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
return res.ScriptID, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// DisableParams disables reporting of execution contexts creation.
|
||||
type DisableParams struct{}
|
||||
|
||||
// Disable disables reporting of execution contexts creation.
|
||||
func Disable() *DisableParams {
|
||||
return &DisableParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.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.CommandRuntimeDisable, nil, nil)
|
||||
}
|
||||
|
||||
// DiscardConsoleEntriesParams discards collected exceptions and console API
|
||||
// calls.
|
||||
type DiscardConsoleEntriesParams struct{}
|
||||
|
||||
// DiscardConsoleEntries discards collected exceptions and console API calls.
|
||||
func DiscardConsoleEntries() *DiscardConsoleEntriesParams {
|
||||
return &DiscardConsoleEntriesParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.discardConsoleEntries against the provided context and
|
||||
// target handler.
|
||||
func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeDiscardConsoleEntries, nil, nil)
|
||||
}
|
||||
|
||||
// EnableParams enables reporting of execution contexts creation by means of
|
||||
// executionContextCreated event. When the reporting gets enabled the event will
|
||||
// be sent immediately for each existing execution context.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enables reporting of execution contexts creation by means of
|
||||
// executionContextCreated event. When the reporting gets enabled the event will
|
||||
// be sent immediately for each existing execution context.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.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.CommandRuntimeEnable, nil, nil)
|
||||
}
|
||||
|
||||
// EvaluateParams evaluates expression on global object.
|
||||
type EvaluateParams struct {
|
||||
Expression string `json:"expression"` // Expression to evaluate.
|
||||
ObjectGroup string `json:"objectGroup,omitempty"` // Symbolic group name that can be used to release multiple objects.
|
||||
IncludeCommandLineAPI bool `json:"includeCommandLineAPI,omitempty"` // Determines whether Command Line API should be available during the evaluation.
|
||||
Silent bool `json:"silent,omitempty"` // In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
|
||||
ContextID ExecutionContextID `json:"contextId,omitempty"` // Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
|
||||
ReturnByValue bool `json:"returnByValue,omitempty"` // Whether the result is expected to be a JSON object that should be sent by value.
|
||||
GeneratePreview bool `json:"generatePreview,omitempty"` // Whether preview should be generated for the result.
|
||||
UserGesture bool `json:"userGesture,omitempty"` // Whether execution should be treated as initiated by user in the UI.
|
||||
AwaitPromise bool `json:"awaitPromise,omitempty"` // Whether execution should await for resulting value and return once awaited promise is resolved.
|
||||
}
|
||||
|
||||
// Evaluate evaluates expression on global object.
|
||||
//
|
||||
// parameters:
|
||||
// expression - Expression to evaluate.
|
||||
func Evaluate(expression string) *EvaluateParams {
|
||||
return &EvaluateParams{
|
||||
Expression: expression,
|
||||
}
|
||||
}
|
||||
|
||||
// WithObjectGroup symbolic group name that can be used to release multiple
|
||||
// objects.
|
||||
func (p EvaluateParams) WithObjectGroup(objectGroup string) *EvaluateParams {
|
||||
p.ObjectGroup = objectGroup
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithIncludeCommandLineAPI determines whether Command Line API should be
|
||||
// available during the evaluation.
|
||||
func (p EvaluateParams) WithIncludeCommandLineAPI(includeCommandLineAPI bool) *EvaluateParams {
|
||||
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 EvaluateParams) WithSilent(silent bool) *EvaluateParams {
|
||||
p.Silent = silent
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithContextID specifies in which execution context to perform evaluation.
|
||||
// If the parameter is omitted the evaluation will be performed in the context
|
||||
// of the inspected page.
|
||||
func (p EvaluateParams) WithContextID(contextID ExecutionContextID) *EvaluateParams {
|
||||
p.ContextID = contextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithReturnByValue whether the result is expected to be a JSON object that
|
||||
// should be sent by value.
|
||||
func (p EvaluateParams) WithReturnByValue(returnByValue bool) *EvaluateParams {
|
||||
p.ReturnByValue = returnByValue
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithGeneratePreview whether preview should be generated for the result.
|
||||
func (p EvaluateParams) WithGeneratePreview(generatePreview bool) *EvaluateParams {
|
||||
p.GeneratePreview = generatePreview
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithUserGesture whether execution should be treated as initiated by user
|
||||
// in the UI.
|
||||
func (p EvaluateParams) WithUserGesture(userGesture bool) *EvaluateParams {
|
||||
p.UserGesture = userGesture
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithAwaitPromise whether execution should await for resulting value and
|
||||
// return once awaited promise is resolved.
|
||||
func (p EvaluateParams) WithAwaitPromise(awaitPromise bool) *EvaluateParams {
|
||||
p.AwaitPromise = awaitPromise
|
||||
return &p
|
||||
}
|
||||
|
||||
// EvaluateReturns return values.
|
||||
type EvaluateReturns struct {
|
||||
Result *RemoteObject `json:"result,omitempty"` // Evaluation result.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
|
||||
}
|
||||
|
||||
// Do executes Runtime.evaluate against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// result - Evaluation result.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *EvaluateParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res EvaluateReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeEvaluate, p, &res)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// GetPropertiesParams returns properties of a given object. Object group of
|
||||
// the result is inherited from the target object.
|
||||
type GetPropertiesParams struct {
|
||||
|
@ -352,6 +452,84 @@ func (p *GetPropertiesParams) Do(ctxt context.Context, h cdp.Handler) (result []
|
|||
return res.Result, res.InternalProperties, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// GlobalLexicalScopeNamesParams returns all let, const and class variables
|
||||
// from global scope.
|
||||
type GlobalLexicalScopeNamesParams struct {
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Specifies in which execution context to lookup global scope variables.
|
||||
}
|
||||
|
||||
// GlobalLexicalScopeNames returns all let, const and class variables from
|
||||
// global scope.
|
||||
//
|
||||
// parameters:
|
||||
func GlobalLexicalScopeNames() *GlobalLexicalScopeNamesParams {
|
||||
return &GlobalLexicalScopeNamesParams{}
|
||||
}
|
||||
|
||||
// WithExecutionContextID specifies in which execution context to lookup
|
||||
// global scope variables.
|
||||
func (p GlobalLexicalScopeNamesParams) WithExecutionContextID(executionContextID ExecutionContextID) *GlobalLexicalScopeNamesParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// GlobalLexicalScopeNamesReturns return values.
|
||||
type GlobalLexicalScopeNamesReturns struct {
|
||||
Names []string `json:"names,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Runtime.globalLexicalScopeNames against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// names
|
||||
func (p *GlobalLexicalScopeNamesParams) Do(ctxt context.Context, h cdp.Handler) (names []string, err error) {
|
||||
// execute
|
||||
var res GlobalLexicalScopeNamesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeGlobalLexicalScopeNames, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Names, nil
|
||||
}
|
||||
|
||||
// QueryObjectsParams [no description].
|
||||
type QueryObjectsParams struct {
|
||||
PrototypeObjectID RemoteObjectID `json:"prototypeObjectId"` // Identifier of the prototype to return objects for.
|
||||
}
|
||||
|
||||
// QueryObjects [no description].
|
||||
//
|
||||
// parameters:
|
||||
// prototypeObjectID - Identifier of the prototype to return objects for.
|
||||
func QueryObjects(prototypeObjectID RemoteObjectID) *QueryObjectsParams {
|
||||
return &QueryObjectsParams{
|
||||
PrototypeObjectID: prototypeObjectID,
|
||||
}
|
||||
}
|
||||
|
||||
// QueryObjectsReturns return values.
|
||||
type QueryObjectsReturns struct {
|
||||
Objects *RemoteObject `json:"objects,omitempty"` // Array with objects.
|
||||
}
|
||||
|
||||
// Do executes Runtime.queryObjects against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// objects - Array with objects.
|
||||
func (p *QueryObjectsParams) Do(ctxt context.Context, h cdp.Handler) (objects *RemoteObject, err error) {
|
||||
// execute
|
||||
var res QueryObjectsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeQueryObjects, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Objects, nil
|
||||
}
|
||||
|
||||
// ReleaseObjectParams releases remote object with given id.
|
||||
type ReleaseObjectParams struct {
|
||||
ObjectID RemoteObjectID `json:"objectId"` // Identifier of the object to release.
|
||||
|
@ -412,127 +590,6 @@ func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h cdp.Handler)
|
|||
return h.Execute(ctxt, cdp.CommandRuntimeRunIfWaitingForDebugger, nil, nil)
|
||||
}
|
||||
|
||||
// EnableParams enables reporting of execution contexts creation by means of
|
||||
// executionContextCreated event. When the reporting gets enabled the event will
|
||||
// be sent immediately for each existing execution context.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enables reporting of execution contexts creation by means of
|
||||
// executionContextCreated event. When the reporting gets enabled the event will
|
||||
// be sent immediately for each existing execution context.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.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.CommandRuntimeEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables reporting of execution contexts creation.
|
||||
type DisableParams struct{}
|
||||
|
||||
// Disable disables reporting of execution contexts creation.
|
||||
func Disable() *DisableParams {
|
||||
return &DisableParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.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.CommandRuntimeDisable, nil, nil)
|
||||
}
|
||||
|
||||
// DiscardConsoleEntriesParams discards collected exceptions and console API
|
||||
// calls.
|
||||
type DiscardConsoleEntriesParams struct{}
|
||||
|
||||
// DiscardConsoleEntries discards collected exceptions and console API calls.
|
||||
func DiscardConsoleEntries() *DiscardConsoleEntriesParams {
|
||||
return &DiscardConsoleEntriesParams{}
|
||||
}
|
||||
|
||||
// Do executes Runtime.discardConsoleEntries against the provided context and
|
||||
// target handler.
|
||||
func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeDiscardConsoleEntries, nil, nil)
|
||||
}
|
||||
|
||||
// SetCustomObjectFormatterEnabledParams [no description].
|
||||
type SetCustomObjectFormatterEnabledParams struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// SetCustomObjectFormatterEnabled [no description].
|
||||
//
|
||||
// parameters:
|
||||
// enabled
|
||||
func SetCustomObjectFormatterEnabled(enabled bool) *SetCustomObjectFormatterEnabledParams {
|
||||
return &SetCustomObjectFormatterEnabledParams{
|
||||
Enabled: enabled,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Runtime.setCustomObjectFormatterEnabled against the provided context and
|
||||
// target handler.
|
||||
func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeSetCustomObjectFormatterEnabled, p, nil)
|
||||
}
|
||||
|
||||
// CompileScriptParams compiles expression.
|
||||
type CompileScriptParams struct {
|
||||
Expression string `json:"expression"` // Expression to compile.
|
||||
SourceURL string `json:"sourceURL"` // Source url to be set for the script.
|
||||
PersistScript bool `json:"persistScript"` // Specifies whether the compiled script should be persisted.
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
|
||||
}
|
||||
|
||||
// CompileScript compiles expression.
|
||||
//
|
||||
// parameters:
|
||||
// expression - Expression to compile.
|
||||
// sourceURL - Source url to be set for the script.
|
||||
// persistScript - Specifies whether the compiled script should be persisted.
|
||||
func CompileScript(expression string, sourceURL string, persistScript bool) *CompileScriptParams {
|
||||
return &CompileScriptParams{
|
||||
Expression: expression,
|
||||
SourceURL: sourceURL,
|
||||
PersistScript: persistScript,
|
||||
}
|
||||
}
|
||||
|
||||
// WithExecutionContextID specifies in which execution context to perform
|
||||
// script run. If the parameter is omitted the evaluation will be performed in
|
||||
// the context of the inspected page.
|
||||
func (p CompileScriptParams) WithExecutionContextID(executionContextID ExecutionContextID) *CompileScriptParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// CompileScriptReturns return values.
|
||||
type CompileScriptReturns struct {
|
||||
ScriptID ScriptID `json:"scriptId,omitempty"` // Id of the script.
|
||||
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
|
||||
}
|
||||
|
||||
// Do executes Runtime.compileScript against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// scriptID - Id of the script.
|
||||
// exceptionDetails - Exception details.
|
||||
func (p *CompileScriptParams) Do(ctxt context.Context, h cdp.Handler) (scriptID ScriptID, exceptionDetails *ExceptionDetails, err error) {
|
||||
// execute
|
||||
var res CompileScriptReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeCompileScript, p, &res)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
return res.ScriptID, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// RunScriptParams runs script with given id in a given context.
|
||||
type RunScriptParams struct {
|
||||
ScriptID ScriptID `json:"scriptId"` // Id of the script to run.
|
||||
|
@ -627,80 +684,23 @@ func (p *RunScriptParams) Do(ctxt context.Context, h cdp.Handler) (result *Remot
|
|||
return res.Result, res.ExceptionDetails, nil
|
||||
}
|
||||
|
||||
// QueryObjectsParams [no description].
|
||||
type QueryObjectsParams struct {
|
||||
PrototypeObjectID RemoteObjectID `json:"prototypeObjectId"` // Identifier of the prototype to return objects for.
|
||||
// SetCustomObjectFormatterEnabledParams [no description].
|
||||
type SetCustomObjectFormatterEnabledParams struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// QueryObjects [no description].
|
||||
// SetCustomObjectFormatterEnabled [no description].
|
||||
//
|
||||
// parameters:
|
||||
// prototypeObjectID - Identifier of the prototype to return objects for.
|
||||
func QueryObjects(prototypeObjectID RemoteObjectID) *QueryObjectsParams {
|
||||
return &QueryObjectsParams{
|
||||
PrototypeObjectID: prototypeObjectID,
|
||||
// enabled
|
||||
func SetCustomObjectFormatterEnabled(enabled bool) *SetCustomObjectFormatterEnabledParams {
|
||||
return &SetCustomObjectFormatterEnabledParams{
|
||||
Enabled: enabled,
|
||||
}
|
||||
}
|
||||
|
||||
// QueryObjectsReturns return values.
|
||||
type QueryObjectsReturns struct {
|
||||
Objects *RemoteObject `json:"objects,omitempty"` // Array with objects.
|
||||
}
|
||||
|
||||
// Do executes Runtime.queryObjects against the provided context and
|
||||
// Do executes Runtime.setCustomObjectFormatterEnabled against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// objects - Array with objects.
|
||||
func (p *QueryObjectsParams) Do(ctxt context.Context, h cdp.Handler) (objects *RemoteObject, err error) {
|
||||
// execute
|
||||
var res QueryObjectsReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeQueryObjects, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Objects, nil
|
||||
}
|
||||
|
||||
// GlobalLexicalScopeNamesParams returns all let, const and class variables
|
||||
// from global scope.
|
||||
type GlobalLexicalScopeNamesParams struct {
|
||||
ExecutionContextID ExecutionContextID `json:"executionContextId,omitempty"` // Specifies in which execution context to lookup global scope variables.
|
||||
}
|
||||
|
||||
// GlobalLexicalScopeNames returns all let, const and class variables from
|
||||
// global scope.
|
||||
//
|
||||
// parameters:
|
||||
func GlobalLexicalScopeNames() *GlobalLexicalScopeNamesParams {
|
||||
return &GlobalLexicalScopeNamesParams{}
|
||||
}
|
||||
|
||||
// WithExecutionContextID specifies in which execution context to lookup
|
||||
// global scope variables.
|
||||
func (p GlobalLexicalScopeNamesParams) WithExecutionContextID(executionContextID ExecutionContextID) *GlobalLexicalScopeNamesParams {
|
||||
p.ExecutionContextID = executionContextID
|
||||
return &p
|
||||
}
|
||||
|
||||
// GlobalLexicalScopeNamesReturns return values.
|
||||
type GlobalLexicalScopeNamesReturns struct {
|
||||
Names []string `json:"names,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Runtime.globalLexicalScopeNames against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// names
|
||||
func (p *GlobalLexicalScopeNamesParams) Do(ctxt context.Context, h cdp.Handler) (names []string, err error) {
|
||||
// execute
|
||||
var res GlobalLexicalScopeNamesReturns
|
||||
err = h.Execute(ctxt, cdp.CommandRuntimeGlobalLexicalScopeNames, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.Names, nil
|
||||
func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandRuntimeSetCustomObjectFormatterEnabled, p, nil)
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpSecurity(in *jlexer.Lexer, out
|
|||
switch key {
|
||||
case "securityState":
|
||||
(out.SecurityState).UnmarshalEasyJSON(in)
|
||||
case "title":
|
||||
out.Title = string(in.String())
|
||||
case "summary":
|
||||
out.Summary = string(in.String())
|
||||
case "description":
|
||||
|
@ -91,6 +93,16 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpSecurity(out *jwriter.Writer,
|
|||
}
|
||||
(in.SecurityState).MarshalEasyJSON(out)
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"title\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
out.String(string(in.Title))
|
||||
}
|
||||
{
|
||||
const prefix string = ",\"summary\":"
|
||||
if first {
|
||||
|
|
|
@ -6,15 +6,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventSecurityStateChanged the security state of the page changed.
|
||||
type EventSecurityStateChanged struct {
|
||||
SecurityState State `json:"securityState"` // Security state.
|
||||
SchemeIsCryptographic bool `json:"schemeIsCryptographic"` // True if the page was loaded over cryptographic transport such as HTTPS.
|
||||
Explanations []*StateExplanation `json:"explanations"` // List of explanations for the security state. If the overall security state is `insecure` or `warning`, at least one corresponding explanation should be included.
|
||||
InsecureContentStatus *InsecureContentStatus `json:"insecureContentStatus"` // Information about insecure content on the page.
|
||||
Summary string `json:"summary,omitempty"` // Overrides user-visible description of the state.
|
||||
}
|
||||
|
||||
// EventCertificateError there is a certificate error. If overriding
|
||||
// certificate errors is enabled, then it should be handled with the
|
||||
// handleCertificateError command. Note: this event does not fire if the
|
||||
|
@ -25,8 +16,17 @@ type EventCertificateError struct {
|
|||
RequestURL string `json:"requestURL"` // The url that was requested.
|
||||
}
|
||||
|
||||
// EventSecurityStateChanged the security state of the page changed.
|
||||
type EventSecurityStateChanged struct {
|
||||
SecurityState State `json:"securityState"` // Security state.
|
||||
SchemeIsCryptographic bool `json:"schemeIsCryptographic"` // True if the page was loaded over cryptographic transport such as HTTPS.
|
||||
Explanations []*StateExplanation `json:"explanations"` // List of explanations for the security state. If the overall security state is insecure or warning, at least one corresponding explanation should be included.
|
||||
InsecureContentStatus *InsecureContentStatus `json:"insecureContentStatus"` // Information about insecure content on the page.
|
||||
Summary string `json:"summary,omitempty"` // Overrides user-visible description of the state.
|
||||
}
|
||||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventSecuritySecurityStateChanged,
|
||||
cdp.EventSecurityCertificateError,
|
||||
cdp.EventSecuritySecurityStateChanged,
|
||||
}
|
||||
|
|
|
@ -14,20 +14,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EnableParams enables tracking security state changes.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enables tracking security state changes.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes Security.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.CommandSecurityEnable, nil, nil)
|
||||
}
|
||||
|
||||
// DisableParams disables tracking security state changes.
|
||||
type DisableParams struct{}
|
||||
|
||||
|
@ -42,6 +28,20 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandSecurityDisable, nil, nil)
|
||||
}
|
||||
|
||||
// EnableParams enables tracking security state changes.
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable enables tracking security state changes.
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// Do executes Security.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.CommandSecurityEnable, nil, nil)
|
||||
}
|
||||
|
||||
// HandleCertificateErrorParams handles a certificate error that fired a
|
||||
// certificateError event.
|
||||
type HandleCertificateErrorParams struct {
|
||||
|
|
|
@ -119,6 +119,7 @@ func (t *State) UnmarshalJSON(buf []byte) error {
|
|||
// state.
|
||||
type StateExplanation struct {
|
||||
SecurityState State `json:"securityState"` // Security state representing the severity of the factor being explained.
|
||||
Title string `json:"title"` // Title describing the type of factor.
|
||||
Summary string `json:"summary"` // Short phrase describing the type of factor.
|
||||
Description string `json:"description"` // Full text explanation of the factor.
|
||||
MixedContentType MixedContentType `json:"mixedContentType"` // The type of mixed content described by the explanation.
|
||||
|
|
|
@ -6,6 +6,11 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventWorkerErrorReported [no description].
|
||||
type EventWorkerErrorReported struct {
|
||||
ErrorMessage *ErrorMessage `json:"errorMessage"`
|
||||
}
|
||||
|
||||
// EventWorkerRegistrationUpdated [no description].
|
||||
type EventWorkerRegistrationUpdated struct {
|
||||
Registrations []*Registration `json:"registrations"`
|
||||
|
@ -16,14 +21,9 @@ type EventWorkerVersionUpdated struct {
|
|||
Versions []*Version `json:"versions"`
|
||||
}
|
||||
|
||||
// EventWorkerErrorReported [no description].
|
||||
type EventWorkerErrorReported struct {
|
||||
ErrorMessage *ErrorMessage `json:"errorMessage"`
|
||||
}
|
||||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventServiceWorkerWorkerErrorReported,
|
||||
cdp.EventServiceWorkerWorkerRegistrationUpdated,
|
||||
cdp.EventServiceWorkerWorkerVersionUpdated,
|
||||
cdp.EventServiceWorkerWorkerErrorReported,
|
||||
}
|
||||
|
|
|
@ -12,18 +12,31 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EnableParams [no description].
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable [no description].
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
// DeliverPushMessageParams [no description].
|
||||
type DeliverPushMessageParams struct {
|
||||
Origin string `json:"origin"`
|
||||
RegistrationID string `json:"registrationId"`
|
||||
Data string `json:"data"`
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.enable against the provided context and
|
||||
// DeliverPushMessage [no description].
|
||||
//
|
||||
// parameters:
|
||||
// origin
|
||||
// registrationID
|
||||
// data
|
||||
func DeliverPushMessage(origin string, registrationID string, data string) *DeliverPushMessageParams {
|
||||
return &DeliverPushMessageParams{
|
||||
Origin: origin,
|
||||
RegistrationID: registrationID,
|
||||
Data: data,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.deliverPushMessage against the provided context and
|
||||
// target handler.
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerEnable, nil, nil)
|
||||
func (p *DeliverPushMessageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerDeliverPushMessage, p, nil)
|
||||
}
|
||||
|
||||
// DisableParams [no description].
|
||||
|
@ -40,123 +53,48 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|||
return h.Execute(ctxt, cdp.CommandServiceWorkerDisable, nil, nil)
|
||||
}
|
||||
|
||||
// UnregisterParams [no description].
|
||||
type UnregisterParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
// DispatchSyncEventParams [no description].
|
||||
type DispatchSyncEventParams struct {
|
||||
Origin string `json:"origin"`
|
||||
RegistrationID string `json:"registrationId"`
|
||||
Tag string `json:"tag"`
|
||||
LastChance bool `json:"lastChance"`
|
||||
}
|
||||
|
||||
// Unregister [no description].
|
||||
// DispatchSyncEvent [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func Unregister(scopeURL string) *UnregisterParams {
|
||||
return &UnregisterParams{
|
||||
ScopeURL: scopeURL,
|
||||
// origin
|
||||
// registrationID
|
||||
// tag
|
||||
// lastChance
|
||||
func DispatchSyncEvent(origin string, registrationID string, tag string, lastChance bool) *DispatchSyncEventParams {
|
||||
return &DispatchSyncEventParams{
|
||||
Origin: origin,
|
||||
RegistrationID: registrationID,
|
||||
Tag: tag,
|
||||
LastChance: lastChance,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.unregister against the provided context and
|
||||
// Do executes ServiceWorker.dispatchSyncEvent against the provided context and
|
||||
// target handler.
|
||||
func (p *UnregisterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerUnregister, p, nil)
|
||||
func (p *DispatchSyncEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerDispatchSyncEvent, p, nil)
|
||||
}
|
||||
|
||||
// UpdateRegistrationParams [no description].
|
||||
type UpdateRegistrationParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
// EnableParams [no description].
|
||||
type EnableParams struct{}
|
||||
|
||||
// Enable [no description].
|
||||
func Enable() *EnableParams {
|
||||
return &EnableParams{}
|
||||
}
|
||||
|
||||
// UpdateRegistration [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func UpdateRegistration(scopeURL string) *UpdateRegistrationParams {
|
||||
return &UpdateRegistrationParams{
|
||||
ScopeURL: scopeURL,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.updateRegistration against the provided context and
|
||||
// Do executes ServiceWorker.enable against the provided context and
|
||||
// target handler.
|
||||
func (p *UpdateRegistrationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerUpdateRegistration, p, nil)
|
||||
}
|
||||
|
||||
// StartWorkerParams [no description].
|
||||
type StartWorkerParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// StartWorker [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func StartWorker(scopeURL string) *StartWorkerParams {
|
||||
return &StartWorkerParams{
|
||||
ScopeURL: scopeURL,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.startWorker against the provided context and
|
||||
// target handler.
|
||||
func (p *StartWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerStartWorker, p, nil)
|
||||
}
|
||||
|
||||
// SkipWaitingParams [no description].
|
||||
type SkipWaitingParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// SkipWaiting [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func SkipWaiting(scopeURL string) *SkipWaitingParams {
|
||||
return &SkipWaitingParams{
|
||||
ScopeURL: scopeURL,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.skipWaiting against the provided context and
|
||||
// target handler.
|
||||
func (p *SkipWaitingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerSkipWaiting, p, nil)
|
||||
}
|
||||
|
||||
// StopWorkerParams [no description].
|
||||
type StopWorkerParams struct {
|
||||
VersionID string `json:"versionId"`
|
||||
}
|
||||
|
||||
// StopWorker [no description].
|
||||
//
|
||||
// parameters:
|
||||
// versionID
|
||||
func StopWorker(versionID string) *StopWorkerParams {
|
||||
return &StopWorkerParams{
|
||||
VersionID: versionID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.stopWorker against the provided context and
|
||||
// target handler.
|
||||
func (p *StopWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerStopWorker, p, nil)
|
||||
}
|
||||
|
||||
// StopAllWorkersParams [no description].
|
||||
type StopAllWorkersParams struct{}
|
||||
|
||||
// StopAllWorkers [no description].
|
||||
func StopAllWorkers() *StopAllWorkersParams {
|
||||
return &StopAllWorkersParams{}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.stopAllWorkers against the provided context and
|
||||
// target handler.
|
||||
func (p *StopAllWorkersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerStopAllWorkers, nil, nil)
|
||||
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerEnable, nil, nil)
|
||||
}
|
||||
|
||||
// InspectWorkerParams [no description].
|
||||
|
@ -201,59 +139,121 @@ func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h cdp.Handler)
|
|||
return h.Execute(ctxt, cdp.CommandServiceWorkerSetForceUpdateOnPageLoad, p, nil)
|
||||
}
|
||||
|
||||
// DeliverPushMessageParams [no description].
|
||||
type DeliverPushMessageParams struct {
|
||||
Origin string `json:"origin"`
|
||||
RegistrationID string `json:"registrationId"`
|
||||
Data string `json:"data"`
|
||||
// SkipWaitingParams [no description].
|
||||
type SkipWaitingParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// DeliverPushMessage [no description].
|
||||
// SkipWaiting [no description].
|
||||
//
|
||||
// parameters:
|
||||
// origin
|
||||
// registrationID
|
||||
// data
|
||||
func DeliverPushMessage(origin string, registrationID string, data string) *DeliverPushMessageParams {
|
||||
return &DeliverPushMessageParams{
|
||||
Origin: origin,
|
||||
RegistrationID: registrationID,
|
||||
Data: data,
|
||||
// scopeURL
|
||||
func SkipWaiting(scopeURL string) *SkipWaitingParams {
|
||||
return &SkipWaitingParams{
|
||||
ScopeURL: scopeURL,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.deliverPushMessage against the provided context and
|
||||
// Do executes ServiceWorker.skipWaiting against the provided context and
|
||||
// target handler.
|
||||
func (p *DeliverPushMessageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerDeliverPushMessage, p, nil)
|
||||
func (p *SkipWaitingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerSkipWaiting, p, nil)
|
||||
}
|
||||
|
||||
// DispatchSyncEventParams [no description].
|
||||
type DispatchSyncEventParams struct {
|
||||
Origin string `json:"origin"`
|
||||
RegistrationID string `json:"registrationId"`
|
||||
Tag string `json:"tag"`
|
||||
LastChance bool `json:"lastChance"`
|
||||
// StartWorkerParams [no description].
|
||||
type StartWorkerParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// DispatchSyncEvent [no description].
|
||||
// StartWorker [no description].
|
||||
//
|
||||
// parameters:
|
||||
// origin
|
||||
// registrationID
|
||||
// tag
|
||||
// lastChance
|
||||
func DispatchSyncEvent(origin string, registrationID string, tag string, lastChance bool) *DispatchSyncEventParams {
|
||||
return &DispatchSyncEventParams{
|
||||
Origin: origin,
|
||||
RegistrationID: registrationID,
|
||||
Tag: tag,
|
||||
LastChance: lastChance,
|
||||
// scopeURL
|
||||
func StartWorker(scopeURL string) *StartWorkerParams {
|
||||
return &StartWorkerParams{
|
||||
ScopeURL: scopeURL,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.dispatchSyncEvent against the provided context and
|
||||
// Do executes ServiceWorker.startWorker against the provided context and
|
||||
// target handler.
|
||||
func (p *DispatchSyncEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerDispatchSyncEvent, p, nil)
|
||||
func (p *StartWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerStartWorker, p, nil)
|
||||
}
|
||||
|
||||
// StopAllWorkersParams [no description].
|
||||
type StopAllWorkersParams struct{}
|
||||
|
||||
// StopAllWorkers [no description].
|
||||
func StopAllWorkers() *StopAllWorkersParams {
|
||||
return &StopAllWorkersParams{}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.stopAllWorkers against the provided context and
|
||||
// target handler.
|
||||
func (p *StopAllWorkersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerStopAllWorkers, nil, nil)
|
||||
}
|
||||
|
||||
// StopWorkerParams [no description].
|
||||
type StopWorkerParams struct {
|
||||
VersionID string `json:"versionId"`
|
||||
}
|
||||
|
||||
// StopWorker [no description].
|
||||
//
|
||||
// parameters:
|
||||
// versionID
|
||||
func StopWorker(versionID string) *StopWorkerParams {
|
||||
return &StopWorkerParams{
|
||||
VersionID: versionID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.stopWorker against the provided context and
|
||||
// target handler.
|
||||
func (p *StopWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerStopWorker, p, nil)
|
||||
}
|
||||
|
||||
// UnregisterParams [no description].
|
||||
type UnregisterParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// Unregister [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func Unregister(scopeURL string) *UnregisterParams {
|
||||
return &UnregisterParams{
|
||||
ScopeURL: scopeURL,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.unregister against the provided context and
|
||||
// target handler.
|
||||
func (p *UnregisterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerUnregister, p, nil)
|
||||
}
|
||||
|
||||
// UpdateRegistrationParams [no description].
|
||||
type UpdateRegistrationParams struct {
|
||||
ScopeURL string `json:"scopeURL"`
|
||||
}
|
||||
|
||||
// UpdateRegistration [no description].
|
||||
//
|
||||
// parameters:
|
||||
// scopeURL
|
||||
func UpdateRegistration(scopeURL string) *UpdateRegistrationParams {
|
||||
return &UpdateRegistrationParams{
|
||||
ScopeURL: scopeURL,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes ServiceWorker.updateRegistration against the provided context and
|
||||
// target handler.
|
||||
func (p *UpdateRegistrationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandServiceWorkerUpdateRegistration, p, nil)
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ type Version struct {
|
|||
RunningStatus VersionRunningStatus `json:"runningStatus"`
|
||||
Status VersionStatus `json:"status"`
|
||||
ScriptLastModified float64 `json:"scriptLastModified,omitempty"` // The Last-Modified header value of the main script.
|
||||
ScriptResponseTime float64 `json:"scriptResponseTime,omitempty"` // The time at which the response headers of the main script were received from the server. For cached script it is the last time the cache entry was validated.
|
||||
ScriptResponseTime float64 `json:"scriptResponseTime,omitempty"` // The time at which the response headers of the main script were received from the server. For cached script it is the last time the cache entry was validated.
|
||||
ControlledClients []target.ID `json:"controlledClients,omitempty"`
|
||||
TargetID target.ID `json:"targetId,omitempty"`
|
||||
}
|
||||
|
|
|
@ -6,20 +6,14 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventCacheStorageListUpdated a cache has been added/deleted.
|
||||
type EventCacheStorageListUpdated struct {
|
||||
Origin string `json:"origin"` // Origin to update.
|
||||
}
|
||||
|
||||
// EventCacheStorageContentUpdated a cache's contents have been modified.
|
||||
type EventCacheStorageContentUpdated struct {
|
||||
Origin string `json:"origin"` // Origin to update.
|
||||
CacheName string `json:"cacheName"` // Name of cache in origin.
|
||||
}
|
||||
|
||||
// EventIndexedDBListUpdated the origin's IndexedDB database list has been
|
||||
// modified.
|
||||
type EventIndexedDBListUpdated struct {
|
||||
// EventCacheStorageListUpdated a cache has been added/deleted.
|
||||
type EventCacheStorageListUpdated struct {
|
||||
Origin string `json:"origin"` // Origin to update.
|
||||
}
|
||||
|
||||
|
@ -31,10 +25,16 @@ type EventIndexedDBContentUpdated struct {
|
|||
ObjectStoreName string `json:"objectStoreName"` // ObjectStore to update.
|
||||
}
|
||||
|
||||
// EventIndexedDBListUpdated the origin's IndexedDB database list has been
|
||||
// modified.
|
||||
type EventIndexedDBListUpdated struct {
|
||||
Origin string `json:"origin"` // Origin to update.
|
||||
}
|
||||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventStorageCacheStorageListUpdated,
|
||||
cdp.EventStorageCacheStorageContentUpdated,
|
||||
cdp.EventStorageIndexedDBListUpdated,
|
||||
cdp.EventStorageCacheStorageListUpdated,
|
||||
cdp.EventStorageIndexedDBContentUpdated,
|
||||
cdp.EventStorageIndexedDBListUpdated,
|
||||
}
|
||||
|
|
|
@ -99,29 +99,6 @@ func (p *TrackCacheStorageForOriginParams) Do(ctxt context.Context, h cdp.Handle
|
|||
return h.Execute(ctxt, cdp.CommandStorageTrackCacheStorageForOrigin, p, nil)
|
||||
}
|
||||
|
||||
// UntrackCacheStorageForOriginParams unregisters origin from receiving
|
||||
// notifications for cache storage.
|
||||
type UntrackCacheStorageForOriginParams struct {
|
||||
Origin string `json:"origin"` // Security origin.
|
||||
}
|
||||
|
||||
// UntrackCacheStorageForOrigin unregisters origin from receiving
|
||||
// notifications for cache storage.
|
||||
//
|
||||
// parameters:
|
||||
// origin - Security origin.
|
||||
func UntrackCacheStorageForOrigin(origin string) *UntrackCacheStorageForOriginParams {
|
||||
return &UntrackCacheStorageForOriginParams{
|
||||
Origin: origin,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Storage.untrackCacheStorageForOrigin against the provided context and
|
||||
// target handler.
|
||||
func (p *UntrackCacheStorageForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandStorageUntrackCacheStorageForOrigin, p, nil)
|
||||
}
|
||||
|
||||
// TrackIndexedDBForOriginParams registers origin to be notified when an
|
||||
// update occurs to its IndexedDB.
|
||||
type TrackIndexedDBForOriginParams struct {
|
||||
|
@ -145,6 +122,29 @@ func (p *TrackIndexedDBForOriginParams) Do(ctxt context.Context, h cdp.Handler)
|
|||
return h.Execute(ctxt, cdp.CommandStorageTrackIndexedDBForOrigin, p, nil)
|
||||
}
|
||||
|
||||
// UntrackCacheStorageForOriginParams unregisters origin from receiving
|
||||
// notifications for cache storage.
|
||||
type UntrackCacheStorageForOriginParams struct {
|
||||
Origin string `json:"origin"` // Security origin.
|
||||
}
|
||||
|
||||
// UntrackCacheStorageForOrigin unregisters origin from receiving
|
||||
// notifications for cache storage.
|
||||
//
|
||||
// parameters:
|
||||
// origin - Security origin.
|
||||
func UntrackCacheStorageForOrigin(origin string) *UntrackCacheStorageForOriginParams {
|
||||
return &UntrackCacheStorageForOriginParams{
|
||||
Origin: origin,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Storage.untrackCacheStorageForOrigin against the provided context and
|
||||
// target handler.
|
||||
func (p *UntrackCacheStorageForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandStorageUntrackCacheStorageForOrigin, p, nil)
|
||||
}
|
||||
|
||||
// UntrackIndexedDBForOriginParams unregisters origin from receiving
|
||||
// notifications for IndexedDB.
|
||||
type UntrackIndexedDBForOriginParams struct {
|
||||
|
|
|
@ -6,22 +6,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// EventTargetCreated issued when a possible inspection target is created.
|
||||
type EventTargetCreated struct {
|
||||
TargetInfo *Info `json:"targetInfo"`
|
||||
}
|
||||
|
||||
// EventTargetInfoChanged issued when some information about a target has
|
||||
// changed. This only happens between targetCreated and targetDestroyed.
|
||||
type EventTargetInfoChanged struct {
|
||||
TargetInfo *Info `json:"targetInfo"`
|
||||
}
|
||||
|
||||
// EventTargetDestroyed issued when a target is destroyed.
|
||||
type EventTargetDestroyed struct {
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// EventAttachedToTarget issued when attached to target because of
|
||||
// auto-attach or attachToTarget command.
|
||||
type EventAttachedToTarget struct {
|
||||
|
@ -44,12 +28,28 @@ type EventReceivedMessageFromTarget struct {
|
|||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// EventTargetCreated issued when a possible inspection target is created.
|
||||
type EventTargetCreated struct {
|
||||
TargetInfo *Info `json:"targetInfo"`
|
||||
}
|
||||
|
||||
// EventTargetDestroyed issued when a target is destroyed.
|
||||
type EventTargetDestroyed struct {
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// EventTargetInfoChanged issued when some information about a target has
|
||||
// changed. This only happens between targetCreated and targetDestroyed.
|
||||
type EventTargetInfoChanged struct {
|
||||
TargetInfo *Info `json:"targetInfo"`
|
||||
}
|
||||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventTargetTargetCreated,
|
||||
cdp.EventTargetTargetInfoChanged,
|
||||
cdp.EventTargetTargetDestroyed,
|
||||
cdp.EventTargetAttachedToTarget,
|
||||
cdp.EventTargetDetachedFromTarget,
|
||||
cdp.EventTargetReceivedMessageFromTarget,
|
||||
cdp.EventTargetTargetCreated,
|
||||
cdp.EventTargetTargetDestroyed,
|
||||
cdp.EventTargetTargetInfoChanged,
|
||||
}
|
||||
|
|
|
@ -14,168 +14,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// SetDiscoverTargetsParams controls whether to discover available targets
|
||||
// and notify via targetCreated/targetInfoChanged/targetDestroyed events.
|
||||
type SetDiscoverTargetsParams struct {
|
||||
Discover bool `json:"discover"` // Whether to discover available targets.
|
||||
}
|
||||
|
||||
// SetDiscoverTargets controls whether to discover available targets and
|
||||
// notify via targetCreated/targetInfoChanged/targetDestroyed events.
|
||||
//
|
||||
// parameters:
|
||||
// discover - Whether to discover available targets.
|
||||
func SetDiscoverTargets(discover bool) *SetDiscoverTargetsParams {
|
||||
return &SetDiscoverTargetsParams{
|
||||
Discover: discover,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.setDiscoverTargets against the provided context and
|
||||
// target handler.
|
||||
func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetDiscoverTargets, p, nil)
|
||||
}
|
||||
|
||||
// SetAutoAttachParams controls whether to automatically attach to new
|
||||
// targets which are considered to be related to this one. When turned on,
|
||||
// attaches to all existing related targets as well. When turned off,
|
||||
// automatically detaches from all currently attached targets.
|
||||
type SetAutoAttachParams struct {
|
||||
AutoAttach bool `json:"autoAttach"` // Whether to auto-attach to related targets.
|
||||
WaitForDebuggerOnStart bool `json:"waitForDebuggerOnStart"` // Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger to run paused targets.
|
||||
}
|
||||
|
||||
// SetAutoAttach controls whether to automatically attach to new targets
|
||||
// which are considered to be related to this one. When turned on, attaches to
|
||||
// all existing related targets as well. When turned off, automatically detaches
|
||||
// from all currently attached targets.
|
||||
//
|
||||
// parameters:
|
||||
// autoAttach - Whether to auto-attach to related targets.
|
||||
// waitForDebuggerOnStart - Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger to run paused targets.
|
||||
func SetAutoAttach(autoAttach bool, waitForDebuggerOnStart bool) *SetAutoAttachParams {
|
||||
return &SetAutoAttachParams{
|
||||
AutoAttach: autoAttach,
|
||||
WaitForDebuggerOnStart: waitForDebuggerOnStart,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.setAutoAttach against the provided context and
|
||||
// target handler.
|
||||
func (p *SetAutoAttachParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetAutoAttach, p, nil)
|
||||
}
|
||||
|
||||
// SetAttachToFramesParams [no description].
|
||||
type SetAttachToFramesParams struct {
|
||||
Value bool `json:"value"` // Whether to attach to frames.
|
||||
}
|
||||
|
||||
// SetAttachToFrames [no description].
|
||||
//
|
||||
// parameters:
|
||||
// value - Whether to attach to frames.
|
||||
func SetAttachToFrames(value bool) *SetAttachToFramesParams {
|
||||
return &SetAttachToFramesParams{
|
||||
Value: value,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.setAttachToFrames against the provided context and
|
||||
// target handler.
|
||||
func (p *SetAttachToFramesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetAttachToFrames, p, nil)
|
||||
}
|
||||
|
||||
// SetRemoteLocationsParams enables target discovery for the specified
|
||||
// locations, when setDiscoverTargets was set to true.
|
||||
type SetRemoteLocationsParams struct {
|
||||
Locations []*RemoteLocation `json:"locations"` // List of remote locations.
|
||||
}
|
||||
|
||||
// SetRemoteLocations enables target discovery for the specified locations,
|
||||
// when setDiscoverTargets was set to true.
|
||||
//
|
||||
// parameters:
|
||||
// locations - List of remote locations.
|
||||
func SetRemoteLocations(locations []*RemoteLocation) *SetRemoteLocationsParams {
|
||||
return &SetRemoteLocationsParams{
|
||||
Locations: locations,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.setRemoteLocations against the provided context and
|
||||
// target handler.
|
||||
func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetRemoteLocations, p, nil)
|
||||
}
|
||||
|
||||
// SendMessageToTargetParams sends protocol message over session with given
|
||||
// id.
|
||||
type SendMessageToTargetParams struct {
|
||||
Message string `json:"message"`
|
||||
SessionID SessionID `json:"sessionId,omitempty"` // Identifier of the session.
|
||||
}
|
||||
|
||||
// SendMessageToTarget sends protocol message over session with given id.
|
||||
//
|
||||
// parameters:
|
||||
// message
|
||||
func SendMessageToTarget(message string) *SendMessageToTargetParams {
|
||||
return &SendMessageToTargetParams{
|
||||
Message: message,
|
||||
}
|
||||
}
|
||||
|
||||
// WithSessionID identifier of the session.
|
||||
func (p SendMessageToTargetParams) WithSessionID(sessionID SessionID) *SendMessageToTargetParams {
|
||||
p.SessionID = sessionID
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Target.sendMessageToTarget against the provided context and
|
||||
// target handler.
|
||||
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSendMessageToTarget, p, nil)
|
||||
}
|
||||
|
||||
// GetTargetInfoParams returns information about a target.
|
||||
type GetTargetInfoParams struct {
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// GetTargetInfo returns information about a target.
|
||||
//
|
||||
// parameters:
|
||||
// targetID
|
||||
func GetTargetInfo(targetID ID) *GetTargetInfoParams {
|
||||
return &GetTargetInfoParams{
|
||||
TargetID: targetID,
|
||||
}
|
||||
}
|
||||
|
||||
// GetTargetInfoReturns return values.
|
||||
type GetTargetInfoReturns struct {
|
||||
TargetInfo *Info `json:"targetInfo,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Target.getTargetInfo against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// targetInfo
|
||||
func (p *GetTargetInfoParams) Do(ctxt context.Context, h cdp.Handler) (targetInfo *Info, err error) {
|
||||
// execute
|
||||
var res GetTargetInfoReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetGetTargetInfo, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.TargetInfo, nil
|
||||
}
|
||||
|
||||
// ActivateTargetParams activates (focuses) the target.
|
||||
type ActivateTargetParams struct {
|
||||
TargetID ID `json:"targetId"`
|
||||
|
@ -197,6 +35,42 @@ func (p *ActivateTargetParams) Do(ctxt context.Context, h cdp.Handler) (err erro
|
|||
return h.Execute(ctxt, cdp.CommandTargetActivateTarget, p, nil)
|
||||
}
|
||||
|
||||
// AttachToTargetParams attaches to the target with given id.
|
||||
type AttachToTargetParams struct {
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// AttachToTarget attaches to the target with given id.
|
||||
//
|
||||
// parameters:
|
||||
// targetID
|
||||
func AttachToTarget(targetID ID) *AttachToTargetParams {
|
||||
return &AttachToTargetParams{
|
||||
TargetID: targetID,
|
||||
}
|
||||
}
|
||||
|
||||
// AttachToTargetReturns return values.
|
||||
type AttachToTargetReturns struct {
|
||||
SessionID SessionID `json:"sessionId,omitempty"` // Id assigned to the session.
|
||||
}
|
||||
|
||||
// Do executes Target.attachToTarget against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// sessionID - Id assigned to the session.
|
||||
func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (sessionID SessionID, err error) {
|
||||
// execute
|
||||
var res AttachToTargetReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetAttachToTarget, p, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return res.SessionID, nil
|
||||
}
|
||||
|
||||
// CloseTargetParams closes the target. If the target is a page that gets
|
||||
// closed too.
|
||||
type CloseTargetParams struct {
|
||||
|
@ -235,66 +109,6 @@ func (p *CloseTargetParams) Do(ctxt context.Context, h cdp.Handler) (success boo
|
|||
return res.Success, nil
|
||||
}
|
||||
|
||||
// AttachToTargetParams attaches to the target with given id.
|
||||
type AttachToTargetParams struct {
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// AttachToTarget attaches to the target with given id.
|
||||
//
|
||||
// parameters:
|
||||
// targetID
|
||||
func AttachToTarget(targetID ID) *AttachToTargetParams {
|
||||
return &AttachToTargetParams{
|
||||
TargetID: targetID,
|
||||
}
|
||||
}
|
||||
|
||||
// AttachToTargetReturns return values.
|
||||
type AttachToTargetReturns struct {
|
||||
SessionID SessionID `json:"sessionId,omitempty"` // Id assigned to the session.
|
||||
}
|
||||
|
||||
// Do executes Target.attachToTarget against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// sessionID - Id assigned to the session.
|
||||
func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (sessionID SessionID, err error) {
|
||||
// execute
|
||||
var res AttachToTargetReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetAttachToTarget, p, &res)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return res.SessionID, nil
|
||||
}
|
||||
|
||||
// DetachFromTargetParams detaches session with given id.
|
||||
type DetachFromTargetParams struct {
|
||||
SessionID SessionID `json:"sessionId,omitempty"` // Session to detach.
|
||||
}
|
||||
|
||||
// DetachFromTarget detaches session with given id.
|
||||
//
|
||||
// parameters:
|
||||
func DetachFromTarget() *DetachFromTargetParams {
|
||||
return &DetachFromTargetParams{}
|
||||
}
|
||||
|
||||
// WithSessionID session to detach.
|
||||
func (p DetachFromTargetParams) WithSessionID(sessionID SessionID) *DetachFromTargetParams {
|
||||
p.SessionID = sessionID
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Target.detachFromTarget against the provided context and
|
||||
// target handler.
|
||||
func (p *DetachFromTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetDetachFromTarget, p, nil)
|
||||
}
|
||||
|
||||
// CreateBrowserContextParams creates a new empty BrowserContext. Similar to
|
||||
// an incognito profile but you can have more than one.
|
||||
type CreateBrowserContextParams struct{}
|
||||
|
@ -326,44 +140,6 @@ func (p *CreateBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (br
|
|||
return res.BrowserContextID, nil
|
||||
}
|
||||
|
||||
// DisposeBrowserContextParams deletes a BrowserContext, will fail of any
|
||||
// open page uses it.
|
||||
type DisposeBrowserContextParams struct {
|
||||
BrowserContextID BrowserContextID `json:"browserContextId"`
|
||||
}
|
||||
|
||||
// DisposeBrowserContext deletes a BrowserContext, will fail of any open page
|
||||
// uses it.
|
||||
//
|
||||
// parameters:
|
||||
// browserContextID
|
||||
func DisposeBrowserContext(browserContextID BrowserContextID) *DisposeBrowserContextParams {
|
||||
return &DisposeBrowserContextParams{
|
||||
BrowserContextID: browserContextID,
|
||||
}
|
||||
}
|
||||
|
||||
// DisposeBrowserContextReturns return values.
|
||||
type DisposeBrowserContextReturns struct {
|
||||
Success bool `json:"success,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Target.disposeBrowserContext against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// success
|
||||
func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||
// execute
|
||||
var res DisposeBrowserContextReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetDisposeBrowserContext, p, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return res.Success, nil
|
||||
}
|
||||
|
||||
// CreateTargetParams creates a new page.
|
||||
type CreateTargetParams struct {
|
||||
URL string `json:"url"` // The initial URL the page will be navigated to.
|
||||
|
@ -431,6 +207,104 @@ func (p *CreateTargetParams) Do(ctxt context.Context, h cdp.Handler) (targetID I
|
|||
return res.TargetID, nil
|
||||
}
|
||||
|
||||
// DetachFromTargetParams detaches session with given id.
|
||||
type DetachFromTargetParams struct {
|
||||
SessionID SessionID `json:"sessionId,omitempty"` // Session to detach.
|
||||
}
|
||||
|
||||
// DetachFromTarget detaches session with given id.
|
||||
//
|
||||
// parameters:
|
||||
func DetachFromTarget() *DetachFromTargetParams {
|
||||
return &DetachFromTargetParams{}
|
||||
}
|
||||
|
||||
// WithSessionID session to detach.
|
||||
func (p DetachFromTargetParams) WithSessionID(sessionID SessionID) *DetachFromTargetParams {
|
||||
p.SessionID = sessionID
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Target.detachFromTarget against the provided context and
|
||||
// target handler.
|
||||
func (p *DetachFromTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetDetachFromTarget, p, nil)
|
||||
}
|
||||
|
||||
// DisposeBrowserContextParams deletes a BrowserContext, will fail of any
|
||||
// open page uses it.
|
||||
type DisposeBrowserContextParams struct {
|
||||
BrowserContextID BrowserContextID `json:"browserContextId"`
|
||||
}
|
||||
|
||||
// DisposeBrowserContext deletes a BrowserContext, will fail of any open page
|
||||
// uses it.
|
||||
//
|
||||
// parameters:
|
||||
// browserContextID
|
||||
func DisposeBrowserContext(browserContextID BrowserContextID) *DisposeBrowserContextParams {
|
||||
return &DisposeBrowserContextParams{
|
||||
BrowserContextID: browserContextID,
|
||||
}
|
||||
}
|
||||
|
||||
// DisposeBrowserContextReturns return values.
|
||||
type DisposeBrowserContextReturns struct {
|
||||
Success bool `json:"success,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Target.disposeBrowserContext against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// success
|
||||
func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
|
||||
// execute
|
||||
var res DisposeBrowserContextReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetDisposeBrowserContext, p, &res)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return res.Success, nil
|
||||
}
|
||||
|
||||
// GetTargetInfoParams returns information about a target.
|
||||
type GetTargetInfoParams struct {
|
||||
TargetID ID `json:"targetId"`
|
||||
}
|
||||
|
||||
// GetTargetInfo returns information about a target.
|
||||
//
|
||||
// parameters:
|
||||
// targetID
|
||||
func GetTargetInfo(targetID ID) *GetTargetInfoParams {
|
||||
return &GetTargetInfoParams{
|
||||
TargetID: targetID,
|
||||
}
|
||||
}
|
||||
|
||||
// GetTargetInfoReturns return values.
|
||||
type GetTargetInfoReturns struct {
|
||||
TargetInfo *Info `json:"targetInfo,omitempty"`
|
||||
}
|
||||
|
||||
// Do executes Target.getTargetInfo against the provided context and
|
||||
// target handler.
|
||||
//
|
||||
// returns:
|
||||
// targetInfo
|
||||
func (p *GetTargetInfoParams) Do(ctxt context.Context, h cdp.Handler) (targetInfo *Info, err error) {
|
||||
// execute
|
||||
var res GetTargetInfoReturns
|
||||
err = h.Execute(ctxt, cdp.CommandTargetGetTargetInfo, p, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res.TargetInfo, nil
|
||||
}
|
||||
|
||||
// GetTargetsParams retrieves a list of available targets.
|
||||
type GetTargetsParams struct{}
|
||||
|
||||
|
@ -459,3 +333,129 @@ func (p *GetTargetsParams) Do(ctxt context.Context, h cdp.Handler) (targetInfos
|
|||
|
||||
return res.TargetInfos, nil
|
||||
}
|
||||
|
||||
// SendMessageToTargetParams sends protocol message over session with given
|
||||
// id.
|
||||
type SendMessageToTargetParams struct {
|
||||
Message string `json:"message"`
|
||||
SessionID SessionID `json:"sessionId,omitempty"` // Identifier of the session.
|
||||
}
|
||||
|
||||
// SendMessageToTarget sends protocol message over session with given id.
|
||||
//
|
||||
// parameters:
|
||||
// message
|
||||
func SendMessageToTarget(message string) *SendMessageToTargetParams {
|
||||
return &SendMessageToTargetParams{
|
||||
Message: message,
|
||||
}
|
||||
}
|
||||
|
||||
// WithSessionID identifier of the session.
|
||||
func (p SendMessageToTargetParams) WithSessionID(sessionID SessionID) *SendMessageToTargetParams {
|
||||
p.SessionID = sessionID
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Target.sendMessageToTarget against the provided context and
|
||||
// target handler.
|
||||
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSendMessageToTarget, p, nil)
|
||||
}
|
||||
|
||||
// SetAttachToFramesParams [no description].
|
||||
type SetAttachToFramesParams struct {
|
||||
Value bool `json:"value"` // Whether to attach to frames.
|
||||
}
|
||||
|
||||
// SetAttachToFrames [no description].
|
||||
//
|
||||
// parameters:
|
||||
// value - Whether to attach to frames.
|
||||
func SetAttachToFrames(value bool) *SetAttachToFramesParams {
|
||||
return &SetAttachToFramesParams{
|
||||
Value: value,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.setAttachToFrames against the provided context and
|
||||
// target handler.
|
||||
func (p *SetAttachToFramesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetAttachToFrames, p, nil)
|
||||
}
|
||||
|
||||
// SetAutoAttachParams controls whether to automatically attach to new
|
||||
// targets which are considered to be related to this one. When turned on,
|
||||
// attaches to all existing related targets as well. When turned off,
|
||||
// automatically detaches from all currently attached targets.
|
||||
type SetAutoAttachParams struct {
|
||||
AutoAttach bool `json:"autoAttach"` // Whether to auto-attach to related targets.
|
||||
WaitForDebuggerOnStart bool `json:"waitForDebuggerOnStart"` // Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger to run paused targets.
|
||||
}
|
||||
|
||||
// SetAutoAttach controls whether to automatically attach to new targets
|
||||
// which are considered to be related to this one. When turned on, attaches to
|
||||
// all existing related targets as well. When turned off, automatically detaches
|
||||
// from all currently attached targets.
|
||||
//
|
||||
// parameters:
|
||||
// autoAttach - Whether to auto-attach to related targets.
|
||||
// waitForDebuggerOnStart - Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger to run paused targets.
|
||||
func SetAutoAttach(autoAttach bool, waitForDebuggerOnStart bool) *SetAutoAttachParams {
|
||||
return &SetAutoAttachParams{
|
||||
AutoAttach: autoAttach,
|
||||
WaitForDebuggerOnStart: waitForDebuggerOnStart,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.setAutoAttach against the provided context and
|
||||
// target handler.
|
||||
func (p *SetAutoAttachParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetAutoAttach, p, nil)
|
||||
}
|
||||
|
||||
// SetDiscoverTargetsParams controls whether to discover available targets
|
||||
// and notify via targetCreated/targetInfoChanged/targetDestroyed events.
|
||||
type SetDiscoverTargetsParams struct {
|
||||
Discover bool `json:"discover"` // Whether to discover available targets.
|
||||
}
|
||||
|
||||
// SetDiscoverTargets controls whether to discover available targets and
|
||||
// notify via targetCreated/targetInfoChanged/targetDestroyed events.
|
||||
//
|
||||
// parameters:
|
||||
// discover - Whether to discover available targets.
|
||||
func SetDiscoverTargets(discover bool) *SetDiscoverTargetsParams {
|
||||
return &SetDiscoverTargetsParams{
|
||||
Discover: discover,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.setDiscoverTargets against the provided context and
|
||||
// target handler.
|
||||
func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetDiscoverTargets, p, nil)
|
||||
}
|
||||
|
||||
// SetRemoteLocationsParams enables target discovery for the specified
|
||||
// locations, when setDiscoverTargets was set to true.
|
||||
type SetRemoteLocationsParams struct {
|
||||
Locations []*RemoteLocation `json:"locations"` // List of remote locations.
|
||||
}
|
||||
|
||||
// SetRemoteLocations enables target discovery for the specified locations,
|
||||
// when setDiscoverTargets was set to true.
|
||||
//
|
||||
// parameters:
|
||||
// locations - List of remote locations.
|
||||
func SetRemoteLocations(locations []*RemoteLocation) *SetRemoteLocationsParams {
|
||||
return &SetRemoteLocationsParams{
|
||||
Locations: locations,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Target.setRemoteLocations against the provided context and
|
||||
// target handler.
|
||||
func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTargetSetRemoteLocations, p, nil)
|
||||
}
|
||||
|
|
|
@ -294,6 +294,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTracing1(in *jlexer.Lexer, out
|
|||
out.BufferUsageReportingInterval = float64(in.Float64())
|
||||
case "transferMode":
|
||||
(out.TransferMode).UnmarshalEasyJSON(in)
|
||||
case "streamCompression":
|
||||
(out.StreamCompression).UnmarshalEasyJSON(in)
|
||||
case "traceConfig":
|
||||
if in.IsNull() {
|
||||
in.Skip()
|
||||
|
@ -338,6 +340,16 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTracing1(out *jwriter.Writer,
|
|||
}
|
||||
(in.TransferMode).MarshalEasyJSON(out)
|
||||
}
|
||||
if in.StreamCompression != "" {
|
||||
const prefix string = ",\"streamCompression\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
(in.StreamCompression).MarshalEasyJSON(out)
|
||||
}
|
||||
if in.TraceConfig != nil {
|
||||
const prefix string = ",\"traceConfig\":"
|
||||
if first {
|
||||
|
@ -827,6 +839,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpTracing8(in *jlexer.Lexer, out
|
|||
switch key {
|
||||
case "stream":
|
||||
out.Stream = io.StreamHandle(in.String())
|
||||
case "streamCompression":
|
||||
(out.StreamCompression).UnmarshalEasyJSON(in)
|
||||
default:
|
||||
in.SkipRecursive()
|
||||
}
|
||||
|
@ -851,6 +865,16 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpTracing8(out *jwriter.Writer,
|
|||
}
|
||||
out.String(string(in.Stream))
|
||||
}
|
||||
if in.StreamCompression != "" {
|
||||
const prefix string = ",\"streamCompression\":"
|
||||
if first {
|
||||
first = false
|
||||
out.RawString(prefix[1:])
|
||||
} else {
|
||||
out.RawString(prefix)
|
||||
}
|
||||
(in.StreamCompression).MarshalEasyJSON(out)
|
||||
}
|
||||
out.RawByte('}')
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,13 @@ import (
|
|||
"github.com/mailru/easyjson"
|
||||
)
|
||||
|
||||
// EventBufferUsage [no description].
|
||||
type EventBufferUsage struct {
|
||||
PercentFull float64 `json:"percentFull,omitempty"` // A number in range [0..1] that indicates the used size of event buffer as a fraction of its total size.
|
||||
EventCount float64 `json:"eventCount,omitempty"` // An approximate number of events in the trace log.
|
||||
Value float64 `json:"value,omitempty"` // A number in range [0..1] that indicates the used size of event buffer as a fraction of its total size.
|
||||
}
|
||||
|
||||
// EventDataCollected contains an bucket of collected trace events. When
|
||||
// tracing is stopped collected events will be send as a sequence of
|
||||
// dataCollected events followed by tracingComplete event.
|
||||
|
@ -18,19 +25,13 @@ type EventDataCollected struct {
|
|||
// EventTracingComplete signals that tracing is stopped and there is no trace
|
||||
// buffers pending flush, all data were delivered via dataCollected events.
|
||||
type EventTracingComplete struct {
|
||||
Stream io.StreamHandle `json:"stream,omitempty"` // A handle of the stream that holds resulting trace data.
|
||||
}
|
||||
|
||||
// EventBufferUsage [no description].
|
||||
type EventBufferUsage struct {
|
||||
PercentFull float64 `json:"percentFull,omitempty"` // A number in range [0..1] that indicates the used size of event buffer as a fraction of its total size.
|
||||
EventCount float64 `json:"eventCount,omitempty"` // An approximate number of events in the trace log.
|
||||
Value float64 `json:"value,omitempty"` // A number in range [0..1] that indicates the used size of event buffer as a fraction of its total size.
|
||||
Stream io.StreamHandle `json:"stream,omitempty"` // A handle of the stream that holds resulting trace data.
|
||||
StreamCompression StreamCompression `json:"streamCompression,omitempty"` // Compression format of returned stream.
|
||||
}
|
||||
|
||||
// EventTypes all event types in the domain.
|
||||
var EventTypes = []cdp.MethodType{
|
||||
cdp.EventTracingBufferUsage,
|
||||
cdp.EventTracingDataCollected,
|
||||
cdp.EventTracingTracingComplete,
|
||||
cdp.EventTracingBufferUsage,
|
||||
}
|
||||
|
|
|
@ -12,46 +12,6 @@ import (
|
|||
cdp "github.com/knq/chromedp/cdp"
|
||||
)
|
||||
|
||||
// StartParams start trace events collection.
|
||||
type StartParams struct {
|
||||
BufferUsageReportingInterval float64 `json:"bufferUsageReportingInterval,omitempty"` // If set, the agent will issue bufferUsage events at this interval, specified in milliseconds
|
||||
TransferMode TransferMode `json:"transferMode,omitempty"` // Whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to ReportEvents).
|
||||
TraceConfig *TraceConfig `json:"traceConfig,omitempty"`
|
||||
}
|
||||
|
||||
// Start start trace events collection.
|
||||
//
|
||||
// parameters:
|
||||
func Start() *StartParams {
|
||||
return &StartParams{}
|
||||
}
|
||||
|
||||
// WithBufferUsageReportingInterval if set, the agent will issue bufferUsage
|
||||
// events at this interval, specified in milliseconds.
|
||||
func (p StartParams) WithBufferUsageReportingInterval(bufferUsageReportingInterval float64) *StartParams {
|
||||
p.BufferUsageReportingInterval = bufferUsageReportingInterval
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithTransferMode whether to report trace events as series of dataCollected
|
||||
// events or to save trace to a stream (defaults to ReportEvents).
|
||||
func (p StartParams) WithTransferMode(transferMode TransferMode) *StartParams {
|
||||
p.TransferMode = transferMode
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithTraceConfig [no description].
|
||||
func (p StartParams) WithTraceConfig(traceConfig *TraceConfig) *StartParams {
|
||||
p.TraceConfig = traceConfig
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Tracing.start against the provided context and
|
||||
// target handler.
|
||||
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTracingStart, p, nil)
|
||||
}
|
||||
|
||||
// EndParams stop trace events collection.
|
||||
type EndParams struct{}
|
||||
|
||||
|
@ -95,6 +55,27 @@ func (p *GetCategoriesParams) Do(ctxt context.Context, h cdp.Handler) (categorie
|
|||
return res.Categories, nil
|
||||
}
|
||||
|
||||
// RecordClockSyncMarkerParams record a clock sync marker in the trace.
|
||||
type RecordClockSyncMarkerParams struct {
|
||||
SyncID string `json:"syncId"` // The ID of this clock sync marker
|
||||
}
|
||||
|
||||
// RecordClockSyncMarker record a clock sync marker in the trace.
|
||||
//
|
||||
// parameters:
|
||||
// syncID - The ID of this clock sync marker
|
||||
func RecordClockSyncMarker(syncID string) *RecordClockSyncMarkerParams {
|
||||
return &RecordClockSyncMarkerParams{
|
||||
SyncID: syncID,
|
||||
}
|
||||
}
|
||||
|
||||
// Do executes Tracing.recordClockSyncMarker against the provided context and
|
||||
// target handler.
|
||||
func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTracingRecordClockSyncMarker, p, nil)
|
||||
}
|
||||
|
||||
// RequestMemoryDumpParams request a global memory dump.
|
||||
type RequestMemoryDumpParams struct{}
|
||||
|
||||
|
@ -126,23 +107,50 @@ func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h cdp.Handler) (dumpG
|
|||
return res.DumpGUID, res.Success, nil
|
||||
}
|
||||
|
||||
// RecordClockSyncMarkerParams record a clock sync marker in the trace.
|
||||
type RecordClockSyncMarkerParams struct {
|
||||
SyncID string `json:"syncId"` // The ID of this clock sync marker
|
||||
// StartParams start trace events collection.
|
||||
type StartParams struct {
|
||||
BufferUsageReportingInterval float64 `json:"bufferUsageReportingInterval,omitempty"` // If set, the agent will issue bufferUsage events at this interval, specified in milliseconds
|
||||
TransferMode TransferMode `json:"transferMode,omitempty"` // Whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to ReportEvents).
|
||||
StreamCompression StreamCompression `json:"streamCompression,omitempty"` // Compression format to use. This only applies when using ReturnAsStream transfer mode (defaults to none)
|
||||
TraceConfig *TraceConfig `json:"traceConfig,omitempty"`
|
||||
}
|
||||
|
||||
// RecordClockSyncMarker record a clock sync marker in the trace.
|
||||
// Start start trace events collection.
|
||||
//
|
||||
// parameters:
|
||||
// syncID - The ID of this clock sync marker
|
||||
func RecordClockSyncMarker(syncID string) *RecordClockSyncMarkerParams {
|
||||
return &RecordClockSyncMarkerParams{
|
||||
SyncID: syncID,
|
||||
}
|
||||
func Start() *StartParams {
|
||||
return &StartParams{}
|
||||
}
|
||||
|
||||
// Do executes Tracing.recordClockSyncMarker against the provided context and
|
||||
// target handler.
|
||||
func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTracingRecordClockSyncMarker, p, nil)
|
||||
// WithBufferUsageReportingInterval if set, the agent will issue bufferUsage
|
||||
// events at this interval, specified in milliseconds.
|
||||
func (p StartParams) WithBufferUsageReportingInterval(bufferUsageReportingInterval float64) *StartParams {
|
||||
p.BufferUsageReportingInterval = bufferUsageReportingInterval
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithTransferMode whether to report trace events as series of dataCollected
|
||||
// events or to save trace to a stream (defaults to ReportEvents).
|
||||
func (p StartParams) WithTransferMode(transferMode TransferMode) *StartParams {
|
||||
p.TransferMode = transferMode
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithStreamCompression compression format to use. This only applies when
|
||||
// using ReturnAsStream transfer mode (defaults to none).
|
||||
func (p StartParams) WithStreamCompression(streamCompression StreamCompression) *StartParams {
|
||||
p.StreamCompression = streamCompression
|
||||
return &p
|
||||
}
|
||||
|
||||
// WithTraceConfig [no description].
|
||||
func (p StartParams) WithTraceConfig(traceConfig *TraceConfig) *StartParams {
|
||||
p.TraceConfig = traceConfig
|
||||
return &p
|
||||
}
|
||||
|
||||
// Do executes Tracing.start against the provided context and
|
||||
// target handler.
|
||||
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||||
return h.Execute(ctxt, cdp.CommandTracingStart, p, nil)
|
||||
}
|
||||
|
|
|
@ -26,6 +26,48 @@ type TraceConfig struct {
|
|||
MemoryDumpConfig *MemoryDumpConfig `json:"memoryDumpConfig,omitempty"` // Configuration for memory dump triggers. Used only when "memory-infra" category is enabled.
|
||||
}
|
||||
|
||||
// StreamCompression compression type to use for traces returned via streams.
|
||||
type StreamCompression string
|
||||
|
||||
// String returns the StreamCompression as string value.
|
||||
func (t StreamCompression) String() string {
|
||||
return string(t)
|
||||
}
|
||||
|
||||
// StreamCompression values.
|
||||
const (
|
||||
StreamCompressionNone StreamCompression = "none"
|
||||
StreamCompressionGzip StreamCompression = "gzip"
|
||||
)
|
||||
|
||||
// MarshalEasyJSON satisfies easyjson.Marshaler.
|
||||
func (t StreamCompression) MarshalEasyJSON(out *jwriter.Writer) {
|
||||
out.String(string(t))
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (t StreamCompression) MarshalJSON() ([]byte, error) {
|
||||
return easyjson.Marshal(t)
|
||||
}
|
||||
|
||||
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
|
||||
func (t *StreamCompression) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||
switch StreamCompression(in.String()) {
|
||||
case StreamCompressionNone:
|
||||
*t = StreamCompressionNone
|
||||
case StreamCompressionGzip:
|
||||
*t = StreamCompressionGzip
|
||||
|
||||
default:
|
||||
in.AddError(errors.New("unknown StreamCompression value"))
|
||||
}
|
||||
}
|
||||
|
||||
// UnmarshalJSON satisfies json.Unmarshaler.
|
||||
func (t *StreamCompression) UnmarshalJSON(buf []byte) error {
|
||||
return easyjson.Unmarshal(buf, t)
|
||||
}
|
||||
|
||||
// RecordMode controls how the trace buffer stores data.
|
||||
type RecordMode string
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user