Renaming FrameHandler, updating to latest protocol.json, and code fixes

This commit is contained in:
Kenneth Shaw 2017-02-12 11:59:33 +07:00
parent ee58f3a0e0
commit f73c429109
70 changed files with 1825 additions and 1308 deletions

2
.gitignore vendored
View File

@ -4,6 +4,8 @@ old*.txt
cdp-*.log
cdp-*.txt
coverage.out
# binaries
/chromedp-gen
/cmd/chromedp-gen/chromedp-gen

View File

@ -7,24 +7,27 @@ import (
"github.com/knq/chromedp/cdp"
)
// Action is a single atomic action.
// Action is the common interface for an action that will be executed against a
// context and frame handler.
type Action interface {
Do(context.Context, cdp.FrameHandler) error
// Do executes the action using the provided context and frame handler.
Do(context.Context, cdp.Handler) error
}
// ActionFunc is a single action func.
type ActionFunc func(context.Context, cdp.FrameHandler) error
// ActionFunc is a adapter to allow the use of ordinary func's as an Action.
type ActionFunc func(context.Context, cdp.Handler) error
// Do executes the action using the provided context.
func (f ActionFunc) Do(ctxt context.Context, h cdp.FrameHandler) error {
// Do executes the func f using the provided context and frame handler.
func (f ActionFunc) Do(ctxt context.Context, h cdp.Handler) error {
return f(ctxt, h)
}
// Tasks is a list of Actions that can be used as a single Action.
// Tasks is a sequential list of Actions that can be used as a single Action.
type Tasks []Action
// Do executes the list of Tasks using the provided context.
func (t Tasks) Do(ctxt context.Context, h cdp.FrameHandler) error {
// Do executes the list of Actions sequentially, using the provided context and
// frame handler.
func (t Tasks) Do(ctxt context.Context, h cdp.Handler) error {
var err error
// TODO: put individual task timeouts from context here
@ -41,9 +44,18 @@ func (t Tasks) Do(ctxt context.Context, h cdp.FrameHandler) error {
}
// Sleep is an empty action that calls time.Sleep with the specified duration.
//
// Note: this is a temporary action definition for convenience, and will likely
// be marked for deprecation in the future, after the remaining Actions have
// been able to be written/tested.
func Sleep(d time.Duration) Action {
return ActionFunc(func(context.Context, cdp.FrameHandler) error {
time.Sleep(d)
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
select {
case <-time.After(d):
case <-ctxt.Done():
return ctxt.Err()
}
return nil
})
}

View File

@ -1,5 +1,5 @@
// Package accessibility provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Accessibility domain.
// commands, types, and events for the Accessibility domain.
//
// Generated by the chromedp-gen command.
package accessibility
@ -43,11 +43,12 @@ type GetPartialAXTreeReturns struct {
Nodes []*AXNode `json:"nodes,omitempty"` // The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
}
// Do executes Accessibility.getPartialAXTree.
// Do executes Accessibility.getPartialAXTree against the provided context and
// target handler.
//
// returns:
// nodes - The Accessibility.AXNode for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodes []*AXNode, err error) {
func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h cdp.Handler) (nodes []*AXNode, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -84,7 +85,7 @@ func (p *GetPartialAXTreeParams) Do(ctxt context.Context, h cdp.FrameHandler) (n
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package animation provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Animation domain.
// commands, types, and events for the Animation domain.
//
// Generated by the chromedp-gen command.
package animation
@ -22,8 +22,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Animation.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Animation.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -47,7 +48,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -61,8 +62,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Animation.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Animation.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -86,7 +88,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -105,11 +107,12 @@ type GetPlaybackRateReturns struct {
PlaybackRate float64 `json:"playbackRate,omitempty"` // Playback rate for animations on page.
}
// Do executes Animation.getPlaybackRate.
// Do executes Animation.getPlaybackRate against the provided context and
// target handler.
//
// returns:
// playbackRate - Playback rate for animations on page.
func (p *GetPlaybackRateParams) Do(ctxt context.Context, h cdp.FrameHandler) (playbackRate float64, err error) {
func (p *GetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (playbackRate float64, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -140,7 +143,7 @@ func (p *GetPlaybackRateParams) Do(ctxt context.Context, h cdp.FrameHandler) (pl
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -161,8 +164,9 @@ func SetPlaybackRate(playbackRate float64) *SetPlaybackRateParams {
}
}
// Do executes Animation.setPlaybackRate.
func (p *SetPlaybackRateParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Animation.setPlaybackRate against the provided context and
// target handler.
func (p *SetPlaybackRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -192,7 +196,7 @@ func (p *SetPlaybackRateParams) Do(ctxt context.Context, h cdp.FrameHandler) (er
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -218,11 +222,12 @@ type GetCurrentTimeReturns struct {
CurrentTime float64 `json:"currentTime,omitempty"` // Current time of the page.
}
// Do executes Animation.getCurrentTime.
// Do executes Animation.getCurrentTime against the provided context and
// target handler.
//
// returns:
// currentTime - Current time of the page.
func (p *GetCurrentTimeParams) Do(ctxt context.Context, h cdp.FrameHandler) (currentTime float64, err error) {
func (p *GetCurrentTimeParams) Do(ctxt context.Context, h cdp.Handler) (currentTime float64, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -259,7 +264,7 @@ func (p *GetCurrentTimeParams) Do(ctxt context.Context, h cdp.FrameHandler) (cur
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -283,8 +288,9 @@ func SetPaused(animations []string, paused bool) *SetPausedParams {
}
}
// Do executes Animation.setPaused.
func (p *SetPausedParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Animation.setPaused against the provided context and
// target handler.
func (p *SetPausedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -314,7 +320,7 @@ func (p *SetPausedParams) Do(ctxt context.Context, h cdp.FrameHandler) (err erro
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -341,8 +347,9 @@ func SetTiming(animationID string, duration float64, delay float64) *SetTimingPa
}
}
// Do executes Animation.setTiming.
func (p *SetTimingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Animation.setTiming against the provided context and
// target handler.
func (p *SetTimingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -372,7 +379,7 @@ func (p *SetTimingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err erro
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -398,8 +405,9 @@ func SeekAnimations(animations []string, currentTime float64) *SeekAnimationsPar
}
}
// Do executes Animation.seekAnimations.
func (p *SeekAnimationsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Animation.seekAnimations against the provided context and
// target handler.
func (p *SeekAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -429,7 +437,7 @@ func (p *SeekAnimationsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -452,8 +460,9 @@ func ReleaseAnimations(animations []string) *ReleaseAnimationsParams {
}
}
// Do executes Animation.releaseAnimations.
func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Animation.releaseAnimations against the provided context and
// target handler.
func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -483,7 +492,7 @@ func (p *ReleaseAnimationsParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -509,11 +518,12 @@ type ResolveAnimationReturns struct {
RemoteObject *runtime.RemoteObject `json:"remoteObject,omitempty"` // Corresponding remote object.
}
// Do executes Animation.resolveAnimation.
// Do executes Animation.resolveAnimation against the provided context and
// target handler.
//
// returns:
// remoteObject - Corresponding remote object.
func (p *ResolveAnimationParams) Do(ctxt context.Context, h cdp.FrameHandler) (remoteObject *runtime.RemoteObject, err error) {
func (p *ResolveAnimationParams) Do(ctxt context.Context, h cdp.Handler) (remoteObject *runtime.RemoteObject, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -550,7 +560,7 @@ func (p *ResolveAnimationParams) Do(ctxt context.Context, h cdp.FrameHandler) (r
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package applicationcache provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome ApplicationCache domain.
// commands, types, and events for the ApplicationCache domain.
//
// Generated by the chromedp-gen command.
package applicationcache
@ -30,11 +30,12 @@ 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.
// 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.FrameHandler) (frameIds []*FrameWithManifest, err error) {
func (p *GetFramesWithManifestsParams) Do(ctxt context.Context, h cdp.Handler) (frameIds []*FrameWithManifest, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -65,7 +66,7 @@ func (p *GetFramesWithManifestsParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -79,8 +80,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes ApplicationCache.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ApplicationCache.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -104,7 +106,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -131,11 +133,12 @@ type GetManifestForFrameReturns struct {
ManifestURL string `json:"manifestURL,omitempty"` // Manifest URL for document in the given frame.
}
// Do executes ApplicationCache.getManifestForFrame.
// 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.FrameHandler) (manifestURL string, err error) {
func (p *GetManifestForFrameParams) Do(ctxt context.Context, h cdp.Handler) (manifestURL string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -172,7 +175,7 @@ func (p *GetManifestForFrameParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -200,11 +203,12 @@ type GetApplicationCacheForFrameReturns struct {
ApplicationCache *ApplicationCache `json:"applicationCache,omitempty"` // Relevant application cache data for the document in given frame.
}
// Do executes ApplicationCache.getApplicationCacheForFrame.
// Do executes ApplicationCache.getApplicationCacheForFrame against the provided context and
// target handler.
//
// returns:
// applicationCache - Relevant application cache data for the document in given frame.
func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h cdp.FrameHandler) (applicationCache *ApplicationCache, err error) {
func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h cdp.Handler) (applicationCache *ApplicationCache, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -241,7 +245,7 @@ func (p *GetApplicationCacheForFrameParams) Do(ctxt context.Context, h cdp.Frame
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package cachestorage provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome CacheStorage domain.
// commands, types, and events for the CacheStorage domain.
//
// Generated by the chromedp-gen command.
package cachestorage
@ -33,11 +33,12 @@ type RequestCacheNamesReturns struct {
Caches []*Cache `json:"caches,omitempty"` // Caches for the security origin.
}
// Do executes CacheStorage.requestCacheNames.
// 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.FrameHandler) (caches []*Cache, err error) {
func (p *RequestCacheNamesParams) Do(ctxt context.Context, h cdp.Handler) (caches []*Cache, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -74,7 +75,7 @@ func (p *RequestCacheNamesParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -107,12 +108,13 @@ type RequestEntriesReturns struct {
HasMore bool `json:"hasMore,omitempty"` // If true, there are more entries to fetch in the given range.
}
// Do executes CacheStorage.requestEntries.
// 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.FrameHandler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
func (p *RequestEntriesParams) Do(ctxt context.Context, h cdp.Handler) (cacheDataEntries []*DataEntry, hasMore bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -149,7 +151,7 @@ func (p *RequestEntriesParams) Do(ctxt context.Context, h cdp.FrameHandler) (cac
}
case <-ctxt.Done():
return nil, false, cdp.ErrContextDone
return nil, false, ctxt.Err()
}
return nil, false, cdp.ErrUnknownResult
@ -170,8 +172,9 @@ func DeleteCache(cacheID CacheID) *DeleteCacheParams {
}
}
// Do executes CacheStorage.deleteCache.
func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes CacheStorage.deleteCache against the provided context and
// target handler.
func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -201,7 +204,7 @@ func (p *DeleteCacheParams) Do(ctxt context.Context, h cdp.FrameHandler) (err er
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -225,8 +228,9 @@ func DeleteEntry(cacheID CacheID, request string) *DeleteEntryParams {
}
}
// Do executes CacheStorage.deleteEntry.
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes CacheStorage.deleteEntry against the provided context and
// target handler.
func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -256,7 +260,7 @@ func (p *DeleteEntryParams) Do(ctxt context.Context, h cdp.FrameHandler) (err er
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1296,7 +1296,6 @@ func (t ErrorType) String() string {
// ErrorType values.
const (
ErrContextDone ErrorType = "context done"
ErrChannelClosed ErrorType = "channel closed"
ErrInvalidResult ErrorType = "invalid result"
ErrUnknownResult ErrorType = "unknown result"
@ -1315,8 +1314,6 @@ func (t ErrorType) MarshalJSON() ([]byte, error) {
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *ErrorType) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch ErrorType(in.String()) {
case ErrContextDone:
*t = ErrContextDone
case ErrChannelClosed:
*t = ErrChannelClosed
case ErrInvalidResult:
@ -1339,17 +1336,30 @@ func (t ErrorType) Error() string {
return string(t)
}
// FrameHandler is the common interface for a frame handler.
type FrameHandler interface {
// Handler is the common interface for a Chrome Debugging Protocol target.
type Handler interface {
// SetActive changes the top level frame id.
SetActive(context.Context, FrameID) error
// GetRoot returns the root document node for the top level frame.
GetRoot(context.Context) (*Node, error)
// WaitFrame waits for a frame to be available.
WaitFrame(context.Context, FrameID) (*Frame, error)
// WaitNode waits for a node to be available.
WaitNode(context.Context, *Frame, NodeID) (*Node, error)
Listen(...MethodType) <-chan interface{}
// Execute executes the specified command using the supplied context and
// parameters.
Execute(context.Context, MethodType, easyjson.RawMessage) <-chan interface{}
// Listen creates a channel that will receive an event for the types
// specified.
Listen(...MethodType) <-chan interface{}
// Release releases a channel returned from Listen.
Release(<-chan interface{})
}
// Empty is an empty JSON object message.

View File

@ -1,5 +1,5 @@
// Package css provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome CSS domain.
// commands, types, and events for the CSS domain.
//
// This domain exposes CSS read/write operations. All CSS objects
// (stylesheets, rules, and styles) have an associated id used in subsequent
@ -35,8 +35,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes CSS.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes CSS.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -60,7 +61,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -74,8 +75,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes CSS.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes CSS.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -99,7 +101,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -132,7 +134,8 @@ type GetMatchedStylesForNodeReturns struct {
CSSKeyframesRules []*KeyframesRule `json:"cssKeyframesRules,omitempty"` // A list of CSS keyframed animations matching this node.
}
// Do executes CSS.getMatchedStylesForNode.
// Do executes CSS.getMatchedStylesForNode against the provided context and
// target handler.
//
// returns:
// inlineStyle - Inline style for the specified DOM node.
@ -141,7 +144,7 @@ type GetMatchedStylesForNodeReturns struct {
// pseudoElements - Pseudo style matches for this node.
// inherited - A chain of inherited styles (from the immediate node parent up to the DOM tree root).
// cssKeyframesRules - A list of CSS keyframed animations matching this node.
func (p *GetMatchedStylesForNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (inlineStyle *Style, attributesStyle *Style, matchedCSSRules []*RuleMatch, pseudoElements []*PseudoElementMatches, inherited []*InheritedStyleEntry, cssKeyframesRules []*KeyframesRule, err error) {
func (p *GetMatchedStylesForNodeParams) Do(ctxt context.Context, h cdp.Handler) (inlineStyle *Style, attributesStyle *Style, matchedCSSRules []*RuleMatch, pseudoElements []*PseudoElementMatches, inherited []*InheritedStyleEntry, cssKeyframesRules []*KeyframesRule, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -178,7 +181,7 @@ func (p *GetMatchedStylesForNodeParams) Do(ctxt context.Context, h cdp.FrameHand
}
case <-ctxt.Done():
return nil, nil, nil, nil, nil, nil, cdp.ErrContextDone
return nil, nil, nil, nil, nil, nil, ctxt.Err()
}
return nil, nil, nil, nil, nil, nil, cdp.ErrUnknownResult
@ -209,12 +212,13 @@ type GetInlineStylesForNodeReturns struct {
AttributesStyle *Style `json:"attributesStyle,omitempty"` // Attribute-defined element style (e.g. resulting from "width=20 height=100%").
}
// Do executes CSS.getInlineStylesForNode.
// 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.FrameHandler) (inlineStyle *Style, attributesStyle *Style, err error) {
func (p *GetInlineStylesForNodeParams) Do(ctxt context.Context, h cdp.Handler) (inlineStyle *Style, attributesStyle *Style, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -251,7 +255,7 @@ func (p *GetInlineStylesForNodeParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return nil, nil, cdp.ErrContextDone
return nil, nil, ctxt.Err()
}
return nil, nil, cdp.ErrUnknownResult
@ -279,11 +283,12 @@ type GetComputedStyleForNodeReturns struct {
ComputedStyle []*ComputedProperty `json:"computedStyle,omitempty"` // Computed style for the specified DOM node.
}
// Do executes CSS.getComputedStyleForNode.
// 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.FrameHandler) (computedStyle []*ComputedProperty, err error) {
func (p *GetComputedStyleForNodeParams) Do(ctxt context.Context, h cdp.Handler) (computedStyle []*ComputedProperty, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -320,7 +325,7 @@ func (p *GetComputedStyleForNodeParams) Do(ctxt context.Context, h cdp.FrameHand
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -348,11 +353,12 @@ type GetPlatformFontsForNodeReturns struct {
Fonts []*PlatformFontUsage `json:"fonts,omitempty"` // Usage statistics for every employed platform font.
}
// Do executes CSS.getPlatformFontsForNode.
// Do executes CSS.getPlatformFontsForNode against the provided context and
// target handler.
//
// returns:
// fonts - Usage statistics for every employed platform font.
func (p *GetPlatformFontsForNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (fonts []*PlatformFontUsage, err error) {
func (p *GetPlatformFontsForNodeParams) Do(ctxt context.Context, h cdp.Handler) (fonts []*PlatformFontUsage, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -389,7 +395,7 @@ func (p *GetPlatformFontsForNodeParams) Do(ctxt context.Context, h cdp.FrameHand
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -417,11 +423,12 @@ type GetStyleSheetTextReturns struct {
Text string `json:"text,omitempty"` // The stylesheet text.
}
// Do executes CSS.getStyleSheetText.
// Do executes CSS.getStyleSheetText against the provided context and
// target handler.
//
// returns:
// text - The stylesheet text.
func (p *GetStyleSheetTextParams) Do(ctxt context.Context, h cdp.FrameHandler) (text string, err error) {
func (p *GetStyleSheetTextParams) Do(ctxt context.Context, h cdp.Handler) (text string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -458,7 +465,7 @@ func (p *GetStyleSheetTextParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -484,11 +491,12 @@ type CollectClassNamesReturns struct {
ClassNames []string `json:"classNames,omitempty"` // Class name list.
}
// Do executes CSS.collectClassNames.
// 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.FrameHandler) (classNames []string, err error) {
func (p *CollectClassNamesParams) Do(ctxt context.Context, h cdp.Handler) (classNames []string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -525,7 +533,7 @@ func (p *CollectClassNamesParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -554,11 +562,12 @@ type SetStyleSheetTextReturns struct {
SourceMapURL string `json:"sourceMapURL,omitempty"` // URL of source map associated with script (if any).
}
// Do executes CSS.setStyleSheetText.
// 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.FrameHandler) (sourceMapURL string, err error) {
func (p *SetStyleSheetTextParams) Do(ctxt context.Context, h cdp.Handler) (sourceMapURL string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -595,7 +604,7 @@ func (p *SetStyleSheetTextParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -627,11 +636,12 @@ type SetRuleSelectorReturns struct {
SelectorList *SelectorList `json:"selectorList,omitempty"` // The resulting selector list after modification.
}
// Do executes CSS.setRuleSelector.
// 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.FrameHandler) (selectorList *SelectorList, err error) {
func (p *SetRuleSelectorParams) Do(ctxt context.Context, h cdp.Handler) (selectorList *SelectorList, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -668,7 +678,7 @@ func (p *SetRuleSelectorParams) Do(ctxt context.Context, h cdp.FrameHandler) (se
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -700,11 +710,12 @@ type SetKeyframeKeyReturns struct {
KeyText *Value `json:"keyText,omitempty"` // The resulting key text after modification.
}
// Do executes CSS.setKeyframeKey.
// Do executes CSS.setKeyframeKey against the provided context and
// target handler.
//
// returns:
// keyText - The resulting key text after modification.
func (p *SetKeyframeKeyParams) Do(ctxt context.Context, h cdp.FrameHandler) (keyText *Value, err error) {
func (p *SetKeyframeKeyParams) Do(ctxt context.Context, h cdp.Handler) (keyText *Value, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -741,7 +752,7 @@ func (p *SetKeyframeKeyParams) Do(ctxt context.Context, h cdp.FrameHandler) (key
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -769,11 +780,12 @@ type SetStyleTextsReturns struct {
Styles []*Style `json:"styles,omitempty"` // The resulting styles after modification.
}
// Do executes CSS.setStyleTexts.
// 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.FrameHandler) (styles []*Style, err error) {
func (p *SetStyleTextsParams) Do(ctxt context.Context, h cdp.Handler) (styles []*Style, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -810,7 +822,7 @@ func (p *SetStyleTextsParams) Do(ctxt context.Context, h cdp.FrameHandler) (styl
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -842,11 +854,12 @@ type SetMediaTextReturns struct {
Media *Media `json:"media,omitempty"` // The resulting CSS media rule after modification.
}
// Do executes CSS.setMediaText.
// Do executes CSS.setMediaText against the provided context and
// target handler.
//
// returns:
// media - The resulting CSS media rule after modification.
func (p *SetMediaTextParams) Do(ctxt context.Context, h cdp.FrameHandler) (media *Media, err error) {
func (p *SetMediaTextParams) Do(ctxt context.Context, h cdp.Handler) (media *Media, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -883,7 +896,7 @@ func (p *SetMediaTextParams) Do(ctxt context.Context, h cdp.FrameHandler) (media
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -911,11 +924,12 @@ type CreateStyleSheetReturns struct {
StyleSheetID StyleSheetID `json:"styleSheetId,omitempty"` // Identifier of the created "via-inspector" stylesheet.
}
// Do executes CSS.createStyleSheet.
// 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.FrameHandler) (styleSheetID StyleSheetID, err error) {
func (p *CreateStyleSheetParams) Do(ctxt context.Context, h cdp.Handler) (styleSheetID StyleSheetID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -952,7 +966,7 @@ func (p *CreateStyleSheetParams) Do(ctxt context.Context, h cdp.FrameHandler) (s
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -986,11 +1000,12 @@ type AddRuleReturns struct {
Rule *Rule `json:"rule,omitempty"` // The newly created rule.
}
// Do executes CSS.addRule.
// 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.FrameHandler) (rule *Rule, err error) {
func (p *AddRuleParams) Do(ctxt context.Context, h cdp.Handler) (rule *Rule, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1027,7 +1042,7 @@ func (p *AddRuleParams) Do(ctxt context.Context, h cdp.FrameHandler) (rule *Rule
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -1053,8 +1068,9 @@ func ForcePseudoState(nodeID cdp.NodeID, forcedPseudoClasses []PseudoClass) *For
}
}
// Do executes CSS.forcePseudoState.
func (p *ForcePseudoStateParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes CSS.forcePseudoState against the provided context and
// target handler.
func (p *ForcePseudoStateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1084,7 +1100,7 @@ func (p *ForcePseudoStateParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1104,11 +1120,12 @@ type GetMediaQueriesReturns struct {
Medias []*Media `json:"medias,omitempty"`
}
// Do executes CSS.getMediaQueries.
// Do executes CSS.getMediaQueries against the provided context and
// target handler.
//
// returns:
// medias
func (p *GetMediaQueriesParams) Do(ctxt context.Context, h cdp.FrameHandler) (medias []*Media, err error) {
func (p *GetMediaQueriesParams) Do(ctxt context.Context, h cdp.Handler) (medias []*Media, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1139,7 +1156,7 @@ func (p *GetMediaQueriesParams) Do(ctxt context.Context, h cdp.FrameHandler) (me
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -1168,8 +1185,9 @@ func SetEffectivePropertyValueForNode(nodeID cdp.NodeID, propertyName string, va
}
}
// Do executes CSS.setEffectivePropertyValueForNode.
func (p *SetEffectivePropertyValueForNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes CSS.setEffectivePropertyValueForNode against the provided context and
// target handler.
func (p *SetEffectivePropertyValueForNodeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1199,7 +1217,7 @@ func (p *SetEffectivePropertyValueForNodeParams) Do(ctxt context.Context, h cdp.
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1225,11 +1243,12 @@ 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).
}
// Do executes CSS.getBackgroundColors.
// 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).
func (p *GetBackgroundColorsParams) Do(ctxt context.Context, h cdp.FrameHandler) (backgroundColors []string, err error) {
func (p *GetBackgroundColorsParams) Do(ctxt context.Context, h cdp.Handler) (backgroundColors []string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1266,7 +1285,7 @@ func (p *GetBackgroundColorsParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -1299,12 +1318,13 @@ type GetLayoutTreeAndStylesReturns struct {
ComputedStyles []*ComputedStyle `json:"computedStyles,omitempty"`
}
// Do executes CSS.getLayoutTreeAndStyles.
// Do executes CSS.getLayoutTreeAndStyles against the provided context and
// target handler.
//
// returns:
// layoutTreeNodes
// computedStyles
func (p *GetLayoutTreeAndStylesParams) Do(ctxt context.Context, h cdp.FrameHandler) (layoutTreeNodes []*LayoutTreeNode, computedStyles []*ComputedStyle, err error) {
func (p *GetLayoutTreeAndStylesParams) Do(ctxt context.Context, h cdp.Handler) (layoutTreeNodes []*LayoutTreeNode, computedStyles []*ComputedStyle, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1341,7 +1361,7 @@ func (p *GetLayoutTreeAndStylesParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return nil, nil, cdp.ErrContextDone
return nil, nil, ctxt.Err()
}
return nil, nil, cdp.ErrUnknownResult
@ -1355,8 +1375,9 @@ func StartRuleUsageTracking() *StartRuleUsageTrackingParams {
return &StartRuleUsageTrackingParams{}
}
// Do executes CSS.startRuleUsageTracking.
func (p *StartRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes CSS.startRuleUsageTracking against the provided context and
// target handler.
func (p *StartRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1380,7 +1401,7 @@ func (p *StartRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1401,11 +1422,12 @@ type StopRuleUsageTrackingReturns struct {
RuleUsage []*RuleUsage `json:"ruleUsage,omitempty"`
}
// Do executes CSS.stopRuleUsageTracking.
// Do executes CSS.stopRuleUsageTracking against the provided context and
// target handler.
//
// returns:
// ruleUsage
func (p *StopRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.FrameHandler) (ruleUsage []*RuleUsage, err error) {
func (p *StopRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.Handler) (ruleUsage []*RuleUsage, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1436,7 +1458,7 @@ func (p *StopRuleUsageTrackingParams) Do(ctxt context.Context, h cdp.FrameHandle
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package database provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Database domain.
// commands, types, and events for the Database domain.
//
// Generated by the chromedp-gen command.
package database
@ -23,8 +23,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Database.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Database.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -48,7 +49,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -64,8 +65,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Database.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Database.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -89,7 +91,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -115,11 +117,12 @@ type GetDatabaseTableNamesReturns struct {
TableNames []string `json:"tableNames,omitempty"`
}
// Do executes Database.getDatabaseTableNames.
// Do executes Database.getDatabaseTableNames against the provided context and
// target handler.
//
// returns:
// tableNames
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.FrameHandler) (tableNames []string, err error) {
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -156,7 +159,7 @@ func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.FrameHandle
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -187,13 +190,14 @@ type ExecuteSQLReturns struct {
SQLError *Error `json:"sqlError,omitempty"`
}
// Do executes Database.executeSQL.
// Do executes Database.executeSQL against the provided context and
// target handler.
//
// returns:
// columnNames
// values
// sqlError
func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.FrameHandler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.Handler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -230,7 +234,7 @@ func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.FrameHandler) (columnN
}
case <-ctxt.Done():
return nil, nil, nil, cdp.ErrContextDone
return nil, nil, nil, ctxt.Err()
}
return nil, nil, nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package debugger provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Debugger domain.
// commands, types, and events for the Debugger domain.
//
// Debugger domain exposes JavaScript debugging capabilities. It allows
// setting and removing breakpoints, stepping through execution, exploring stack
@ -29,8 +29,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Debugger.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -54,7 +55,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -68,8 +69,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Debugger.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -93,7 +95,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -115,8 +117,9 @@ func SetBreakpointsActive(active bool) *SetBreakpointsActiveParams {
}
}
// Do executes Debugger.setBreakpointsActive.
func (p *SetBreakpointsActiveParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.setBreakpointsActive against the provided context and
// target handler.
func (p *SetBreakpointsActiveParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -146,7 +149,7 @@ func (p *SetBreakpointsActiveParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -169,8 +172,9 @@ func SetSkipAllPauses(skip bool) *SetSkipAllPausesParams {
}
}
// Do executes Debugger.setSkipAllPauses.
func (p *SetSkipAllPausesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.setSkipAllPauses against the provided context and
// target handler.
func (p *SetSkipAllPausesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -200,7 +204,7 @@ func (p *SetSkipAllPausesParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -267,12 +271,13 @@ type SetBreakpointByURLReturns struct {
Locations []*Location `json:"locations,omitempty"` // List of the locations this breakpoint resolved into upon addition.
}
// Do executes Debugger.setBreakpointByUrl.
// Do executes Debugger.setBreakpointByUrl against the provided context and
// target handler.
//
// returns:
// breakpointID - Id of the created breakpoint for further reference.
// locations - List of the locations this breakpoint resolved into upon addition.
func (p *SetBreakpointByURLParams) Do(ctxt context.Context, h cdp.FrameHandler) (breakpointID BreakpointID, locations []*Location, err error) {
func (p *SetBreakpointByURLParams) Do(ctxt context.Context, h cdp.Handler) (breakpointID BreakpointID, locations []*Location, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -309,7 +314,7 @@ func (p *SetBreakpointByURLParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return "", nil, cdp.ErrContextDone
return "", nil, ctxt.Err()
}
return "", nil, cdp.ErrUnknownResult
@ -345,12 +350,13 @@ type SetBreakpointReturns struct {
ActualLocation *Location `json:"actualLocation,omitempty"` // Location this breakpoint resolved into.
}
// Do executes Debugger.setBreakpoint.
// Do executes Debugger.setBreakpoint against the provided context and
// target handler.
//
// returns:
// breakpointID - Id of the created breakpoint for further reference.
// actualLocation - Location this breakpoint resolved into.
func (p *SetBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (breakpointID BreakpointID, actualLocation *Location, err error) {
func (p *SetBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (breakpointID BreakpointID, actualLocation *Location, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -387,7 +393,7 @@ func (p *SetBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (brea
}
case <-ctxt.Done():
return "", nil, cdp.ErrContextDone
return "", nil, ctxt.Err()
}
return "", nil, cdp.ErrUnknownResult
@ -408,8 +414,9 @@ func RemoveBreakpoint(breakpointID BreakpointID) *RemoveBreakpointParams {
}
}
// Do executes Debugger.removeBreakpoint.
func (p *RemoveBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.removeBreakpoint against the provided context and
// target handler.
func (p *RemoveBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -439,7 +446,7 @@ func (p *RemoveBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -475,11 +482,12 @@ type GetPossibleBreakpointsReturns struct {
Locations []*Location `json:"locations,omitempty"` // List of the possible breakpoint locations.
}
// Do executes Debugger.getPossibleBreakpoints.
// Do executes Debugger.getPossibleBreakpoints against the provided context and
// target handler.
//
// returns:
// locations - List of the possible breakpoint locations.
func (p *GetPossibleBreakpointsParams) Do(ctxt context.Context, h cdp.FrameHandler) (locations []*Location, err error) {
func (p *GetPossibleBreakpointsParams) Do(ctxt context.Context, h cdp.Handler) (locations []*Location, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -516,7 +524,7 @@ func (p *GetPossibleBreakpointsParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -538,8 +546,9 @@ func ContinueToLocation(location *Location) *ContinueToLocationParams {
}
}
// Do executes Debugger.continueToLocation.
func (p *ContinueToLocationParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.continueToLocation against the provided context and
// target handler.
func (p *ContinueToLocationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -569,7 +578,7 @@ func (p *ContinueToLocationParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -583,8 +592,9 @@ func StepOver() *StepOverParams {
return &StepOverParams{}
}
// Do executes Debugger.stepOver.
func (p *StepOverParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.stepOver against the provided context and
// target handler.
func (p *StepOverParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -608,7 +618,7 @@ func (p *StepOverParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -622,8 +632,9 @@ func StepInto() *StepIntoParams {
return &StepIntoParams{}
}
// Do executes Debugger.stepInto.
func (p *StepIntoParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.stepInto against the provided context and
// target handler.
func (p *StepIntoParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -647,7 +658,7 @@ func (p *StepIntoParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -661,8 +672,9 @@ func StepOut() *StepOutParams {
return &StepOutParams{}
}
// Do executes Debugger.stepOut.
func (p *StepOutParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.stepOut against the provided context and
// target handler.
func (p *StepOutParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -686,7 +698,7 @@ func (p *StepOutParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -700,8 +712,9 @@ func Pause() *PauseParams {
return &PauseParams{}
}
// Do executes Debugger.pause.
func (p *PauseParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.pause against the provided context and
// target handler.
func (p *PauseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -725,7 +738,7 @@ func (p *PauseParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -739,8 +752,9 @@ func Resume() *ResumeParams {
return &ResumeParams{}
}
// Do executes Debugger.resume.
func (p *ResumeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.resume against the provided context and
// target handler.
func (p *ResumeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -764,7 +778,7 @@ func (p *ResumeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -807,11 +821,12 @@ type SearchInContentReturns struct {
Result []*SearchMatch `json:"result,omitempty"` // List of search matches.
}
// Do executes Debugger.searchInContent.
// Do executes Debugger.searchInContent against the provided context and
// target handler.
//
// returns:
// result - List of search matches.
func (p *SearchInContentParams) Do(ctxt context.Context, h cdp.FrameHandler) (result []*SearchMatch, err error) {
func (p *SearchInContentParams) Do(ctxt context.Context, h cdp.Handler) (result []*SearchMatch, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -848,7 +863,7 @@ func (p *SearchInContentParams) Do(ctxt context.Context, h cdp.FrameHandler) (re
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -888,14 +903,15 @@ type SetScriptSourceReturns struct {
ExceptionDetails *runtime.ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details if any.
}
// Do executes Debugger.setScriptSource.
// Do executes Debugger.setScriptSource against the provided context and
// target handler.
//
// returns:
// callFrames - New stack trace in case editing has happened while VM was stopped.
// stackChanged - Whether current call stack was modified after applying the changes.
// asyncStackTrace - Async stack trace, if any.
// exceptionDetails - Exception details if any.
func (p *SetScriptSourceParams) Do(ctxt context.Context, h cdp.FrameHandler) (callFrames []*CallFrame, stackChanged bool, asyncStackTrace *runtime.StackTrace, exceptionDetails *runtime.ExceptionDetails, err error) {
func (p *SetScriptSourceParams) Do(ctxt context.Context, h cdp.Handler) (callFrames []*CallFrame, stackChanged bool, asyncStackTrace *runtime.StackTrace, exceptionDetails *runtime.ExceptionDetails, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -932,7 +948,7 @@ func (p *SetScriptSourceParams) Do(ctxt context.Context, h cdp.FrameHandler) (ca
}
case <-ctxt.Done():
return nil, false, nil, nil, cdp.ErrContextDone
return nil, false, nil, nil, ctxt.Err()
}
return nil, false, nil, nil, cdp.ErrUnknownResult
@ -959,12 +975,13 @@ type RestartFrameReturns struct {
AsyncStackTrace *runtime.StackTrace `json:"asyncStackTrace,omitempty"` // Async stack trace, if any.
}
// Do executes Debugger.restartFrame.
// Do executes Debugger.restartFrame against the provided context and
// target handler.
//
// returns:
// callFrames - New stack trace.
// asyncStackTrace - Async stack trace, if any.
func (p *RestartFrameParams) Do(ctxt context.Context, h cdp.FrameHandler) (callFrames []*CallFrame, asyncStackTrace *runtime.StackTrace, err error) {
func (p *RestartFrameParams) Do(ctxt context.Context, h cdp.Handler) (callFrames []*CallFrame, asyncStackTrace *runtime.StackTrace, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1001,7 +1018,7 @@ func (p *RestartFrameParams) Do(ctxt context.Context, h cdp.FrameHandler) (callF
}
case <-ctxt.Done():
return nil, nil, cdp.ErrContextDone
return nil, nil, ctxt.Err()
}
return nil, nil, cdp.ErrUnknownResult
@ -1027,11 +1044,12 @@ type GetScriptSourceReturns struct {
ScriptSource string `json:"scriptSource,omitempty"` // Script source.
}
// Do executes Debugger.getScriptSource.
// Do executes Debugger.getScriptSource against the provided context and
// target handler.
//
// returns:
// scriptSource - Script source.
func (p *GetScriptSourceParams) Do(ctxt context.Context, h cdp.FrameHandler) (scriptSource string, err error) {
func (p *GetScriptSourceParams) Do(ctxt context.Context, h cdp.Handler) (scriptSource string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1068,7 +1086,7 @@ func (p *GetScriptSourceParams) Do(ctxt context.Context, h cdp.FrameHandler) (sc
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -1093,8 +1111,9 @@ func SetPauseOnExceptions(state ExceptionsState) *SetPauseOnExceptionsParams {
}
}
// Do executes Debugger.setPauseOnExceptions.
func (p *SetPauseOnExceptionsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.setPauseOnExceptions against the provided context and
// target handler.
func (p *SetPauseOnExceptionsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1124,7 +1143,7 @@ func (p *SetPauseOnExceptionsParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1201,12 +1220,13 @@ type EvaluateOnCallFrameReturns struct {
ExceptionDetails *runtime.ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}
// Do executes Debugger.evaluateOnCallFrame.
// Do executes Debugger.evaluateOnCallFrame against the provided context and
// target handler.
//
// returns:
// result - Object wrapper for the evaluation result.
// exceptionDetails - Exception details.
func (p *EvaluateOnCallFrameParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *runtime.RemoteObject, exceptionDetails *runtime.ExceptionDetails, err error) {
func (p *EvaluateOnCallFrameParams) Do(ctxt context.Context, h cdp.Handler) (result *runtime.RemoteObject, exceptionDetails *runtime.ExceptionDetails, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1243,7 +1263,7 @@ func (p *EvaluateOnCallFrameParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return nil, nil, cdp.ErrContextDone
return nil, nil, ctxt.Err()
}
return nil, nil, cdp.ErrUnknownResult
@ -1275,8 +1295,9 @@ func SetVariableValue(scopeNumber int64, variableName string, newValue *runtime.
}
}
// Do executes Debugger.setVariableValue.
func (p *SetVariableValueParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.setVariableValue against the provided context and
// target handler.
func (p *SetVariableValueParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1306,7 +1327,7 @@ func (p *SetVariableValueParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1328,8 +1349,9 @@ func SetAsyncCallStackDepth(maxDepth int64) *SetAsyncCallStackDepthParams {
}
}
// Do executes Debugger.setAsyncCallStackDepth.
func (p *SetAsyncCallStackDepthParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.setAsyncCallStackDepth against the provided context and
// target handler.
func (p *SetAsyncCallStackDepthParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1359,7 +1381,7 @@ func (p *SetAsyncCallStackDepthParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1386,8 +1408,9 @@ func SetBlackboxPatterns(patterns []string) *SetBlackboxPatternsParams {
}
}
// Do executes Debugger.setBlackboxPatterns.
func (p *SetBlackboxPatternsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.setBlackboxPatterns against the provided context and
// target handler.
func (p *SetBlackboxPatternsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1417,7 +1440,7 @@ func (p *SetBlackboxPatternsParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1449,8 +1472,9 @@ func SetBlackboxedRanges(scriptID runtime.ScriptID, positions []*ScriptPosition)
}
}
// Do executes Debugger.setBlackboxedRanges.
func (p *SetBlackboxedRangesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Debugger.setBlackboxedRanges against the provided context and
// target handler.
func (p *SetBlackboxedRangesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1480,7 +1504,7 @@ func (p *SetBlackboxedRangesParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package deviceorientation provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome DeviceOrientation domain.
// commands, types, and events for the DeviceOrientation domain.
//
// Generated by the chromedp-gen command.
package deviceorientation
@ -34,8 +34,9 @@ func SetDeviceOrientationOverride(alpha float64, beta float64, gamma float64) *S
}
}
// Do executes DeviceOrientation.setDeviceOrientationOverride.
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DeviceOrientation.setDeviceOrientationOverride against the provided context and
// target handler.
func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -65,7 +66,7 @@ func (p *SetDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Fram
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -80,8 +81,9 @@ func ClearDeviceOrientationOverride() *ClearDeviceOrientationOverrideParams {
return &ClearDeviceOrientationOverrideParams{}
}
// Do executes DeviceOrientation.clearDeviceOrientationOverride.
func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DeviceOrientation.clearDeviceOrientationOverride against the provided context and
// target handler.
func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -105,7 +107,7 @@ func (p *ClearDeviceOrientationOverrideParams) Do(ctxt context.Context, h cdp.Fr
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package dom provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome DOM domain.
// commands, types, and events for the DOM domain.
//
// This domain exposes DOM read/write operations. Each DOM Node is
// represented with its mirror object that has an id. This id can be used to get
@ -32,8 +32,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes DOM.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -57,7 +58,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -71,8 +72,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes DOM.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -96,7 +98,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -137,11 +139,12 @@ type GetDocumentReturns struct {
Root *cdp.Node `json:"root,omitempty"` // Resulting node.
}
// Do executes DOM.getDocument.
// Do executes DOM.getDocument against the provided context and
// target handler.
//
// returns:
// root - Resulting node.
func (p *GetDocumentParams) Do(ctxt context.Context, h cdp.FrameHandler) (root *cdp.Node, err error) {
func (p *GetDocumentParams) Do(ctxt context.Context, h cdp.Handler) (root *cdp.Node, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -178,7 +181,7 @@ func (p *GetDocumentParams) Do(ctxt context.Context, h cdp.FrameHandler) (root *
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -219,11 +222,12 @@ type GetFlattenedDocumentReturns struct {
Nodes []*cdp.Node `json:"nodes,omitempty"` // Resulting node.
}
// Do executes DOM.getFlattenedDocument.
// Do executes DOM.getFlattenedDocument against the provided context and
// target handler.
//
// returns:
// nodes - Resulting node.
func (p *GetFlattenedDocumentParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodes []*cdp.Node, err error) {
func (p *GetFlattenedDocumentParams) Do(ctxt context.Context, h cdp.Handler) (nodes []*cdp.Node, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -260,7 +264,7 @@ func (p *GetFlattenedDocumentParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -288,11 +292,12 @@ type CollectClassNamesFromSubtreeReturns struct {
ClassNames []string `json:"classNames,omitempty"` // Class name list.
}
// Do executes DOM.collectClassNamesFromSubtree.
// Do executes DOM.collectClassNamesFromSubtree against the provided context and
// target handler.
//
// returns:
// classNames - Class name list.
func (p *CollectClassNamesFromSubtreeParams) Do(ctxt context.Context, h cdp.FrameHandler) (classNames []string, err error) {
func (p *CollectClassNamesFromSubtreeParams) Do(ctxt context.Context, h cdp.Handler) (classNames []string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -329,7 +334,7 @@ func (p *CollectClassNamesFromSubtreeParams) Do(ctxt context.Context, h cdp.Fram
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -373,8 +378,9 @@ func (p RequestChildNodesParams) WithPierce(pierce bool) *RequestChildNodesParam
return &p
}
// Do executes DOM.requestChildNodes.
func (p *RequestChildNodesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.requestChildNodes against the provided context and
// target handler.
func (p *RequestChildNodesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -404,7 +410,7 @@ func (p *RequestChildNodesParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -433,11 +439,12 @@ type QuerySelectorReturns struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Query selector result.
}
// Do executes DOM.querySelector.
// Do executes DOM.querySelector against the provided context and
// target handler.
//
// returns:
// nodeID - Query selector result.
func (p *QuerySelectorParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.NodeID, err error) {
func (p *QuerySelectorParams) Do(ctxt context.Context, h cdp.Handler) (nodeID cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -474,7 +481,7 @@ func (p *QuerySelectorParams) Do(ctxt context.Context, h cdp.FrameHandler) (node
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -503,11 +510,12 @@ type QuerySelectorAllReturns struct {
NodeIds []cdp.NodeID `json:"nodeIds,omitempty"` // Query selector result.
}
// Do executes DOM.querySelectorAll.
// Do executes DOM.querySelectorAll against the provided context and
// target handler.
//
// returns:
// nodeIds - Query selector result.
func (p *QuerySelectorAllParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeIds []cdp.NodeID, err error) {
func (p *QuerySelectorAllParams) Do(ctxt context.Context, h cdp.Handler) (nodeIds []cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -544,7 +552,7 @@ func (p *QuerySelectorAllParams) Do(ctxt context.Context, h cdp.FrameHandler) (n
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -573,11 +581,12 @@ type SetNodeNameReturns struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // New node's id.
}
// Do executes DOM.setNodeName.
// Do executes DOM.setNodeName against the provided context and
// target handler.
//
// returns:
// nodeID - New node's id.
func (p *SetNodeNameParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.NodeID, err error) {
func (p *SetNodeNameParams) Do(ctxt context.Context, h cdp.Handler) (nodeID cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -614,7 +623,7 @@ func (p *SetNodeNameParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -638,8 +647,9 @@ func SetNodeValue(nodeID cdp.NodeID, value string) *SetNodeValueParams {
}
}
// Do executes DOM.setNodeValue.
func (p *SetNodeValueParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.setNodeValue against the provided context and
// target handler.
func (p *SetNodeValueParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -669,7 +679,7 @@ func (p *SetNodeValueParams) Do(ctxt context.Context, h cdp.FrameHandler) (err e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -690,8 +700,9 @@ func RemoveNode(nodeID cdp.NodeID) *RemoveNodeParams {
}
}
// Do executes DOM.removeNode.
func (p *RemoveNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.removeNode against the provided context and
// target handler.
func (p *RemoveNodeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -721,7 +732,7 @@ func (p *RemoveNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -748,8 +759,9 @@ func SetAttributeValue(nodeID cdp.NodeID, name string, value string) *SetAttribu
}
}
// Do executes DOM.setAttributeValue.
func (p *SetAttributeValueParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.setAttributeValue against the provided context and
// target handler.
func (p *SetAttributeValueParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -779,7 +791,7 @@ func (p *SetAttributeValueParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -815,8 +827,9 @@ func (p SetAttributesAsTextParams) WithName(name string) *SetAttributesAsTextPar
return &p
}
// Do executes DOM.setAttributesAsText.
func (p *SetAttributesAsTextParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.setAttributesAsText against the provided context and
// target handler.
func (p *SetAttributesAsTextParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -846,7 +859,7 @@ func (p *SetAttributesAsTextParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -872,8 +885,9 @@ func RemoveAttribute(nodeID cdp.NodeID, name string) *RemoveAttributeParams {
}
}
// Do executes DOM.removeAttribute.
func (p *RemoveAttributeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.removeAttribute against the provided context and
// target handler.
func (p *RemoveAttributeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -903,7 +917,7 @@ func (p *RemoveAttributeParams) Do(ctxt context.Context, h cdp.FrameHandler) (er
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -929,11 +943,12 @@ type GetOuterHTMLReturns struct {
OuterHTML string `json:"outerHTML,omitempty"` // Outer HTML markup.
}
// Do executes DOM.getOuterHTML.
// Do executes DOM.getOuterHTML against the provided context and
// target handler.
//
// returns:
// outerHTML - Outer HTML markup.
func (p *GetOuterHTMLParams) Do(ctxt context.Context, h cdp.FrameHandler) (outerHTML string, err error) {
func (p *GetOuterHTMLParams) Do(ctxt context.Context, h cdp.Handler) (outerHTML string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -970,7 +985,7 @@ func (p *GetOuterHTMLParams) Do(ctxt context.Context, h cdp.FrameHandler) (outer
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -994,8 +1009,9 @@ func SetOuterHTML(nodeID cdp.NodeID, outerHTML string) *SetOuterHTMLParams {
}
}
// Do executes DOM.setOuterHTML.
func (p *SetOuterHTMLParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.setOuterHTML against the provided context and
// target handler.
func (p *SetOuterHTMLParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1025,7 +1041,7 @@ func (p *SetOuterHTMLParams) Do(ctxt context.Context, h cdp.FrameHandler) (err e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1063,12 +1079,13 @@ type PerformSearchReturns struct {
ResultCount int64 `json:"resultCount,omitempty"` // Number of search results.
}
// Do executes DOM.performSearch.
// Do executes DOM.performSearch against the provided context and
// target handler.
//
// returns:
// searchID - Unique search session identifier.
// resultCount - Number of search results.
func (p *PerformSearchParams) Do(ctxt context.Context, h cdp.FrameHandler) (searchID string, resultCount int64, err error) {
func (p *PerformSearchParams) Do(ctxt context.Context, h cdp.Handler) (searchID string, resultCount int64, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1105,7 +1122,7 @@ func (p *PerformSearchParams) Do(ctxt context.Context, h cdp.FrameHandler) (sear
}
case <-ctxt.Done():
return "", 0, cdp.ErrContextDone
return "", 0, ctxt.Err()
}
return "", 0, cdp.ErrUnknownResult
@ -1139,11 +1156,12 @@ type GetSearchResultsReturns struct {
NodeIds []cdp.NodeID `json:"nodeIds,omitempty"` // Ids of the search result nodes.
}
// Do executes DOM.getSearchResults.
// Do executes DOM.getSearchResults against the provided context and
// target handler.
//
// returns:
// nodeIds - Ids of the search result nodes.
func (p *GetSearchResultsParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeIds []cdp.NodeID, err error) {
func (p *GetSearchResultsParams) Do(ctxt context.Context, h cdp.Handler) (nodeIds []cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1180,7 +1198,7 @@ func (p *GetSearchResultsParams) Do(ctxt context.Context, h cdp.FrameHandler) (n
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -1203,8 +1221,9 @@ func DiscardSearchResults(searchID string) *DiscardSearchResultsParams {
}
}
// Do executes DOM.discardSearchResults.
func (p *DiscardSearchResultsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.discardSearchResults against the provided context and
// target handler.
func (p *DiscardSearchResultsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1234,7 +1253,7 @@ func (p *DiscardSearchResultsParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1266,11 +1285,12 @@ type RequestNodeReturns struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Node id for given object.
}
// Do executes DOM.requestNode.
// Do executes DOM.requestNode against the provided context and
// target handler.
//
// returns:
// nodeID - Node id for given object.
func (p *RequestNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.NodeID, err error) {
func (p *RequestNodeParams) Do(ctxt context.Context, h cdp.Handler) (nodeID cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1307,7 +1327,7 @@ func (p *RequestNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -1340,8 +1360,9 @@ func (p SetInspectModeParams) WithHighlightConfig(highlightConfig *HighlightConf
return &p
}
// Do executes DOM.setInspectMode.
func (p *SetInspectModeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.setInspectMode against the provided context and
// target handler.
func (p *SetInspectModeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1371,7 +1392,7 @@ func (p *SetInspectModeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1417,8 +1438,9 @@ func (p HighlightRectParams) WithOutlineColor(outlineColor *cdp.RGBA) *Highlight
return &p
}
// Do executes DOM.highlightRect.
func (p *HighlightRectParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.highlightRect against the provided context and
// target handler.
func (p *HighlightRectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1448,7 +1470,7 @@ func (p *HighlightRectParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1485,8 +1507,9 @@ func (p HighlightQuadParams) WithOutlineColor(outlineColor *cdp.RGBA) *Highlight
return &p
}
// Do executes DOM.highlightQuad.
func (p *HighlightQuadParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.highlightQuad against the provided context and
// target handler.
func (p *HighlightQuadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1516,7 +1539,7 @@ func (p *HighlightQuadParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1560,8 +1583,9 @@ func (p HighlightNodeParams) WithObjectID(objectID runtime.RemoteObjectID) *High
return &p
}
// Do executes DOM.highlightNode.
func (p *HighlightNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.highlightNode against the provided context and
// target handler.
func (p *HighlightNodeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1591,7 +1615,7 @@ func (p *HighlightNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1605,8 +1629,9 @@ func HideHighlight() *HideHighlightParams {
return &HideHighlightParams{}
}
// Do executes DOM.hideHighlight.
func (p *HideHighlightParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.hideHighlight against the provided context and
// target handler.
func (p *HideHighlightParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1630,7 +1655,7 @@ func (p *HideHighlightParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1667,8 +1692,9 @@ func (p HighlightFrameParams) WithContentOutlineColor(contentOutlineColor *cdp.R
return &p
}
// Do executes DOM.highlightFrame.
func (p *HighlightFrameParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.highlightFrame against the provided context and
// target handler.
func (p *HighlightFrameParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1698,7 +1724,7 @@ func (p *HighlightFrameParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1726,11 +1752,12 @@ type PushNodeByPathToFrontendReturns struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node for given path.
}
// Do executes DOM.pushNodeByPathToFrontend.
// Do executes DOM.pushNodeByPathToFrontend against the provided context and
// target handler.
//
// returns:
// nodeID - Id of the node for given path.
func (p *PushNodeByPathToFrontendParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.NodeID, err error) {
func (p *PushNodeByPathToFrontendParams) Do(ctxt context.Context, h cdp.Handler) (nodeID cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1767,7 +1794,7 @@ func (p *PushNodeByPathToFrontendParams) Do(ctxt context.Context, h cdp.FrameHan
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -1795,11 +1822,12 @@ type PushNodesByBackendIdsToFrontendReturns struct {
NodeIds []cdp.NodeID `json:"nodeIds,omitempty"` // The array of ids of pushed nodes that correspond to the backend ids specified in backendNodeIds.
}
// Do executes DOM.pushNodesByBackendIdsToFrontend.
// Do executes DOM.pushNodesByBackendIdsToFrontend against the provided context and
// target handler.
//
// returns:
// nodeIds - The array of ids of pushed nodes that correspond to the backend ids specified in backendNodeIds.
func (p *PushNodesByBackendIdsToFrontendParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeIds []cdp.NodeID, err error) {
func (p *PushNodesByBackendIdsToFrontendParams) Do(ctxt context.Context, h cdp.Handler) (nodeIds []cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1836,7 +1864,7 @@ func (p *PushNodesByBackendIdsToFrontendParams) Do(ctxt context.Context, h cdp.F
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -1859,8 +1887,9 @@ func SetInspectedNode(nodeID cdp.NodeID) *SetInspectedNodeParams {
}
}
// Do executes DOM.setInspectedNode.
func (p *SetInspectedNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.setInspectedNode against the provided context and
// target handler.
func (p *SetInspectedNodeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1890,7 +1919,7 @@ func (p *SetInspectedNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1924,11 +1953,12 @@ type ResolveNodeReturns struct {
Object *runtime.RemoteObject `json:"object,omitempty"` // JavaScript object wrapper for given node.
}
// Do executes DOM.resolveNode.
// Do executes DOM.resolveNode against the provided context and
// target handler.
//
// returns:
// object - JavaScript object wrapper for given node.
func (p *ResolveNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (object *runtime.RemoteObject, err error) {
func (p *ResolveNodeParams) Do(ctxt context.Context, h cdp.Handler) (object *runtime.RemoteObject, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1965,7 +1995,7 @@ func (p *ResolveNodeParams) Do(ctxt context.Context, h cdp.FrameHandler) (object
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -1991,11 +2021,12 @@ type GetAttributesReturns struct {
Attributes []string `json:"attributes,omitempty"` // An interleaved array of node attribute names and values.
}
// Do executes DOM.getAttributes.
// Do executes DOM.getAttributes against the provided context and
// target handler.
//
// returns:
// attributes - An interleaved array of node attribute names and values.
func (p *GetAttributesParams) Do(ctxt context.Context, h cdp.FrameHandler) (attributes []string, err error) {
func (p *GetAttributesParams) Do(ctxt context.Context, h cdp.Handler) (attributes []string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2032,7 +2063,7 @@ func (p *GetAttributesParams) Do(ctxt context.Context, h cdp.FrameHandler) (attr
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -2071,11 +2102,12 @@ type CopyToReturns struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node clone.
}
// Do executes DOM.copyTo.
// Do executes DOM.copyTo against the provided context and
// target handler.
//
// returns:
// nodeID - Id of the node clone.
func (p *CopyToParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.NodeID, err error) {
func (p *CopyToParams) Do(ctxt context.Context, h cdp.Handler) (nodeID cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2112,7 +2144,7 @@ func (p *CopyToParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -2151,11 +2183,12 @@ type MoveToReturns struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // New id of the moved node.
}
// Do executes DOM.moveTo.
// Do executes DOM.moveTo against the provided context and
// target handler.
//
// returns:
// nodeID - New id of the moved node.
func (p *MoveToParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.NodeID, err error) {
func (p *MoveToParams) Do(ctxt context.Context, h cdp.Handler) (nodeID cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2192,7 +2225,7 @@ func (p *MoveToParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -2206,8 +2239,9 @@ func Undo() *UndoParams {
return &UndoParams{}
}
// Do executes DOM.undo.
func (p *UndoParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.undo against the provided context and
// target handler.
func (p *UndoParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2231,7 +2265,7 @@ func (p *UndoParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -2245,8 +2279,9 @@ func Redo() *RedoParams {
return &RedoParams{}
}
// Do executes DOM.redo.
func (p *RedoParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.redo against the provided context and
// target handler.
func (p *RedoParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2270,7 +2305,7 @@ func (p *RedoParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -2284,8 +2319,9 @@ func MarkUndoableState() *MarkUndoableStateParams {
return &MarkUndoableStateParams{}
}
// Do executes DOM.markUndoableState.
func (p *MarkUndoableStateParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.markUndoableState against the provided context and
// target handler.
func (p *MarkUndoableStateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2309,7 +2345,7 @@ func (p *MarkUndoableStateParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -2330,8 +2366,9 @@ func Focus(nodeID cdp.NodeID) *FocusParams {
}
}
// Do executes DOM.focus.
func (p *FocusParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.focus against the provided context and
// target handler.
func (p *FocusParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2361,7 +2398,7 @@ func (p *FocusParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -2385,8 +2422,9 @@ func SetFileInputFiles(nodeID cdp.NodeID, files []string) *SetFileInputFilesPara
}
}
// Do executes DOM.setFileInputFiles.
func (p *SetFileInputFilesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOM.setFileInputFiles against the provided context and
// target handler.
func (p *SetFileInputFilesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2416,7 +2454,7 @@ func (p *SetFileInputFilesParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -2442,11 +2480,12 @@ type GetBoxModelReturns struct {
Model *BoxModel `json:"model,omitempty"` // Box model for the node.
}
// Do executes DOM.getBoxModel.
// Do executes DOM.getBoxModel against the provided context and
// target handler.
//
// returns:
// model - Box model for the node.
func (p *GetBoxModelParams) Do(ctxt context.Context, h cdp.FrameHandler) (model *BoxModel, err error) {
func (p *GetBoxModelParams) Do(ctxt context.Context, h cdp.Handler) (model *BoxModel, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2483,7 +2522,7 @@ func (p *GetBoxModelParams) Do(ctxt context.Context, h cdp.FrameHandler) (model
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -2512,11 +2551,12 @@ type GetNodeForLocationReturns struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Id of the node at given coordinates.
}
// Do executes DOM.getNodeForLocation.
// Do executes DOM.getNodeForLocation against the provided context and
// target handler.
//
// returns:
// nodeID - Id of the node at given coordinates.
func (p *GetNodeForLocationParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.NodeID, err error) {
func (p *GetNodeForLocationParams) Do(ctxt context.Context, h cdp.Handler) (nodeID cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2553,7 +2593,7 @@ func (p *GetNodeForLocationParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -2581,11 +2621,12 @@ type GetRelayoutBoundaryReturns struct {
NodeID cdp.NodeID `json:"nodeId,omitempty"` // Relayout boundary node id for the given node.
}
// Do executes DOM.getRelayoutBoundary.
// Do executes DOM.getRelayoutBoundary against the provided context and
// target handler.
//
// returns:
// nodeID - Relayout boundary node id for the given node.
func (p *GetRelayoutBoundaryParams) Do(ctxt context.Context, h cdp.FrameHandler) (nodeID cdp.NodeID, err error) {
func (p *GetRelayoutBoundaryParams) Do(ctxt context.Context, h cdp.Handler) (nodeID cdp.NodeID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2622,7 +2663,7 @@ func (p *GetRelayoutBoundaryParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return 0, cdp.ErrContextDone
return 0, ctxt.Err()
}
return 0, cdp.ErrUnknownResult
@ -2648,11 +2689,12 @@ type GetHighlightObjectForTestReturns struct {
Highlight easyjson.RawMessage `json:"highlight,omitempty"`
}
// Do executes DOM.getHighlightObjectForTest.
// Do executes DOM.getHighlightObjectForTest against the provided context and
// target handler.
//
// returns:
// highlight - Highlight data for the node.
func (p *GetHighlightObjectForTestParams) Do(ctxt context.Context, h cdp.FrameHandler) (highlight easyjson.RawMessage, err error) {
func (p *GetHighlightObjectForTestParams) Do(ctxt context.Context, h cdp.Handler) (highlight easyjson.RawMessage, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -2689,7 +2731,7 @@ func (p *GetHighlightObjectForTestParams) Do(ctxt context.Context, h cdp.FrameHa
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package domdebugger provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome DOMDebugger domain.
// commands, types, and events for the DOMDebugger domain.
//
// DOM debugging allows setting breakpoints on particular DOM operations and
// events. JavaScript execution will stop on these operations as if there was a
@ -36,8 +36,9 @@ func SetDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *SetDOMBreak
}
}
// Do executes DOMDebugger.setDOMBreakpoint.
func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMDebugger.setDOMBreakpoint against the provided context and
// target handler.
func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -67,7 +68,7 @@ func (p *SetDOMBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -93,8 +94,9 @@ func RemoveDOMBreakpoint(nodeID cdp.NodeID, typeVal DOMBreakpointType) *RemoveDO
}
}
// Do executes DOMDebugger.removeDOMBreakpoint.
func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMDebugger.removeDOMBreakpoint against the provided context and
// target handler.
func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -124,7 +126,7 @@ func (p *RemoveDOMBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -153,8 +155,9 @@ func (p SetEventListenerBreakpointParams) WithTargetName(targetName string) *Set
return &p
}
// Do executes DOMDebugger.setEventListenerBreakpoint.
func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMDebugger.setEventListenerBreakpoint against the provided context and
// target handler.
func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -184,7 +187,7 @@ func (p *SetEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.FrameH
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -213,8 +216,9 @@ func (p RemoveEventListenerBreakpointParams) WithTargetName(targetName string) *
return &p
}
// Do executes DOMDebugger.removeEventListenerBreakpoint.
func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMDebugger.removeEventListenerBreakpoint against the provided context and
// target handler.
func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -244,7 +248,7 @@ func (p *RemoveEventListenerBreakpointParams) Do(ctxt context.Context, h cdp.Fra
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -266,8 +270,9 @@ func SetInstrumentationBreakpoint(eventName string) *SetInstrumentationBreakpoin
}
}
// Do executes DOMDebugger.setInstrumentationBreakpoint.
func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMDebugger.setInstrumentationBreakpoint against the provided context and
// target handler.
func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -297,7 +302,7 @@ func (p *SetInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Fram
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -320,8 +325,9 @@ func RemoveInstrumentationBreakpoint(eventName string) *RemoveInstrumentationBre
}
}
// Do executes DOMDebugger.removeInstrumentationBreakpoint.
func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMDebugger.removeInstrumentationBreakpoint against the provided context and
// target handler.
func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -351,7 +357,7 @@ func (p *RemoveInstrumentationBreakpointParams) Do(ctxt context.Context, h cdp.F
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -372,8 +378,9 @@ func SetXHRBreakpoint(url string) *SetXHRBreakpointParams {
}
}
// Do executes DOMDebugger.setXHRBreakpoint.
func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMDebugger.setXHRBreakpoint against the provided context and
// target handler.
func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -403,7 +410,7 @@ func (p *SetXHRBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -424,8 +431,9 @@ func RemoveXHRBreakpoint(url string) *RemoveXHRBreakpointParams {
}
}
// Do executes DOMDebugger.removeXHRBreakpoint.
func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMDebugger.removeXHRBreakpoint against the provided context and
// target handler.
func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -455,7 +463,7 @@ func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -463,7 +471,9 @@ func (p *RemoveXHRBreakpointParams) Do(ctxt context.Context, h cdp.FrameHandler)
// GetEventListenersParams returns event listeners of the given object.
type GetEventListenersParams struct {
ObjectID runtime.RemoteObjectID `json:"objectId"` // Identifier of the object to return listeners for.
ObjectID runtime.RemoteObjectID `json:"objectId"` // Identifier of the object to return listeners for.
Depth int64 `json:"depth,omitempty"` // The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
Pierce bool `json:"pierce,omitempty"` // Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). Reports listeners for all contexts if pierce is enabled.
}
// GetEventListeners returns event listeners of the given object.
@ -476,16 +486,33 @@ func GetEventListeners(objectID runtime.RemoteObjectID) *GetEventListenersParams
}
}
// WithDepth the maximum depth at which Node children should be retrieved,
// defaults to 1. Use -1 for the entire subtree or provide an integer larger
// than 0.
func (p GetEventListenersParams) WithDepth(depth int64) *GetEventListenersParams {
p.Depth = depth
return &p
}
// WithPierce whether or not iframes and shadow roots should be traversed
// when returning the subtree (default is false). Reports listeners for all
// contexts if pierce is enabled.
func (p GetEventListenersParams) WithPierce(pierce bool) *GetEventListenersParams {
p.Pierce = pierce
return &p
}
// GetEventListenersReturns return values.
type GetEventListenersReturns struct {
Listeners []*EventListener `json:"listeners,omitempty"` // Array of relevant listeners.
}
// Do executes DOMDebugger.getEventListeners.
// Do executes DOMDebugger.getEventListeners against the provided context and
// target handler.
//
// returns:
// listeners - Array of relevant listeners.
func (p *GetEventListenersParams) Do(ctxt context.Context, h cdp.FrameHandler) (listeners []*EventListener, err error) {
func (p *GetEventListenersParams) Do(ctxt context.Context, h cdp.Handler) (listeners []*EventListener, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -522,7 +549,7 @@ func (p *GetEventListenersParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -720,6 +720,10 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomdebugger9(in *jlexer.Lexer,
switch key {
case "objectId":
out.ObjectID = runtime.RemoteObjectID(in.String())
case "depth":
out.Depth = int64(in.Int64())
case "pierce":
out.Pierce = bool(in.Bool())
default:
in.SkipRecursive()
}
@ -740,6 +744,22 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomdebugger9(out *jwriter.Writ
first = false
out.RawString("\"objectId\":")
out.String(string(in.ObjectID))
if in.Depth != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"depth\":")
out.Int64(int64(in.Depth))
}
if in.Pierce {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"pierce\":")
out.Bool(bool(in.Pierce))
}
out.RawByte('}')
}
@ -829,6 +849,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpDomdebugger10(in *jlexer.Lexer
}
(*out.RemoveFunction).UnmarshalEasyJSON(in)
}
case "backendNodeId":
(out.BackendNodeID).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
@ -935,6 +957,14 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpDomdebugger10(out *jwriter.Wri
(*in.RemoveFunction).MarshalEasyJSON(out)
}
}
if in.BackendNodeID != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"backendNodeId\":")
out.Int64(int64(in.BackendNodeID))
}
out.RawByte('}')
}

View File

@ -1,16 +1,17 @@
package domdebugger
// AUTOGENERATED. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// AUTOGENERATED. DO NOT EDIT.
// DOMBreakpointType dOM breakpoint type.
type DOMBreakpointType string
@ -68,4 +69,5 @@ type EventListener struct {
Handler *runtime.RemoteObject `json:"handler,omitempty"` // Event handler function value.
OriginalHandler *runtime.RemoteObject `json:"originalHandler,omitempty"` // Event original handler function value.
RemoveFunction *runtime.RemoteObject `json:"removeFunction,omitempty"` // Event listener remove function.
BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // Node the listener is added to (if any).
}

View File

@ -1,5 +1,5 @@
// Package domstorage provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome DOMStorage domain.
// commands, types, and events for the DOMStorage domain.
//
// Query and modify DOM storage.
//
@ -25,8 +25,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes DOMStorage.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMStorage.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -50,7 +51,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -66,8 +67,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes DOMStorage.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMStorage.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -91,7 +93,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -112,8 +114,9 @@ func Clear(storageID *StorageID) *ClearParams {
}
}
// Do executes DOMStorage.clear.
func (p *ClearParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMStorage.clear against the provided context and
// target handler.
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -143,7 +146,7 @@ func (p *ClearParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -169,11 +172,12 @@ type GetDOMStorageItemsReturns struct {
Entries []Item `json:"entries,omitempty"`
}
// Do executes DOMStorage.getDOMStorageItems.
// Do executes DOMStorage.getDOMStorageItems against the provided context and
// target handler.
//
// returns:
// entries
func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h cdp.FrameHandler) (entries []Item, err error) {
func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h cdp.Handler) (entries []Item, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -210,7 +214,7 @@ func (p *GetDOMStorageItemsParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -237,8 +241,9 @@ func SetDOMStorageItem(storageID *StorageID, key string, value string) *SetDOMSt
}
}
// Do executes DOMStorage.setDOMStorageItem.
func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMStorage.setDOMStorageItem against the provided context and
// target handler.
func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -268,7 +273,7 @@ func (p *SetDOMStorageItemParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -292,8 +297,9 @@ func RemoveDOMStorageItem(storageID *StorageID, key string) *RemoveDOMStorageIte
}
}
// Do executes DOMStorage.removeDOMStorageItem.
func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes DOMStorage.removeDOMStorageItem against the provided context and
// target handler.
func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -323,7 +329,7 @@ func (p *RemoveDOMStorageItemParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package emulation provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Emulation domain.
// commands, types, and events for the Emulation domain.
//
// This domain emulates different environments for the page.
//
@ -95,8 +95,9 @@ func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation
return &p
}
// Do executes Emulation.setDeviceMetricsOverride.
func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setDeviceMetricsOverride against the provided context and
// target handler.
func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -126,7 +127,7 @@ func (p *SetDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.FrameHan
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -140,8 +141,9 @@ func ClearDeviceMetricsOverride() *ClearDeviceMetricsOverrideParams {
return &ClearDeviceMetricsOverrideParams{}
}
// Do executes Emulation.clearDeviceMetricsOverride.
func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.clearDeviceMetricsOverride against the provided context and
// target handler.
func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -165,7 +167,7 @@ func (p *ClearDeviceMetricsOverrideParams) Do(ctxt context.Context, h cdp.FrameH
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -198,8 +200,9 @@ func ForceViewport(x float64, y float64, scale float64) *ForceViewportParams {
}
}
// Do executes Emulation.forceViewport.
func (p *ForceViewportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.forceViewport against the provided context and
// target handler.
func (p *ForceViewportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -229,7 +232,7 @@ func (p *ForceViewportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -245,8 +248,9 @@ func ResetViewport() *ResetViewportParams {
return &ResetViewportParams{}
}
// Do executes Emulation.resetViewport.
func (p *ResetViewportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.resetViewport against the provided context and
// target handler.
func (p *ResetViewportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -270,7 +274,7 @@ func (p *ResetViewportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -286,8 +290,9 @@ func ResetPageScaleFactor() *ResetPageScaleFactorParams {
return &ResetPageScaleFactorParams{}
}
// Do executes Emulation.resetPageScaleFactor.
func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.resetPageScaleFactor against the provided context and
// target handler.
func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -311,7 +316,7 @@ func (p *ResetPageScaleFactorParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -332,8 +337,9 @@ func SetPageScaleFactor(pageScaleFactor float64) *SetPageScaleFactorParams {
}
}
// Do executes Emulation.setPageScaleFactor.
func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setPageScaleFactor against the provided context and
// target handler.
func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -363,7 +369,7 @@ func (p *SetPageScaleFactorParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -391,8 +397,9 @@ func SetVisibleSize(width int64, height int64) *SetVisibleSizeParams {
}
}
// Do executes Emulation.setVisibleSize.
func (p *SetVisibleSizeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setVisibleSize against the provided context and
// target handler.
func (p *SetVisibleSizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -422,7 +429,7 @@ func (p *SetVisibleSizeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -443,8 +450,9 @@ func SetScriptExecutionDisabled(value bool) *SetScriptExecutionDisabledParams {
}
}
// Do executes Emulation.setScriptExecutionDisabled.
func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setScriptExecutionDisabled against the provided context and
// target handler.
func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -474,7 +482,7 @@ func (p *SetScriptExecutionDisabledParams) Do(ctxt context.Context, h cdp.FrameH
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -514,8 +522,9 @@ func (p SetGeolocationOverrideParams) WithAccuracy(accuracy float64) *SetGeoloca
return &p
}
// Do executes Emulation.setGeolocationOverride.
func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setGeolocationOverride against the provided context and
// target handler.
func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -545,7 +554,7 @@ func (p *SetGeolocationOverrideParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -561,8 +570,9 @@ func ClearGeolocationOverride() *ClearGeolocationOverrideParams {
return &ClearGeolocationOverrideParams{}
}
// Do executes Emulation.clearGeolocationOverride.
func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.clearGeolocationOverride against the provided context and
// target handler.
func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -586,7 +596,7 @@ func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h cdp.FrameHan
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -616,8 +626,9 @@ func (p SetTouchEmulationEnabledParams) WithConfiguration(configuration EnabledC
return &p
}
// Do executes Emulation.setTouchEmulationEnabled.
func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setTouchEmulationEnabled against the provided context and
// target handler.
func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -647,7 +658,7 @@ func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h cdp.FrameHan
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -668,8 +679,9 @@ func SetEmulatedMedia(media string) *SetEmulatedMediaParams {
}
}
// Do executes Emulation.setEmulatedMedia.
func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setEmulatedMedia against the provided context and
// target handler.
func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -699,7 +711,7 @@ func (p *SetEmulatedMediaParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -720,8 +732,9 @@ func SetCPUThrottlingRate(rate float64) *SetCPUThrottlingRateParams {
}
}
// Do executes Emulation.setCPUThrottlingRate.
func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setCPUThrottlingRate against the provided context and
// target handler.
func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -751,7 +764,7 @@ func (p *SetCPUThrottlingRateParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -770,11 +783,12 @@ type CanEmulateReturns struct {
Result bool `json:"result,omitempty"` // True if emulation is supported.
}
// Do executes Emulation.canEmulate.
// 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.FrameHandler) (result bool, err error) {
func (p *CanEmulateParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -805,7 +819,7 @@ func (p *CanEmulateParams) Do(ctxt context.Context, h cdp.FrameHandler) (result
}
case <-ctxt.Done():
return false, cdp.ErrContextDone
return false, ctxt.Err()
}
return false, cdp.ErrUnknownResult
@ -838,8 +852,9 @@ func (p SetVirtualTimePolicyParams) WithBudget(budget int64) *SetVirtualTimePoli
return &p
}
// Do executes Emulation.setVirtualTimePolicy.
func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setVirtualTimePolicy against the provided context and
// target handler.
func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -869,7 +884,7 @@ func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -898,8 +913,9 @@ func (p SetDefaultBackgroundColorOverrideParams) WithColor(color *cdp.RGBA) *Set
return &p
}
// Do executes Emulation.setDefaultBackgroundColorOverride.
func (p *SetDefaultBackgroundColorOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Emulation.setDefaultBackgroundColorOverride against the provided context and
// target handler.
func (p *SetDefaultBackgroundColorOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -929,7 +945,7 @@ func (p *SetDefaultBackgroundColorOverrideParams) Do(ctxt context.Context, h cdp
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package heapprofiler provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome HeapProfiler domain.
// commands, types, and events for the HeapProfiler domain.
//
// Generated by the chromedp-gen command.
package heapprofiler
@ -22,8 +22,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes HeapProfiler.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes HeapProfiler.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -47,7 +48,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -61,8 +62,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes HeapProfiler.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes HeapProfiler.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -86,7 +88,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -110,8 +112,9 @@ func (p StartTrackingHeapObjectsParams) WithTrackAllocations(trackAllocations bo
return &p
}
// Do executes HeapProfiler.startTrackingHeapObjects.
func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes HeapProfiler.startTrackingHeapObjects against the provided context and
// target handler.
func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -141,7 +144,7 @@ func (p *StartTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.FrameHan
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -166,8 +169,9 @@ func (p StopTrackingHeapObjectsParams) WithReportProgress(reportProgress bool) *
return &p
}
// Do executes HeapProfiler.stopTrackingHeapObjects.
func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes HeapProfiler.stopTrackingHeapObjects against the provided context and
// target handler.
func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -197,7 +201,7 @@ func (p *StopTrackingHeapObjectsParams) Do(ctxt context.Context, h cdp.FrameHand
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -222,8 +226,9 @@ func (p TakeHeapSnapshotParams) WithReportProgress(reportProgress bool) *TakeHea
return &p
}
// Do executes HeapProfiler.takeHeapSnapshot.
func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes HeapProfiler.takeHeapSnapshot against the provided context and
// target handler.
func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -253,7 +258,7 @@ func (p *TakeHeapSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -267,8 +272,9 @@ func CollectGarbage() *CollectGarbageParams {
return &CollectGarbageParams{}
}
// Do executes HeapProfiler.collectGarbage.
func (p *CollectGarbageParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes HeapProfiler.collectGarbage against the provided context and
// target handler.
func (p *CollectGarbageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -292,7 +298,7 @@ func (p *CollectGarbageParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -326,11 +332,12 @@ type GetObjectByHeapObjectIDReturns struct {
Result *runtime.RemoteObject `json:"result,omitempty"` // Evaluation result.
}
// Do executes HeapProfiler.getObjectByHeapObjectId.
// Do executes HeapProfiler.getObjectByHeapObjectId against the provided context and
// target handler.
//
// returns:
// result - Evaluation result.
func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *runtime.RemoteObject, err error) {
func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h cdp.Handler) (result *runtime.RemoteObject, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -367,7 +374,7 @@ func (p *GetObjectByHeapObjectIDParams) Do(ctxt context.Context, h cdp.FrameHand
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -390,8 +397,9 @@ func AddInspectedHeapObject(heapObjectID HeapSnapshotObjectID) *AddInspectedHeap
}
}
// Do executes HeapProfiler.addInspectedHeapObject.
func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes HeapProfiler.addInspectedHeapObject against the provided context and
// target handler.
func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -421,7 +429,7 @@ func (p *AddInspectedHeapObjectParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -447,11 +455,12 @@ 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.
// 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.FrameHandler) (heapSnapshotObjectID HeapSnapshotObjectID, err error) {
func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h cdp.Handler) (heapSnapshotObjectID HeapSnapshotObjectID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -488,7 +497,7 @@ func (p *GetHeapObjectIDParams) Do(ctxt context.Context, h cdp.FrameHandler) (he
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -513,8 +522,9 @@ func (p StartSamplingParams) WithSamplingInterval(samplingInterval float64) *Sta
return &p
}
// Do executes HeapProfiler.startSampling.
func (p *StartSamplingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes HeapProfiler.startSampling against the provided context and
// target handler.
func (p *StartSamplingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -544,7 +554,7 @@ func (p *StartSamplingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -563,11 +573,12 @@ type StopSamplingReturns struct {
Profile *SamplingHeapProfile `json:"profile,omitempty"` // Recorded sampling heap profile.
}
// Do executes HeapProfiler.stopSampling.
// 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.FrameHandler) (profile *SamplingHeapProfile, err error) {
func (p *StopSamplingParams) Do(ctxt context.Context, h cdp.Handler) (profile *SamplingHeapProfile, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -598,7 +609,7 @@ func (p *StopSamplingParams) Do(ctxt context.Context, h cdp.FrameHandler) (profi
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package indexeddb provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome IndexedDB domain.
// commands, types, and events for the IndexedDB domain.
//
// Generated by the chromedp-gen command.
package indexeddb
@ -21,8 +21,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes IndexedDB.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes IndexedDB.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -46,7 +47,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -60,8 +61,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes IndexedDB.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes IndexedDB.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -85,7 +87,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -112,11 +114,12 @@ type RequestDatabaseNamesReturns struct {
DatabaseNames []string `json:"databaseNames,omitempty"` // Database names for origin.
}
// Do executes IndexedDB.requestDatabaseNames.
// 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.FrameHandler) (databaseNames []string, err error) {
func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h cdp.Handler) (databaseNames []string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -153,7 +156,7 @@ func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -182,11 +185,12 @@ type RequestDatabaseReturns struct {
DatabaseWithObjectStores *DatabaseWithObjectStores `json:"databaseWithObjectStores,omitempty"` // Database with an array of object stores.
}
// Do executes IndexedDB.requestDatabase.
// 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.FrameHandler) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
func (p *RequestDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -223,7 +227,7 @@ func (p *RequestDatabaseParams) Do(ctxt context.Context, h cdp.FrameHandler) (da
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -272,12 +276,13 @@ type RequestDataReturns struct {
HasMore bool `json:"hasMore,omitempty"` // If true, there are more entries to fetch in the given range.
}
// Do executes IndexedDB.requestData.
// Do executes IndexedDB.requestData against the provided context and
// target handler.
//
// returns:
// objectStoreDataEntries - Array of object store data entries.
// hasMore - If true, there are more entries to fetch in the given range.
func (p *RequestDataParams) Do(ctxt context.Context, h cdp.FrameHandler) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
func (p *RequestDataParams) Do(ctxt context.Context, h cdp.Handler) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -314,7 +319,7 @@ func (p *RequestDataParams) Do(ctxt context.Context, h cdp.FrameHandler) (object
}
case <-ctxt.Done():
return nil, false, cdp.ErrContextDone
return nil, false, ctxt.Err()
}
return nil, false, cdp.ErrUnknownResult
@ -341,8 +346,9 @@ func ClearObjectStore(securityOrigin string, databaseName string, objectStoreNam
}
}
// Do executes IndexedDB.clearObjectStore.
func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes IndexedDB.clearObjectStore against the provided context and
// target handler.
func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -372,7 +378,7 @@ func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -396,8 +402,9 @@ func DeleteDatabase(securityOrigin string, databaseName string) *DeleteDatabaseP
}
}
// Do executes IndexedDB.deleteDatabase.
func (p *DeleteDatabaseParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes IndexedDB.deleteDatabase against the provided context and
// target handler.
func (p *DeleteDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -427,7 +434,7 @@ func (p *DeleteDatabaseParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package input provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Input domain.
// commands, types, and events for the Input domain.
//
// Generated by the chromedp-gen command.
package input
@ -123,8 +123,9 @@ func (p DispatchKeyEventParams) WithIsSystemKey(isSystemKey bool) *DispatchKeyEv
return &p
}
// Do executes Input.dispatchKeyEvent.
func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Input.dispatchKeyEvent against the provided context and
// target handler.
func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -154,7 +155,7 @@ func (p *DispatchKeyEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -211,8 +212,9 @@ func (p DispatchMouseEventParams) WithClickCount(clickCount int64) *DispatchMous
return &p
}
// Do executes Input.dispatchMouseEvent.
func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Input.dispatchMouseEvent against the provided context and
// target handler.
func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -242,7 +244,7 @@ func (p *DispatchMouseEventParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -282,8 +284,9 @@ func (p DispatchTouchEventParams) WithTimestamp(timestamp float64) *DispatchTouc
return &p
}
// Do executes Input.dispatchTouchEvent.
func (p *DispatchTouchEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Input.dispatchTouchEvent against the provided context and
// target handler.
func (p *DispatchTouchEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -313,7 +316,7 @@ func (p *DispatchTouchEventParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -377,8 +380,9 @@ func (p EmulateTouchFromMouseEventParams) WithClickCount(clickCount int64) *Emul
return &p
}
// Do executes Input.emulateTouchFromMouseEvent.
func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Input.emulateTouchFromMouseEvent against the provided context and
// target handler.
func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -408,7 +412,7 @@ func (p *EmulateTouchFromMouseEventParams) Do(ctxt context.Context, h cdp.FrameH
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -453,8 +457,9 @@ func (p SynthesizePinchGestureParams) WithGestureSourceType(gestureSourceType Ge
return &p
}
// Do executes Input.synthesizePinchGesture.
func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Input.synthesizePinchGesture against the provided context and
// target handler.
func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -484,7 +489,7 @@ func (p *SynthesizePinchGestureParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -587,8 +592,9 @@ func (p SynthesizeScrollGestureParams) WithInteractionMarkerName(interactionMark
return &p
}
// Do executes Input.synthesizeScrollGesture.
func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Input.synthesizeScrollGesture against the provided context and
// target handler.
func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -618,7 +624,7 @@ func (p *SynthesizeScrollGestureParams) Do(ctxt context.Context, h cdp.FrameHand
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -668,8 +674,9 @@ func (p SynthesizeTapGestureParams) WithGestureSourceType(gestureSourceType Gest
return &p
}
// Do executes Input.synthesizeTapGesture.
func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Input.synthesizeTapGesture against the provided context and
// target handler.
func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -699,7 +706,7 @@ func (p *SynthesizeTapGestureParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package inspector provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Inspector domain.
// commands, types, and events for the Inspector domain.
//
// Generated by the chromedp-gen command.
package inspector
@ -21,8 +21,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Inspector.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Inspector.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -46,7 +47,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -60,8 +61,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Inspector.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Inspector.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -85,7 +87,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package io provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome IO domain.
// commands, types, and events for the IO domain.
//
// Input/Output operations for streams produced by DevTools.
//
@ -52,12 +52,13 @@ type ReadReturns struct {
EOF bool `json:"eof,omitempty"` // Set if the end-of-file condition occured while reading.
}
// Do executes IO.read.
// Do executes IO.read against the provided context and
// target handler.
//
// returns:
// data - Data that were read.
// eof - Set if the end-of-file condition occured while reading.
func (p *ReadParams) Do(ctxt context.Context, h cdp.FrameHandler) (data string, eof bool, err error) {
func (p *ReadParams) Do(ctxt context.Context, h cdp.Handler) (data string, eof bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -94,7 +95,7 @@ func (p *ReadParams) Do(ctxt context.Context, h cdp.FrameHandler) (data string,
}
case <-ctxt.Done():
return "", false, cdp.ErrContextDone
return "", false, ctxt.Err()
}
return "", false, cdp.ErrUnknownResult
@ -115,8 +116,9 @@ func Close(handle StreamHandle) *CloseParams {
}
}
// Do executes IO.close.
func (p *CloseParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes IO.close against the provided context and
// target handler.
func (p *CloseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -146,7 +148,7 @@ func (p *CloseParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package layertree provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome LayerTree domain.
// commands, types, and events for the LayerTree domain.
//
// Generated by the chromedp-gen command.
package layertree
@ -22,8 +22,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes LayerTree.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes LayerTree.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -47,7 +48,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -61,8 +62,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes LayerTree.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes LayerTree.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -86,7 +88,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -114,11 +116,12 @@ type CompositingReasonsReturns struct {
CompositingReasons []string `json:"compositingReasons,omitempty"` // A list of strings specifying reasons for the given layer to become composited.
}
// Do executes LayerTree.compositingReasons.
// Do executes LayerTree.compositingReasons against the provided context and
// target handler.
//
// returns:
// compositingReasons - A list of strings specifying reasons for the given layer to become composited.
func (p *CompositingReasonsParams) Do(ctxt context.Context, h cdp.FrameHandler) (compositingReasons []string, err error) {
func (p *CompositingReasonsParams) Do(ctxt context.Context, h cdp.Handler) (compositingReasons []string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -155,7 +158,7 @@ func (p *CompositingReasonsParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -181,11 +184,12 @@ type MakeSnapshotReturns struct {
SnapshotID SnapshotID `json:"snapshotId,omitempty"` // The id of the layer snapshot.
}
// Do executes LayerTree.makeSnapshot.
// Do executes LayerTree.makeSnapshot against the provided context and
// target handler.
//
// returns:
// snapshotID - The id of the layer snapshot.
func (p *MakeSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (snapshotID SnapshotID, err error) {
func (p *MakeSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -222,7 +226,7 @@ func (p *MakeSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (snaps
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -248,11 +252,12 @@ type LoadSnapshotReturns struct {
SnapshotID SnapshotID `json:"snapshotId,omitempty"` // The id of the snapshot.
}
// Do executes LayerTree.loadSnapshot.
// Do executes LayerTree.loadSnapshot against the provided context and
// target handler.
//
// returns:
// snapshotID - The id of the snapshot.
func (p *LoadSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (snapshotID SnapshotID, err error) {
func (p *LoadSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (snapshotID SnapshotID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -289,7 +294,7 @@ func (p *LoadSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (snaps
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -310,8 +315,9 @@ func ReleaseSnapshot(snapshotID SnapshotID) *ReleaseSnapshotParams {
}
}
// Do executes LayerTree.releaseSnapshot.
func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes LayerTree.releaseSnapshot against the provided context and
// target handler.
func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -341,7 +347,7 @@ func (p *ReleaseSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (er
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -389,11 +395,12 @@ type ProfileSnapshotReturns struct {
Timings []PaintProfile `json:"timings,omitempty"` // The array of paint profiles, one per run.
}
// Do executes LayerTree.profileSnapshot.
// Do executes LayerTree.profileSnapshot against the provided context and
// target handler.
//
// returns:
// timings - The array of paint profiles, one per run.
func (p *ProfileSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (timings []PaintProfile, err error) {
func (p *ProfileSnapshotParams) Do(ctxt context.Context, h cdp.Handler) (timings []PaintProfile, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -430,7 +437,7 @@ func (p *ProfileSnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (ti
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -481,11 +488,12 @@ type ReplaySnapshotReturns struct {
DataURL string `json:"dataURL,omitempty"` // A data: URL for resulting image.
}
// Do executes LayerTree.replaySnapshot.
// Do executes LayerTree.replaySnapshot against the provided context and
// target handler.
//
// returns:
// dataURL - A data: URL for resulting image.
func (p *ReplaySnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (dataURL string, err error) {
func (p *ReplaySnapshotParams) Do(ctxt context.Context, h cdp.Handler) (dataURL string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -522,7 +530,7 @@ func (p *ReplaySnapshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (dat
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -549,11 +557,12 @@ type SnapshotCommandLogReturns struct {
CommandLog []easyjson.RawMessage `json:"commandLog,omitempty"` // The array of canvas function calls.
}
// Do executes LayerTree.snapshotCommandLog.
// Do executes LayerTree.snapshotCommandLog against the provided context and
// target handler.
//
// returns:
// commandLog - The array of canvas function calls.
func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h cdp.FrameHandler) (commandLog []easyjson.RawMessage, err error) {
func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h cdp.Handler) (commandLog []easyjson.RawMessage, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -590,7 +599,7 @@ func (p *SnapshotCommandLogParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package log provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Log domain.
// commands, types, and events for the Log domain.
//
// Provides access to log entries.
//
@ -25,8 +25,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Log.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Log.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -50,7 +51,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -66,8 +67,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Log.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Log.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -91,7 +93,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -105,8 +107,9 @@ func Clear() *ClearParams {
return &ClearParams{}
}
// Do executes Log.clear.
func (p *ClearParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Log.clear against the provided context and
// target handler.
func (p *ClearParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -130,7 +133,7 @@ func (p *ClearParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -151,8 +154,9 @@ func StartViolationsReport(config []*ViolationSetting) *StartViolationsReportPar
}
}
// Do executes Log.startViolationsReport.
func (p *StartViolationsReportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Log.startViolationsReport against the provided context and
// target handler.
func (p *StartViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -182,7 +186,7 @@ func (p *StartViolationsReportParams) Do(ctxt context.Context, h cdp.FrameHandle
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -196,8 +200,9 @@ func StopViolationsReport() *StopViolationsReportParams {
return &StopViolationsReportParams{}
}
// Do executes Log.stopViolationsReport.
func (p *StopViolationsReportParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Log.stopViolationsReport against the provided context and
// target handler.
func (p *StopViolationsReportParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -221,7 +226,7 @@ func (p *StopViolationsReportParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package memory provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Memory domain.
// commands, types, and events for the Memory domain.
//
// Generated by the chromedp-gen command.
package memory
@ -28,13 +28,14 @@ type GetDOMCountersReturns struct {
JsEventListeners int64 `json:"jsEventListeners,omitempty"`
}
// Do executes Memory.getDOMCounters.
// Do executes Memory.getDOMCounters against the provided context and
// target handler.
//
// returns:
// documents
// nodes
// jsEventListeners
func (p *GetDOMCountersParams) Do(ctxt context.Context, h cdp.FrameHandler) (documents int64, nodes int64, jsEventListeners int64, err error) {
func (p *GetDOMCountersParams) Do(ctxt context.Context, h cdp.Handler) (documents int64, nodes int64, jsEventListeners int64, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -65,7 +66,7 @@ func (p *GetDOMCountersParams) Do(ctxt context.Context, h cdp.FrameHandler) (doc
}
case <-ctxt.Done():
return 0, 0, 0, cdp.ErrContextDone
return 0, 0, 0, ctxt.Err()
}
return 0, 0, 0, cdp.ErrUnknownResult
@ -88,8 +89,9 @@ func SetPressureNotificationsSuppressed(suppressed bool) *SetPressureNotificatio
}
}
// Do executes Memory.setPressureNotificationsSuppressed.
func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Memory.setPressureNotificationsSuppressed against the provided context and
// target handler.
func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -119,7 +121,7 @@ func (p *SetPressureNotificationsSuppressedParams) Do(ctxt context.Context, h cd
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -142,8 +144,9 @@ func SimulatePressureNotification(level PressureLevel) *SimulatePressureNotifica
}
}
// Do executes Memory.simulatePressureNotification.
func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Memory.simulatePressureNotification against the provided context and
// target handler.
func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -173,7 +176,7 @@ func (p *SimulatePressureNotificationParams) Do(ctxt context.Context, h cdp.Fram
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package network provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Network domain.
// commands, types, and events for the Network domain.
//
// Network domain allows tracking network activities of the page. It exposes
// information about http, file, data and other requests and responses, their
@ -47,8 +47,9 @@ func (p EnableParams) WithMaxResourceBufferSize(maxResourceBufferSize int64) *En
return &p
}
// Do executes Network.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -78,7 +79,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -94,8 +95,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Network.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -119,7 +121,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -141,8 +143,9 @@ func SetUserAgentOverride(userAgent string) *SetUserAgentOverrideParams {
}
}
// Do executes Network.setUserAgentOverride.
func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.setUserAgentOverride against the provided context and
// target handler.
func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -172,7 +175,7 @@ func (p *SetUserAgentOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -195,8 +198,9 @@ func SetExtraHTTPHeaders(headers *Headers) *SetExtraHTTPHeadersParams {
}
}
// Do executes Network.setExtraHTTPHeaders.
func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.setExtraHTTPHeaders against the provided context and
// target handler.
func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -226,7 +230,7 @@ func (p *SetExtraHTTPHeadersParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -253,11 +257,12 @@ type GetResponseBodyReturns struct {
Base64encoded bool `json:"base64Encoded,omitempty"` // True, if content was sent as base64.
}
// Do executes Network.getResponseBody.
// Do executes Network.getResponseBody against the provided context and
// target handler.
//
// returns:
// body - Response body.
func (p *GetResponseBodyParams) Do(ctxt context.Context, h cdp.FrameHandler) (body []byte, err error) {
func (p *GetResponseBodyParams) Do(ctxt context.Context, h cdp.Handler) (body []byte, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -305,7 +310,7 @@ func (p *GetResponseBodyParams) Do(ctxt context.Context, h cdp.FrameHandler) (bo
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -326,8 +331,9 @@ func AddBlockedURL(url string) *AddBlockedURLParams {
}
}
// Do executes Network.addBlockedURL.
func (p *AddBlockedURLParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.addBlockedURL against the provided context and
// target handler.
func (p *AddBlockedURLParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -357,7 +363,7 @@ func (p *AddBlockedURLParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -378,8 +384,9 @@ func RemoveBlockedURL(url string) *RemoveBlockedURLParams {
}
}
// Do executes Network.removeBlockedURL.
func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.removeBlockedURL against the provided context and
// target handler.
func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -409,7 +416,7 @@ func (p *RemoveBlockedURLParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -436,8 +443,9 @@ func ReplayXHR(requestID RequestID) *ReplayXHRParams {
}
}
// Do executes Network.replayXHR.
func (p *ReplayXHRParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.replayXHR against the provided context and
// target handler.
func (p *ReplayXHRParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -467,7 +475,7 @@ func (p *ReplayXHRParams) Do(ctxt context.Context, h cdp.FrameHandler) (err erro
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -490,8 +498,9 @@ func SetMonitoringXHREnabled(enabled bool) *SetMonitoringXHREnabledParams {
}
}
// Do executes Network.setMonitoringXHREnabled.
func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.setMonitoringXHREnabled against the provided context and
// target handler.
func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -521,7 +530,7 @@ func (p *SetMonitoringXHREnabledParams) Do(ctxt context.Context, h cdp.FrameHand
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -541,11 +550,12 @@ type CanClearBrowserCacheReturns struct {
Result bool `json:"result,omitempty"` // True if browser cache can be cleared.
}
// Do executes Network.canClearBrowserCache.
// Do executes Network.canClearBrowserCache against the provided context and
// target handler.
//
// returns:
// result - True if browser cache can be cleared.
func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h cdp.FrameHandler) (result bool, err error) {
func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -576,7 +586,7 @@ func (p *CanClearBrowserCacheParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return false, cdp.ErrContextDone
return false, ctxt.Err()
}
return false, cdp.ErrUnknownResult
@ -590,8 +600,9 @@ func ClearBrowserCache() *ClearBrowserCacheParams {
return &ClearBrowserCacheParams{}
}
// Do executes Network.clearBrowserCache.
func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.clearBrowserCache against the provided context and
// target handler.
func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -615,7 +626,7 @@ func (p *ClearBrowserCacheParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -636,11 +647,12 @@ type CanClearBrowserCookiesReturns struct {
Result bool `json:"result,omitempty"` // True if browser cookies can be cleared.
}
// Do executes Network.canClearBrowserCookies.
// Do executes Network.canClearBrowserCookies against the provided context and
// target handler.
//
// returns:
// result - True if browser cookies can be cleared.
func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (result bool, err error) {
func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -671,7 +683,7 @@ func (p *CanClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return false, cdp.ErrContextDone
return false, ctxt.Err()
}
return false, cdp.ErrUnknownResult
@ -685,8 +697,9 @@ func ClearBrowserCookies() *ClearBrowserCookiesParams {
return &ClearBrowserCookiesParams{}
}
// Do executes Network.clearBrowserCookies.
func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.clearBrowserCookies against the provided context and
// target handler.
func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -710,7 +723,7 @@ func (p *ClearBrowserCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -743,11 +756,12 @@ type GetCookiesReturns struct {
Cookies []*Cookie `json:"cookies,omitempty"` // Array of cookie objects.
}
// Do executes Network.getCookies.
// Do executes Network.getCookies against the provided context and
// target handler.
//
// returns:
// cookies - Array of cookie objects.
func (p *GetCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (cookies []*Cookie, err error) {
func (p *GetCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -784,7 +798,7 @@ func (p *GetCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (cookies
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -805,11 +819,12 @@ type GetAllCookiesReturns struct {
Cookies []*Cookie `json:"cookies,omitempty"` // Array of cookie objects.
}
// Do executes Network.getAllCookies.
// Do executes Network.getAllCookies against the provided context and
// target handler.
//
// returns:
// cookies - Array of cookie objects.
func (p *GetAllCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (cookies []*Cookie, err error) {
func (p *GetAllCookiesParams) Do(ctxt context.Context, h cdp.Handler) (cookies []*Cookie, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -840,7 +855,7 @@ func (p *GetAllCookiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (cook
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -865,8 +880,9 @@ func DeleteCookie(cookieName string, url string) *DeleteCookieParams {
}
}
// Do executes Network.deleteCookie.
func (p *DeleteCookieParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.deleteCookie against the provided context and
// target handler.
func (p *DeleteCookieParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -896,7 +912,7 @@ func (p *DeleteCookieParams) Do(ctxt context.Context, h cdp.FrameHandler) (err e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -972,11 +988,12 @@ type SetCookieReturns struct {
Success bool `json:"success,omitempty"` // True if successfully set cookie.
}
// Do executes Network.setCookie.
// Do executes Network.setCookie against the provided context and
// target handler.
//
// returns:
// success - True if successfully set cookie.
func (p *SetCookieParams) Do(ctxt context.Context, h cdp.FrameHandler) (success bool, err error) {
func (p *SetCookieParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1013,7 +1030,7 @@ func (p *SetCookieParams) Do(ctxt context.Context, h cdp.FrameHandler) (success
}
case <-ctxt.Done():
return false, cdp.ErrContextDone
return false, ctxt.Err()
}
return false, cdp.ErrUnknownResult
@ -1034,11 +1051,12 @@ type CanEmulateNetworkConditionsReturns struct {
Result bool `json:"result,omitempty"` // True if emulation of network conditions is supported.
}
// Do executes Network.canEmulateNetworkConditions.
// Do executes Network.canEmulateNetworkConditions against the provided context and
// target handler.
//
// returns:
// result - True if emulation of network conditions is supported.
func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.FrameHandler) (result bool, err error) {
func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Handler) (result bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1069,7 +1087,7 @@ func (p *CanEmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Frame
}
case <-ctxt.Done():
return false, cdp.ErrContextDone
return false, ctxt.Err()
}
return false, cdp.ErrUnknownResult
@ -1106,8 +1124,9 @@ func (p EmulateNetworkConditionsParams) WithConnectionType(connectionType Connec
return &p
}
// Do executes Network.emulateNetworkConditions.
func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.emulateNetworkConditions against the provided context and
// target handler.
func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1137,7 +1156,7 @@ func (p *EmulateNetworkConditionsParams) Do(ctxt context.Context, h cdp.FrameHan
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1160,8 +1179,9 @@ func SetCacheDisabled(cacheDisabled bool) *SetCacheDisabledParams {
}
}
// Do executes Network.setCacheDisabled.
func (p *SetCacheDisabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.setCacheDisabled against the provided context and
// target handler.
func (p *SetCacheDisabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1191,7 +1211,7 @@ func (p *SetCacheDisabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1214,8 +1234,9 @@ func SetBypassServiceWorker(bypass bool) *SetBypassServiceWorkerParams {
}
}
// Do executes Network.setBypassServiceWorker.
func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.setBypassServiceWorker against the provided context and
// target handler.
func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1245,7 +1266,7 @@ func (p *SetBypassServiceWorkerParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1269,8 +1290,9 @@ func SetDataSizeLimitsForTest(maxTotalSize int64, maxResourceSize int64) *SetDat
}
}
// Do executes Network.setDataSizeLimitsForTest.
func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Network.setDataSizeLimitsForTest against the provided context and
// target handler.
func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1300,7 +1322,7 @@ func (p *SetDataSizeLimitsForTestParams) Do(ctxt context.Context, h cdp.FrameHan
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1326,11 +1348,12 @@ type GetCertificateReturns struct {
TableNames []string `json:"tableNames,omitempty"`
}
// Do executes Network.getCertificate.
// Do executes Network.getCertificate against the provided context and
// target handler.
//
// returns:
// tableNames
func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.FrameHandler) (tableNames []string, err error) {
func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1367,7 +1390,7 @@ func (p *GetCertificateParams) Do(ctxt context.Context, h cdp.FrameHandler) (tab
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package page provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Page domain.
// commands, types, and events for the Page domain.
//
// Actions and events related to the inspected page belong to the page
// domain.
@ -26,8 +26,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Page.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -51,7 +52,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -65,8 +66,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Page.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -90,7 +92,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -116,11 +118,12 @@ type AddScriptToEvaluateOnLoadReturns struct {
Identifier ScriptIdentifier `json:"identifier,omitempty"` // Identifier of the added script.
}
// Do executes Page.addScriptToEvaluateOnLoad.
// Do executes Page.addScriptToEvaluateOnLoad against the provided context and
// target handler.
//
// returns:
// identifier - Identifier of the added script.
func (p *AddScriptToEvaluateOnLoadParams) Do(ctxt context.Context, h cdp.FrameHandler) (identifier ScriptIdentifier, err error) {
func (p *AddScriptToEvaluateOnLoadParams) Do(ctxt context.Context, h cdp.Handler) (identifier ScriptIdentifier, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -157,7 +160,7 @@ func (p *AddScriptToEvaluateOnLoadParams) Do(ctxt context.Context, h cdp.FrameHa
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -178,8 +181,9 @@ func RemoveScriptToEvaluateOnLoad(identifier ScriptIdentifier) *RemoveScriptToEv
}
}
// Do executes Page.removeScriptToEvaluateOnLoad.
func (p *RemoveScriptToEvaluateOnLoadParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.removeScriptToEvaluateOnLoad against the provided context and
// target handler.
func (p *RemoveScriptToEvaluateOnLoadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -209,7 +213,7 @@ func (p *RemoveScriptToEvaluateOnLoadParams) Do(ctxt context.Context, h cdp.Fram
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -232,8 +236,9 @@ func SetAutoAttachToCreatedPages(autoAttach bool) *SetAutoAttachToCreatedPagesPa
}
}
// Do executes Page.setAutoAttachToCreatedPages.
func (p *SetAutoAttachToCreatedPagesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.setAutoAttachToCreatedPages against the provided context and
// target handler.
func (p *SetAutoAttachToCreatedPagesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -263,7 +268,7 @@ func (p *SetAutoAttachToCreatedPagesParams) Do(ctxt context.Context, h cdp.Frame
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -296,8 +301,9 @@ func (p ReloadParams) WithScriptToEvaluateOnLoad(scriptToEvaluateOnLoad string)
return &p
}
// Do executes Page.reload.
func (p *ReloadParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.reload against the provided context and
// target handler.
func (p *ReloadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -327,7 +333,7 @@ func (p *ReloadParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -353,11 +359,12 @@ type NavigateReturns struct {
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame id that will be navigated.
}
// Do executes Page.navigate.
// Do executes Page.navigate against the provided context and
// target handler.
//
// returns:
// frameID - Frame id that will be navigated.
func (p *NavigateParams) Do(ctxt context.Context, h cdp.FrameHandler) (frameID cdp.FrameID, err error) {
func (p *NavigateParams) Do(ctxt context.Context, h cdp.Handler) (frameID cdp.FrameID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -394,7 +401,7 @@ func (p *NavigateParams) Do(ctxt context.Context, h cdp.FrameHandler) (frameID c
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -410,8 +417,9 @@ func StopLoading() *StopLoadingParams {
return &StopLoadingParams{}
}
// Do executes Page.stopLoading.
func (p *StopLoadingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.stopLoading against the provided context and
// target handler.
func (p *StopLoadingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -435,7 +443,7 @@ func (p *StopLoadingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err er
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -456,12 +464,13 @@ type GetNavigationHistoryReturns struct {
Entries []*NavigationEntry `json:"entries,omitempty"` // Array of navigation history entries.
}
// Do executes Page.getNavigationHistory.
// Do executes Page.getNavigationHistory against the provided context and
// target handler.
//
// returns:
// currentIndex - Index of the current navigation history entry.
// entries - Array of navigation history entries.
func (p *GetNavigationHistoryParams) Do(ctxt context.Context, h cdp.FrameHandler) (currentIndex int64, entries []*NavigationEntry, err error) {
func (p *GetNavigationHistoryParams) Do(ctxt context.Context, h cdp.Handler) (currentIndex int64, entries []*NavigationEntry, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -492,7 +501,7 @@ func (p *GetNavigationHistoryParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return 0, nil, cdp.ErrContextDone
return 0, nil, ctxt.Err()
}
return 0, nil, cdp.ErrUnknownResult
@ -514,8 +523,9 @@ func NavigateToHistoryEntry(entryID int64) *NavigateToHistoryEntryParams {
}
}
// Do executes Page.navigateToHistoryEntry.
func (p *NavigateToHistoryEntryParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.navigateToHistoryEntry against the provided context and
// target handler.
func (p *NavigateToHistoryEntryParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -545,7 +555,7 @@ func (p *NavigateToHistoryEntryParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -564,11 +574,12 @@ type GetResourceTreeReturns struct {
FrameTree *FrameResourceTree `json:"frameTree,omitempty"` // Present frame / resource tree structure.
}
// Do executes Page.getResourceTree.
// Do executes Page.getResourceTree against the provided context and
// target handler.
//
// returns:
// frameTree - Present frame / resource tree structure.
func (p *GetResourceTreeParams) Do(ctxt context.Context, h cdp.FrameHandler) (frameTree *FrameResourceTree, err error) {
func (p *GetResourceTreeParams) Do(ctxt context.Context, h cdp.Handler) (frameTree *FrameResourceTree, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -599,7 +610,7 @@ func (p *GetResourceTreeParams) Do(ctxt context.Context, h cdp.FrameHandler) (fr
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -629,11 +640,12 @@ type GetResourceContentReturns struct {
Base64encoded bool `json:"base64Encoded,omitempty"` // True, if content was served as base64.
}
// Do executes Page.getResourceContent.
// Do executes Page.getResourceContent against the provided context and
// target handler.
//
// returns:
// content - Resource content.
func (p *GetResourceContentParams) Do(ctxt context.Context, h cdp.FrameHandler) (content []byte, err error) {
func (p *GetResourceContentParams) Do(ctxt context.Context, h cdp.Handler) (content []byte, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -681,7 +693,7 @@ func (p *GetResourceContentParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -727,11 +739,12 @@ type SearchInResourceReturns struct {
Result []*debugger.SearchMatch `json:"result,omitempty"` // List of search matches.
}
// Do executes Page.searchInResource.
// Do executes Page.searchInResource against the provided context and
// target handler.
//
// returns:
// result - List of search matches.
func (p *SearchInResourceParams) Do(ctxt context.Context, h cdp.FrameHandler) (result []*debugger.SearchMatch, err error) {
func (p *SearchInResourceParams) Do(ctxt context.Context, h cdp.Handler) (result []*debugger.SearchMatch, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -768,7 +781,7 @@ func (p *SearchInResourceParams) Do(ctxt context.Context, h cdp.FrameHandler) (r
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -792,8 +805,9 @@ func SetDocumentContent(frameID cdp.FrameID, html string) *SetDocumentContentPar
}
}
// Do executes Page.setDocumentContent.
func (p *SetDocumentContentParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.setDocumentContent against the provided context and
// target handler.
func (p *SetDocumentContentParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -823,7 +837,7 @@ func (p *SetDocumentContentParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -859,11 +873,12 @@ type CaptureScreenshotReturns struct {
Data string `json:"data,omitempty"` // Base64-encoded image data.
}
// Do executes Page.captureScreenshot.
// Do executes Page.captureScreenshot against the provided context and
// target handler.
//
// returns:
// data - Base64-encoded image data.
func (p *CaptureScreenshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (data []byte, err error) {
func (p *CaptureScreenshotParams) Do(ctxt context.Context, h cdp.Handler) (data []byte, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -907,7 +922,7 @@ func (p *CaptureScreenshotParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -960,8 +975,9 @@ func (p StartScreencastParams) WithEveryNthFrame(everyNthFrame int64) *StartScre
return &p
}
// Do executes Page.startScreencast.
func (p *StartScreencastParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.startScreencast against the provided context and
// target handler.
func (p *StartScreencastParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -991,7 +1007,7 @@ func (p *StartScreencastParams) Do(ctxt context.Context, h cdp.FrameHandler) (er
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1005,8 +1021,9 @@ func StopScreencast() *StopScreencastParams {
return &StopScreencastParams{}
}
// Do executes Page.stopScreencast.
func (p *StopScreencastParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.stopScreencast against the provided context and
// target handler.
func (p *StopScreencastParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1030,7 +1047,7 @@ func (p *StopScreencastParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1053,8 +1070,9 @@ func ScreencastFrameAck(sessionID int64) *ScreencastFrameAckParams {
}
}
// Do executes Page.screencastFrameAck.
func (p *ScreencastFrameAckParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.screencastFrameAck against the provided context and
// target handler.
func (p *ScreencastFrameAckParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1084,7 +1102,7 @@ func (p *ScreencastFrameAckParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1115,8 +1133,9 @@ func (p HandleJavaScriptDialogParams) WithPromptText(promptText string) *HandleJ
return &p
}
// Do executes Page.handleJavaScriptDialog.
func (p *HandleJavaScriptDialogParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.handleJavaScriptDialog against the provided context and
// target handler.
func (p *HandleJavaScriptDialogParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1146,7 +1165,7 @@ func (p *HandleJavaScriptDialogParams) Do(ctxt context.Context, h cdp.FrameHandl
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1167,8 +1186,9 @@ func SetColorPickerEnabled(enabled bool) *SetColorPickerEnabledParams {
}
}
// Do executes Page.setColorPickerEnabled.
func (p *SetColorPickerEnabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.setColorPickerEnabled against the provided context and
// target handler.
func (p *SetColorPickerEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1198,7 +1218,7 @@ func (p *SetColorPickerEnabledParams) Do(ctxt context.Context, h cdp.FrameHandle
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1230,8 +1250,9 @@ func (p ConfigureOverlayParams) WithMessage(message string) *ConfigureOverlayPar
return &p
}
// Do executes Page.configureOverlay.
func (p *ConfigureOverlayParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.configureOverlay against the provided context and
// target handler.
func (p *ConfigureOverlayParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1261,7 +1282,7 @@ func (p *ConfigureOverlayParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1282,13 +1303,14 @@ type GetAppManifestReturns struct {
Data string `json:"data,omitempty"` // Manifest content.
}
// Do executes Page.getAppManifest.
// Do executes Page.getAppManifest against the provided context and
// target handler.
//
// returns:
// url - Manifest location.
// errors
// data - Manifest content.
func (p *GetAppManifestParams) Do(ctxt context.Context, h cdp.FrameHandler) (url string, errors []*AppManifestError, data string, err error) {
func (p *GetAppManifestParams) Do(ctxt context.Context, h cdp.Handler) (url string, errors []*AppManifestError, data string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1319,7 +1341,7 @@ func (p *GetAppManifestParams) Do(ctxt context.Context, h cdp.FrameHandler) (url
}
case <-ctxt.Done():
return "", nil, "", cdp.ErrContextDone
return "", nil, "", ctxt.Err()
}
return "", nil, "", cdp.ErrUnknownResult
@ -1333,8 +1355,9 @@ func RequestAppBanner() *RequestAppBannerParams {
return &RequestAppBannerParams{}
}
// Do executes Page.requestAppBanner.
func (p *RequestAppBannerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.requestAppBanner against the provided context and
// target handler.
func (p *RequestAppBannerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1358,7 +1381,7 @@ func (p *RequestAppBannerParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1381,8 +1404,9 @@ func SetControlNavigations(enabled bool) *SetControlNavigationsParams {
}
}
// Do executes Page.setControlNavigations.
func (p *SetControlNavigationsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.setControlNavigations against the provided context and
// target handler.
func (p *SetControlNavigationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1412,7 +1436,7 @@ func (p *SetControlNavigationsParams) Do(ctxt context.Context, h cdp.FrameHandle
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1439,8 +1463,9 @@ func ProcessNavigation(response NavigationResponse, navigationID int64) *Process
}
}
// Do executes Page.processNavigation.
func (p *ProcessNavigationParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Page.processNavigation against the provided context and
// target handler.
func (p *ProcessNavigationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1470,7 +1495,7 @@ func (p *ProcessNavigationParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -1492,12 +1517,13 @@ type GetLayoutMetricsReturns struct {
VisualViewport *VisualViewport `json:"visualViewport,omitempty"` // Metrics relating to the visual viewport.
}
// Do executes Page.getLayoutMetrics.
// Do executes Page.getLayoutMetrics against the provided context and
// target handler.
//
// returns:
// layoutViewport - Metrics relating to the layout viewport.
// visualViewport - Metrics relating to the visual viewport.
func (p *GetLayoutMetricsParams) Do(ctxt context.Context, h cdp.FrameHandler) (layoutViewport *LayoutViewport, visualViewport *VisualViewport, err error) {
func (p *GetLayoutMetricsParams) Do(ctxt context.Context, h cdp.Handler) (layoutViewport *LayoutViewport, visualViewport *VisualViewport, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -1528,7 +1554,7 @@ func (p *GetLayoutMetricsParams) Do(ctxt context.Context, h cdp.FrameHandler) (l
}
case <-ctxt.Done():
return nil, nil, cdp.ErrContextDone
return nil, nil, ctxt.Err()
}
return nil, nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package profiler provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Profiler domain.
// commands, types, and events for the Profiler domain.
//
// Generated by the chromedp-gen command.
package profiler
@ -21,8 +21,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Profiler.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Profiler.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -46,7 +47,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -60,8 +61,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Profiler.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Profiler.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -85,7 +87,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -108,8 +110,9 @@ func SetSamplingInterval(interval int64) *SetSamplingIntervalParams {
}
}
// Do executes Profiler.setSamplingInterval.
func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Profiler.setSamplingInterval against the provided context and
// target handler.
func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -139,7 +142,7 @@ func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -153,8 +156,9 @@ func Start() *StartParams {
return &StartParams{}
}
// Do executes Profiler.start.
func (p *StartParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Profiler.start against the provided context and
// target handler.
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -178,7 +182,7 @@ func (p *StartParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -197,11 +201,12 @@ type StopReturns struct {
Profile *Profile `json:"profile,omitempty"` // Recorded profile.
}
// Do executes Profiler.stop.
// Do executes Profiler.stop against the provided context and
// target handler.
//
// returns:
// profile - Recorded profile.
func (p *StopParams) Do(ctxt context.Context, h cdp.FrameHandler) (profile *Profile, err error) {
func (p *StopParams) Do(ctxt context.Context, h cdp.Handler) (profile *Profile, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -232,7 +237,7 @@ func (p *StopParams) Do(ctxt context.Context, h cdp.FrameHandler) (profile *Prof
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package rendering provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Rendering domain.
// commands, types, and events for the Rendering domain.
//
// This domain allows to control rendering of the page.
//
@ -30,8 +30,9 @@ func SetShowPaintRects(result bool) *SetShowPaintRectsParams {
}
}
// Do executes Rendering.setShowPaintRects.
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Rendering.setShowPaintRects against the provided context and
// target handler.
func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -61,7 +62,7 @@ func (p *SetShowPaintRectsParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -83,8 +84,9 @@ func SetShowDebugBorders(show bool) *SetShowDebugBordersParams {
}
}
// Do executes Rendering.setShowDebugBorders.
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Rendering.setShowDebugBorders against the provided context and
// target handler.
func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -114,7 +116,7 @@ func (p *SetShowDebugBordersParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -135,8 +137,9 @@ func SetShowFPSCounter(show bool) *SetShowFPSCounterParams {
}
}
// Do executes Rendering.setShowFPSCounter.
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Rendering.setShowFPSCounter against the provided context and
// target handler.
func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -166,7 +169,7 @@ func (p *SetShowFPSCounterParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -189,8 +192,9 @@ func SetShowScrollBottleneckRects(show bool) *SetShowScrollBottleneckRectsParams
}
}
// Do executes Rendering.setShowScrollBottleneckRects.
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Rendering.setShowScrollBottleneckRects against the provided context and
// target handler.
func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -220,7 +224,7 @@ func (p *SetShowScrollBottleneckRectsParams) Do(ctxt context.Context, h cdp.Fram
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -242,8 +246,9 @@ func SetShowViewportSizeOnResize(show bool) *SetShowViewportSizeOnResizeParams {
}
}
// Do executes Rendering.setShowViewportSizeOnResize.
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Rendering.setShowViewportSizeOnResize against the provided context and
// target handler.
func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -273,7 +278,7 @@ func (p *SetShowViewportSizeOnResizeParams) Do(ctxt context.Context, h cdp.Frame
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package runtime provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Runtime domain.
// commands, types, and events for the Runtime domain.
//
// Runtime domain exposes JavaScript runtime by means of remote evaluation
// and mirror objects. Evaluation results are returned as mirror object that
@ -105,12 +105,13 @@ type EvaluateReturns struct {
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}
// Do executes Runtime.evaluate.
// 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.FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
func (p *EvaluateParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -147,7 +148,7 @@ func (p *EvaluateParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *R
}
case <-ctxt.Done():
return nil, nil, cdp.ErrContextDone
return nil, nil, ctxt.Err()
}
return nil, nil, cdp.ErrUnknownResult
@ -189,12 +190,13 @@ type AwaitPromiseReturns struct {
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details if stack strace is available.
}
// Do executes Runtime.awaitPromise.
// Do executes Runtime.awaitPromise against the provided context and
// target handler.
//
// returns:
// result - Promise result. Will contain rejected value if promise was rejected.
// exceptionDetails - Exception details if stack strace is available.
func (p *AwaitPromiseParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
func (p *AwaitPromiseParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -231,7 +233,7 @@ func (p *AwaitPromiseParams) Do(ctxt context.Context, h cdp.FrameHandler) (resul
}
case <-ctxt.Done():
return nil, nil, cdp.ErrContextDone
return nil, nil, ctxt.Err()
}
return nil, nil, cdp.ErrUnknownResult
@ -310,12 +312,13 @@ type CallFunctionOnReturns struct {
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}
// Do executes Runtime.callFunctionOn.
// Do executes Runtime.callFunctionOn against the provided context and
// target handler.
//
// returns:
// result - Call result.
// exceptionDetails - Exception details.
func (p *CallFunctionOnParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
func (p *CallFunctionOnParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -352,7 +355,7 @@ func (p *CallFunctionOnParams) Do(ctxt context.Context, h cdp.FrameHandler) (res
}
case <-ctxt.Done():
return nil, nil, cdp.ErrContextDone
return nil, nil, ctxt.Err()
}
return nil, nil, cdp.ErrUnknownResult
@ -405,13 +408,14 @@ type GetPropertiesReturns struct {
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}
// Do executes Runtime.getProperties.
// Do executes Runtime.getProperties against the provided context and
// target handler.
//
// returns:
// result - Object properties.
// internalProperties - Internal object properties (only of the element itself).
// exceptionDetails - Exception details.
func (p *GetPropertiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (result []*PropertyDescriptor, internalProperties []*InternalPropertyDescriptor, exceptionDetails *ExceptionDetails, err error) {
func (p *GetPropertiesParams) Do(ctxt context.Context, h cdp.Handler) (result []*PropertyDescriptor, internalProperties []*InternalPropertyDescriptor, exceptionDetails *ExceptionDetails, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -448,7 +452,7 @@ func (p *GetPropertiesParams) Do(ctxt context.Context, h cdp.FrameHandler) (resu
}
case <-ctxt.Done():
return nil, nil, nil, cdp.ErrContextDone
return nil, nil, nil, ctxt.Err()
}
return nil, nil, nil, cdp.ErrUnknownResult
@ -469,8 +473,9 @@ func ReleaseObject(objectID RemoteObjectID) *ReleaseObjectParams {
}
}
// Do executes Runtime.releaseObject.
func (p *ReleaseObjectParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Runtime.releaseObject against the provided context and
// target handler.
func (p *ReleaseObjectParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -500,7 +505,7 @@ func (p *ReleaseObjectParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -523,8 +528,9 @@ func ReleaseObjectGroup(objectGroup string) *ReleaseObjectGroupParams {
}
}
// Do executes Runtime.releaseObjectGroup.
func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Runtime.releaseObjectGroup against the provided context and
// target handler.
func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -554,7 +560,7 @@ func (p *ReleaseObjectGroupParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -570,8 +576,9 @@ func RunIfWaitingForDebugger() *RunIfWaitingForDebuggerParams {
return &RunIfWaitingForDebuggerParams{}
}
// Do executes Runtime.runIfWaitingForDebugger.
func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Runtime.runIfWaitingForDebugger against the provided context and
// target handler.
func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -595,7 +602,7 @@ func (p *RunIfWaitingForDebuggerParams) Do(ctxt context.Context, h cdp.FrameHand
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -613,8 +620,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Runtime.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Runtime.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -638,7 +646,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -652,8 +660,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Runtime.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Runtime.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -677,7 +686,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -692,8 +701,9 @@ func DiscardConsoleEntries() *DiscardConsoleEntriesParams {
return &DiscardConsoleEntriesParams{}
}
// Do executes Runtime.discardConsoleEntries.
func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Runtime.discardConsoleEntries against the provided context and
// target handler.
func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -717,7 +727,7 @@ func (p *DiscardConsoleEntriesParams) Do(ctxt context.Context, h cdp.FrameHandle
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -738,8 +748,9 @@ func SetCustomObjectFormatterEnabled(enabled bool) *SetCustomObjectFormatterEnab
}
}
// Do executes Runtime.setCustomObjectFormatterEnabled.
func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Runtime.setCustomObjectFormatterEnabled against the provided context and
// target handler.
func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -769,7 +780,7 @@ func (p *SetCustomObjectFormatterEnabledParams) Do(ctxt context.Context, h cdp.F
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -811,12 +822,13 @@ type CompileScriptReturns struct {
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}
// Do executes Runtime.compileScript.
// 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.FrameHandler) (scriptID ScriptID, exceptionDetails *ExceptionDetails, err error) {
func (p *CompileScriptParams) Do(ctxt context.Context, h cdp.Handler) (scriptID ScriptID, exceptionDetails *ExceptionDetails, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -853,7 +865,7 @@ func (p *CompileScriptParams) Do(ctxt context.Context, h cdp.FrameHandler) (scri
}
case <-ctxt.Done():
return "", nil, cdp.ErrContextDone
return "", nil, ctxt.Err()
}
return "", nil, cdp.ErrUnknownResult
@ -936,12 +948,13 @@ type RunScriptReturns struct {
ExceptionDetails *ExceptionDetails `json:"exceptionDetails,omitempty"` // Exception details.
}
// Do executes Runtime.runScript.
// Do executes Runtime.runScript against the provided context and
// target handler.
//
// returns:
// result - Run result.
// exceptionDetails - Exception details.
func (p *RunScriptParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
func (p *RunScriptParams) Do(ctxt context.Context, h cdp.Handler) (result *RemoteObject, exceptionDetails *ExceptionDetails, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -978,7 +991,7 @@ func (p *RunScriptParams) Do(ctxt context.Context, h cdp.FrameHandler) (result *
}
case <-ctxt.Done():
return nil, nil, cdp.ErrContextDone
return nil, nil, ctxt.Err()
}
return nil, nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package schema provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Schema domain.
// commands, types, and events for the Schema domain.
//
// Provides information about the protocol schema.
//
@ -28,11 +28,12 @@ type GetDomainsReturns struct {
Domains []*Domain `json:"domains,omitempty"` // List of supported domains.
}
// Do executes Schema.getDomains.
// Do executes Schema.getDomains against the provided context and
// target handler.
//
// returns:
// domains - List of supported domains.
func (p *GetDomainsParams) Do(ctxt context.Context, h cdp.FrameHandler) (domains []*Domain, err error) {
func (p *GetDomainsParams) Do(ctxt context.Context, h cdp.Handler) (domains []*Domain, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -63,7 +64,7 @@ func (p *GetDomainsParams) Do(ctxt context.Context, h cdp.FrameHandler) (domains
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package security provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Security domain.
// commands, types, and events for the Security domain.
//
// Security.
//
@ -23,8 +23,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Security.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Security.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -48,7 +49,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -62,8 +63,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Security.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Security.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -87,7 +89,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -102,8 +104,9 @@ func ShowCertificateViewer() *ShowCertificateViewerParams {
return &ShowCertificateViewerParams{}
}
// Do executes Security.showCertificateViewer.
func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Security.showCertificateViewer against the provided context and
// target handler.
func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -127,7 +130,7 @@ func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h cdp.FrameHandle
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package serviceworker provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome ServiceWorker domain.
// commands, types, and events for the ServiceWorker domain.
//
// Generated by the chromedp-gen command.
package serviceworker
@ -21,8 +21,9 @@ func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes ServiceWorker.enable.
func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -46,7 +47,7 @@ func (p *EnableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -60,8 +61,9 @@ func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes ServiceWorker.disable.
func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -85,7 +87,7 @@ func (p *DisableParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -106,8 +108,9 @@ func Unregister(scopeURL string) *UnregisterParams {
}
}
// Do executes ServiceWorker.unregister.
func (p *UnregisterParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.unregister against the provided context and
// target handler.
func (p *UnregisterParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -137,7 +140,7 @@ func (p *UnregisterParams) Do(ctxt context.Context, h cdp.FrameHandler) (err err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -158,8 +161,9 @@ func UpdateRegistration(scopeURL string) *UpdateRegistrationParams {
}
}
// Do executes ServiceWorker.updateRegistration.
func (p *UpdateRegistrationParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.updateRegistration against the provided context and
// target handler.
func (p *UpdateRegistrationParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -189,7 +193,7 @@ func (p *UpdateRegistrationParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -210,8 +214,9 @@ func StartWorker(scopeURL string) *StartWorkerParams {
}
}
// Do executes ServiceWorker.startWorker.
func (p *StartWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.startWorker against the provided context and
// target handler.
func (p *StartWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -241,7 +246,7 @@ func (p *StartWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err er
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -262,8 +267,9 @@ func SkipWaiting(scopeURL string) *SkipWaitingParams {
}
}
// Do executes ServiceWorker.skipWaiting.
func (p *SkipWaitingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.skipWaiting against the provided context and
// target handler.
func (p *SkipWaitingParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -293,7 +299,7 @@ func (p *SkipWaitingParams) Do(ctxt context.Context, h cdp.FrameHandler) (err er
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -314,8 +320,9 @@ func StopWorker(versionID string) *StopWorkerParams {
}
}
// Do executes ServiceWorker.stopWorker.
func (p *StopWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.stopWorker against the provided context and
// target handler.
func (p *StopWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -345,7 +352,7 @@ func (p *StopWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -366,8 +373,9 @@ func InspectWorker(versionID string) *InspectWorkerParams {
}
}
// Do executes ServiceWorker.inspectWorker.
func (p *InspectWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.inspectWorker against the provided context and
// target handler.
func (p *InspectWorkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -397,7 +405,7 @@ func (p *InspectWorkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -418,8 +426,9 @@ func SetForceUpdateOnPageLoad(forceUpdateOnPageLoad bool) *SetForceUpdateOnPageL
}
}
// Do executes ServiceWorker.setForceUpdateOnPageLoad.
func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.setForceUpdateOnPageLoad against the provided context and
// target handler.
func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -449,7 +458,7 @@ func (p *SetForceUpdateOnPageLoadParams) Do(ctxt context.Context, h cdp.FrameHan
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -476,8 +485,9 @@ func DeliverPushMessage(origin string, registrationID string, data string) *Deli
}
}
// Do executes ServiceWorker.deliverPushMessage.
func (p *DeliverPushMessageParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.deliverPushMessage against the provided context and
// target handler.
func (p *DeliverPushMessageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -507,7 +517,7 @@ func (p *DeliverPushMessageParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -537,8 +547,9 @@ func DispatchSyncEvent(origin string, registrationID string, tag string, lastCha
}
}
// Do executes ServiceWorker.dispatchSyncEvent.
func (p *DispatchSyncEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes ServiceWorker.dispatchSyncEvent against the provided context and
// target handler.
func (p *DispatchSyncEventParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -568,7 +579,7 @@ func (p *DispatchSyncEventParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package storage provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Storage domain.
// commands, types, and events for the Storage domain.
//
// Generated by the chromedp-gen command.
package storage
@ -31,8 +31,9 @@ func ClearDataForOrigin(origin string, storageTypes string) *ClearDataForOriginP
}
}
// Do executes Storage.clearDataForOrigin.
func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Storage.clearDataForOrigin against the provided context and
// target handler.
func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -62,7 +63,7 @@ func (p *ClearDataForOriginParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package systeminfo provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome SystemInfo domain.
// commands, types, and events for the SystemInfo domain.
//
// The SystemInfo domain defines methods and events for querying low-level
// system information.
@ -31,13 +31,14 @@ type GetInfoReturns struct {
ModelVersion string `json:"modelVersion,omitempty"` // A platform-dependent description of the version of the machine. On Mac OS, this is, for example, '10.1'. Will be the empty string if not supported.
}
// Do executes SystemInfo.getInfo.
// Do executes SystemInfo.getInfo against the provided context and
// target handler.
//
// returns:
// gpu - Information about the GPUs on the system.
// modelName - A platform-dependent description of the model of the machine. On Mac OS, this is, for example, 'MacBookPro'. Will be the empty string if not supported.
// modelVersion - A platform-dependent description of the version of the machine. On Mac OS, this is, for example, '10.1'. Will be the empty string if not supported.
func (p *GetInfoParams) Do(ctxt context.Context, h cdp.FrameHandler) (gpu *GPUInfo, modelName string, modelVersion string, err error) {
func (p *GetInfoParams) Do(ctxt context.Context, h cdp.Handler) (gpu *GPUInfo, modelName string, modelVersion string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -68,7 +69,7 @@ func (p *GetInfoParams) Do(ctxt context.Context, h cdp.FrameHandler) (gpu *GPUIn
}
case <-ctxt.Done():
return nil, "", "", cdp.ErrContextDone
return nil, "", "", ctxt.Err()
}
return nil, "", "", cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package target provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Target domain.
// commands, types, and events for the Target domain.
//
// Supports additional targets discovery and allows to attach to them.
//
@ -32,8 +32,9 @@ func SetDiscoverTargets(discover bool) *SetDiscoverTargetsParams {
}
}
// Do executes Target.setDiscoverTargets.
func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Target.setDiscoverTargets against the provided context and
// target handler.
func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -63,7 +64,7 @@ func (p *SetDiscoverTargetsParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -93,8 +94,9 @@ func SetAutoAttach(autoAttach bool, waitForDebuggerOnStart bool) *SetAutoAttachP
}
}
// Do executes Target.setAutoAttach.
func (p *SetAutoAttachParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Target.setAutoAttach against the provided context and
// target handler.
func (p *SetAutoAttachParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -124,7 +126,7 @@ func (p *SetAutoAttachParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -145,8 +147,9 @@ func SetAttachToFrames(value bool) *SetAttachToFramesParams {
}
}
// Do executes Target.setAttachToFrames.
func (p *SetAttachToFramesParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Target.setAttachToFrames against the provided context and
// target handler.
func (p *SetAttachToFramesParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -176,7 +179,7 @@ func (p *SetAttachToFramesParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -199,8 +202,9 @@ func SetRemoteLocations(locations []*RemoteLocation) *SetRemoteLocationsParams {
}
}
// Do executes Target.setRemoteLocations.
func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Target.setRemoteLocations against the provided context and
// target handler.
func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -230,7 +234,7 @@ func (p *SetRemoteLocationsParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -255,8 +259,9 @@ func SendMessageToTarget(targetID string, message string) *SendMessageToTargetPa
}
}
// Do executes Target.sendMessageToTarget.
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Target.sendMessageToTarget against the provided context and
// target handler.
func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -286,7 +291,7 @@ func (p *SendMessageToTargetParams) Do(ctxt context.Context, h cdp.FrameHandler)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -312,11 +317,12 @@ type GetTargetInfoReturns struct {
TargetInfo *Info `json:"targetInfo,omitempty"`
}
// Do executes Target.getTargetInfo.
// Do executes Target.getTargetInfo against the provided context and
// target handler.
//
// returns:
// targetInfo
func (p *GetTargetInfoParams) Do(ctxt context.Context, h cdp.FrameHandler) (targetInfo *Info, err error) {
func (p *GetTargetInfoParams) Do(ctxt context.Context, h cdp.Handler) (targetInfo *Info, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -353,7 +359,7 @@ func (p *GetTargetInfoParams) Do(ctxt context.Context, h cdp.FrameHandler) (targ
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -374,8 +380,9 @@ func ActivateTarget(targetID ID) *ActivateTargetParams {
}
}
// Do executes Target.activateTarget.
func (p *ActivateTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Target.activateTarget against the provided context and
// target handler.
func (p *ActivateTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -405,7 +412,7 @@ func (p *ActivateTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (err
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -433,11 +440,12 @@ type CloseTargetReturns struct {
Success bool `json:"success,omitempty"`
}
// Do executes Target.closeTarget.
// Do executes Target.closeTarget against the provided context and
// target handler.
//
// returns:
// success
func (p *CloseTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (success bool, err error) {
func (p *CloseTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -474,7 +482,7 @@ func (p *CloseTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (succes
}
case <-ctxt.Done():
return false, cdp.ErrContextDone
return false, ctxt.Err()
}
return false, cdp.ErrUnknownResult
@ -500,11 +508,12 @@ type AttachToTargetReturns struct {
Success bool `json:"success,omitempty"` // Whether attach succeeded.
}
// Do executes Target.attachToTarget.
// Do executes Target.attachToTarget against the provided context and
// target handler.
//
// returns:
// success - Whether attach succeeded.
func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (success bool, err error) {
func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -541,7 +550,7 @@ func (p *AttachToTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (suc
}
case <-ctxt.Done():
return false, cdp.ErrContextDone
return false, ctxt.Err()
}
return false, cdp.ErrUnknownResult
@ -562,8 +571,9 @@ func DetachFromTarget(targetID ID) *DetachFromTargetParams {
}
}
// Do executes Target.detachFromTarget.
func (p *DetachFromTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Target.detachFromTarget against the provided context and
// target handler.
func (p *DetachFromTargetParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -593,7 +603,7 @@ func (p *DetachFromTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (e
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -614,11 +624,12 @@ type CreateBrowserContextReturns struct {
BrowserContextID BrowserContextID `json:"browserContextId,omitempty"` // The id of the context created.
}
// Do executes Target.createBrowserContext.
// Do executes Target.createBrowserContext against the provided context and
// target handler.
//
// returns:
// browserContextID - The id of the context created.
func (p *CreateBrowserContextParams) Do(ctxt context.Context, h cdp.FrameHandler) (browserContextID BrowserContextID, err error) {
func (p *CreateBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (browserContextID BrowserContextID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -649,7 +660,7 @@ func (p *CreateBrowserContextParams) Do(ctxt context.Context, h cdp.FrameHandler
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -677,11 +688,12 @@ type DisposeBrowserContextReturns struct {
Success bool `json:"success,omitempty"`
}
// Do executes Target.disposeBrowserContext.
// Do executes Target.disposeBrowserContext against the provided context and
// target handler.
//
// returns:
// success
func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h cdp.FrameHandler) (success bool, err error) {
func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h cdp.Handler) (success bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -718,7 +730,7 @@ func (p *DisposeBrowserContextParams) Do(ctxt context.Context, h cdp.FrameHandle
}
case <-ctxt.Done():
return false, cdp.ErrContextDone
return false, ctxt.Err()
}
return false, cdp.ErrUnknownResult
@ -766,11 +778,12 @@ type CreateTargetReturns struct {
TargetID ID `json:"targetId,omitempty"` // The id of the page opened.
}
// Do executes Target.createTarget.
// Do executes Target.createTarget against the provided context and
// target handler.
//
// returns:
// targetID - The id of the page opened.
func (p *CreateTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (targetID ID, err error) {
func (p *CreateTargetParams) Do(ctxt context.Context, h cdp.Handler) (targetID ID, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -807,7 +820,7 @@ func (p *CreateTargetParams) Do(ctxt context.Context, h cdp.FrameHandler) (targe
}
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
}
return "", cdp.ErrUnknownResult
@ -826,11 +839,12 @@ type GetTargetsReturns struct {
TargetInfos []*Info `json:"targetInfos,omitempty"` // The list of targets.
}
// Do executes Target.getTargets.
// Do executes Target.getTargets against the provided context and
// target handler.
//
// returns:
// targetInfos - The list of targets.
func (p *GetTargetsParams) Do(ctxt context.Context, h cdp.FrameHandler) (targetInfos []*Info, err error) {
func (p *GetTargetsParams) Do(ctxt context.Context, h cdp.Handler) (targetInfos []*Info, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -861,7 +875,7 @@ func (p *GetTargetsParams) Do(ctxt context.Context, h cdp.FrameHandler) (targetI
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package tethering provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Tethering domain.
// commands, types, and events for the Tethering domain.
//
// The Tethering domain defines methods and events for browser port binding.
//
@ -30,8 +30,9 @@ func Bind(port int64) *BindParams {
}
}
// Do executes Tethering.bind.
func (p *BindParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Tethering.bind against the provided context and
// target handler.
func (p *BindParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -61,7 +62,7 @@ func (p *BindParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -82,8 +83,9 @@ func Unbind(port int64) *UnbindParams {
}
}
// Do executes Tethering.unbind.
func (p *UnbindParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Tethering.unbind against the provided context and
// target handler.
func (p *UnbindParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -113,7 +115,7 @@ func (p *UnbindParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error)
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,5 +1,5 @@
// Package tracing provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Tracing domain.
// commands, types, and events for the Tracing domain.
//
// Generated by the chromedp-gen command.
package tracing
@ -47,8 +47,9 @@ func (p StartParams) WithTraceConfig(traceConfig *TraceConfig) *StartParams {
return &p
}
// Do executes Tracing.start.
func (p *StartParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Tracing.start against the provided context and
// target handler.
func (p *StartParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -78,7 +79,7 @@ func (p *StartParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -92,8 +93,9 @@ func End() *EndParams {
return &EndParams{}
}
// Do executes Tracing.end.
func (p *EndParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Tracing.end against the provided context and
// target handler.
func (p *EndParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -117,7 +119,7 @@ func (p *EndParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult
@ -136,11 +138,12 @@ type GetCategoriesReturns struct {
Categories []string `json:"categories,omitempty"` // A list of supported tracing categories.
}
// Do executes Tracing.getCategories.
// Do executes Tracing.getCategories against the provided context and
// target handler.
//
// returns:
// categories - A list of supported tracing categories.
func (p *GetCategoriesParams) Do(ctxt context.Context, h cdp.FrameHandler) (categories []string, err error) {
func (p *GetCategoriesParams) Do(ctxt context.Context, h cdp.Handler) (categories []string, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -171,7 +174,7 @@ func (p *GetCategoriesParams) Do(ctxt context.Context, h cdp.FrameHandler) (cate
}
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
}
return nil, cdp.ErrUnknownResult
@ -191,12 +194,13 @@ type RequestMemoryDumpReturns struct {
Success bool `json:"success,omitempty"` // True iff the global memory dump succeeded.
}
// Do executes Tracing.requestMemoryDump.
// Do executes Tracing.requestMemoryDump against the provided context and
// target handler.
//
// returns:
// dumpGUID - GUID of the resulting global memory dump.
// success - True iff the global memory dump succeeded.
func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h cdp.FrameHandler) (dumpGUID string, success bool, err error) {
func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h cdp.Handler) (dumpGUID string, success bool, err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -227,7 +231,7 @@ func (p *RequestMemoryDumpParams) Do(ctxt context.Context, h cdp.FrameHandler) (
}
case <-ctxt.Done():
return "", false, cdp.ErrContextDone
return "", false, ctxt.Err()
}
return "", false, cdp.ErrUnknownResult
@ -248,8 +252,9 @@ func RecordClockSyncMarker(syncID string) *RecordClockSyncMarkerParams {
}
}
// Do executes Tracing.recordClockSyncMarker.
func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
// Do executes Tracing.recordClockSyncMarker against the provided context and
// target handler.
func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
@ -279,7 +284,7 @@ func (p *RecordClockSyncMarkerParams) Do(ctxt context.Context, h cdp.FrameHandle
}
case <-ctxt.Done():
return cdp.ErrContextDone
return ctxt.Err()
}
return cdp.ErrUnknownResult

View File

@ -1,8 +1,3 @@
// Package chromedp is a high level Chrome Debugging Protocol domain manager
// that simplifies driving web browsers (Chrome, Safari, Edge, Android Web
// Views, and others) for scraping, unit testing, or profiling web pages.
// chromedp requires no third-party dependencies (ie, Selenium), implementing
// the async Chrome Debugging Protocol natively.
package chromedp
import (
@ -18,17 +13,8 @@ import (
"github.com/knq/chromedp/runner"
)
const (
// DefaultNewTargetTimeout is the default time to wait for a new target to
// be started.
DefaultNewTargetTimeout = 3 * time.Second
// DefaultCheckDuration is the default time to sleep between a check.
DefaultCheckDuration = 50 * time.Millisecond
)
// CDP contains information for managing a Chrome process runner, low level
// client and associated target page handlers.
// JSON and websocket client, and associated network, page, and DOM handling.
type CDP struct {
// r is the chrome runner.
r *runner.Runner
@ -40,10 +26,10 @@ type CDP struct {
watch <-chan client.Target
// cur is the current active target's handler.
cur cdp.FrameHandler
cur cdp.Handler
// handlers is the active handlers.
handlers []cdp.FrameHandler
handlers []*TargetHandler
// handlerMap is the map of target IDs to its active handler.
handlerMap map[string]int
@ -51,12 +37,12 @@ type CDP struct {
sync.RWMutex
}
// New creates a new Chrome Debugging Protocol client.
// New creates and starts a new CDP instance.
func New(ctxt context.Context, opts ...Option) (*CDP, error) {
var err error
c := &CDP{
handlers: make([]cdp.FrameHandler, 0),
handlers: make([]*TargetHandler, 0),
handlerMap: make(map[string]int),
}
@ -102,10 +88,11 @@ loop:
return c, nil
}
// TODO: fix this
time.Sleep(DefaultCheckDuration)
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
case <-timeout:
break loop
@ -179,7 +166,7 @@ func (c *CDP) ListTargets() []string {
}
// GetHandlerByIndex retrieves the domains manager for the specified index.
func (c *CDP) GetHandlerByIndex(i int) cdp.FrameHandler {
func (c *CDP) GetHandlerByIndex(i int) cdp.Handler {
c.RLock()
defer c.RUnlock()
@ -191,7 +178,7 @@ func (c *CDP) GetHandlerByIndex(i int) cdp.FrameHandler {
}
// GetHandlerByID retrieves the domains manager for the specified target ID.
func (c *CDP) GetHandlerByID(id string) cdp.FrameHandler {
func (c *CDP) GetHandlerByID(id string) cdp.Handler {
c.RLock()
defer c.RUnlock()
@ -202,7 +189,7 @@ func (c *CDP) GetHandlerByID(id string) cdp.FrameHandler {
return nil
}
// SetHandler sets the active target to the target with the specified index.
// SetHandler sets the active handler to the target with the specified index.
func (c *CDP) SetHandler(i int) error {
c.Lock()
defer c.Unlock()
@ -260,7 +247,7 @@ loop:
time.Sleep(DefaultCheckDuration)
case <-ctxt.Done():
return "", cdp.ErrContextDone
return "", ctxt.Err()
case <-timeout:
break loop
@ -273,7 +260,7 @@ loop:
// SetTarget is an action that sets the active Chrome handler to the specified
// index i.
func (c *CDP) SetTarget(i int) Action {
return ActionFunc(func(context.Context, cdp.FrameHandler) error {
return ActionFunc(func(context.Context, cdp.Handler) error {
return c.SetHandler(i)
})
}
@ -281,7 +268,7 @@ func (c *CDP) SetTarget(i int) Action {
// SetTargetByID is an action that sets the active Chrome handler to the handler
// associated with the specified id.
func (c *CDP) SetTargetByID(id string) Action {
return ActionFunc(func(context.Context, cdp.FrameHandler) error {
return ActionFunc(func(context.Context, cdp.Handler) error {
return c.SetHandlerByID(id)
})
}
@ -289,7 +276,7 @@ func (c *CDP) SetTargetByID(id string) Action {
// NewTarget is an action that creates a new Chrome target, and sets it as the
// active target.
func (c *CDP) NewTarget(id *string, opts ...client.Option) Action {
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
n, err := c.newTarget(ctxt, opts...)
if err != nil {
return err
@ -306,7 +293,7 @@ func (c *CDP) NewTarget(id *string, opts ...client.Option) Action {
// NewTargetWithURL creates a new Chrome target, sets it as the active target,
// and then navigates to the specified url.
//func (c *CDP) NewTargetWithURL(urlstr string, id *string, opts ...client.Option) Action {
// return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
// return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
// n, err := c.newTarget(ctxt, opts...)
// if err != nil {
// return err
@ -332,14 +319,14 @@ func (c *CDP) NewTarget(id *string, opts ...client.Option) Action {
// CloseByIndex closes the Chrome target with specified index i.
func (c *CDP) CloseByIndex(i int) Action {
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
return nil
})
}
// CloseByID closes the Chrome target with the specified id.
func (c *CDP) CloseByID(id string) Action {
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
return nil
})
}

View File

@ -59,3 +59,13 @@ func TestNavigate(t *testing.T) {
t.Errorf("expected to be on google, got: %v", urlstr)
}
}
func TestSendKeys(t *testing.T) {
var err error
c, err := pool.Allocate(defaultContext)
if err != nil {
t.Fatal(err)
}
defer c.Release()
}

View File

@ -1,3 +1,34 @@
// Package fixup modifies/alters/fixes and adds to the low level type
// definitions for the Chrome Debugging Protocol domains, as generated from
// protocol.json.
//
// The goal of package fixup is to fix the issues associated with generating Go
// code from the existing Chrome domain definitions, and is wrapped up in one
// high-level func, FixDomains.
//
// Currently, FixDomains will do the following:
// - add 'Inspector.MethodType' type as a string enumeration of all the event/command names.
// - add 'Inspector.MessageError' type as a object with code (integer), and message (string).
// - add 'Inspector.Message' type as a object with id (integer), method (MethodType), params (interface{}), error (MessageError).
// - add 'Inspector.DetachReason' type and change event 'Inspector.detached''s parameter reason's type.
// - add 'Inspector.ErrorType' type.
// - change 'Runtime.Timestamp' to 'Network.Timestamp'.
// - change any object property or command/event parameter named 'timestamp'
// or has $ref to Network/Runtime.Timestamp to type 'Network.Timestamp'.
// - convert object properties and event/command parameters that are enums into independent types.
// - change '*.modifiers' parameters to type Input.Modifier.
// - add 'DOM.NodeType' type and convert "nodeType" parameters to it.
// - change Page.Frame.id/parentID to FrameID type.
// - add additional properties to 'Page.Frame' and 'DOM.Node' for use by higher level packages.
// - add special unmarshaler to NodeId, BackendNodeId, FrameId to handle values from older (v1.1) protocol versions. -- NOTE: this might need to be applied to more types, such as network.LoaderId
// - rename 'Input.GestureSourceType' -> 'Input.GestureType'.
// - rename CSS.CSS* types.
// - add Error() method to 'Runtime.ExceptionDetails' type so that it can be used as error.
//
// Please note that the above is not an exhaustive list of all modifications
// applied to the domains, however it does attempt to give a comprehensive
// overview of the most important changes to the definition vs the vanilla
// specification.
package fixup
import (
@ -38,34 +69,22 @@ func setup() {
internal.SetCDPTypes(types)
}
// if the internal type locations change above, these will also need to change:
// Specific type names to use for the applied fixes to the protocol domains.
//
// These need to be here in case the location of these types change (see above)
// relative to the generated 'cdp' package.
const (
domNodeIDRef = "NodeID"
domNodeRef = "*Node"
)
// FixupDomains changes types in the domains, so that the generated code is
// more type specific, and easier to use.
// FixDomains modifies, updates, alters, fixes, and adds to the types defined
// in the domains, so that the generated Chrome Debugging Protocol domain code
// is more Go-like and easier to use.
//
// currently:
// - add 'Inspector.MethodType' type as a string enumeration of all the event/command names.
// - add 'Inspector.MessageError' type as a object with code (integer), and message (string).
// - add 'Inspector.Message' type as a object with id (integer), method (MethodType), params (interface{}), error (MessageError).
// - add 'Inspector.DetachReason' type and change event 'Inspector.detached''s parameter reason's type.
// - add 'Inspector.ErrorType' type.
// - change 'Runtime.Timestamp' to 'Network.Timestamp'.
// - change any object property or command/event parameter named 'timestamp'
// or has $ref to Network/Runtime.Timestamp to type 'Network.Timestamp'.
// - convert object properties and event/command parameters that are enums into independent types.
// - change '*.modifiers' parameters to type Input.Modifier.
// - add 'DOM.NodeType' type and convert "nodeType" parameters to it.
// - change Page.Frame.id/parentID to FrameID type.
// - add additional properties to 'Page.Frame' and 'DOM.Node' for use by higher level packages.
// - add special unmarshaler to NodeId, BackendNodeId, FrameId to handle values from older (v1.1) protocol versions. -- NOTE: this might need to be applied to more types, such as network.LoaderId
// - rename 'Input.GestureSourceType' -> 'Input.GestureType'.
// - rename CSS.CSS* types.
// - add Error() method to 'Runtime.ExceptionDetails' type so that it can be used as error.
func FixupDomains(domains []*internal.Domain) {
// Please see package-level documentation for the list of changes made to the
// various debugging protocol domains.
func FixDomains(domains []*internal.Domain) {
// set up the internal types
setup()
@ -141,7 +160,7 @@ func FixupDomains(domains []*internal.Domain) {
}
// cdp error types
errorValues := []string{"context done", "channel closed", "invalid result", "unknown result"}
errorValues := []string{"channel closed", "invalid result", "unknown result"}
errorValueNameMap := make(map[string]string)
for _, e := range errorValues {
errorValueNameMap[e] = "Err" + internal.ForceCamel(e)

View File

@ -1,3 +1,5 @@
// Package gen takes the Chrome protocol domain definitions and applies the
// necessary code generation templates.
package gen
import (
@ -15,7 +17,8 @@ import (
type fileBuffers map[string]*bytes.Buffer
// GenerateDomains generates domains for the Chrome Debugging Protocol domain
// definitions, returning generated file buffers.
// definitions, returning a set of file buffers as a map of the file name ->
// content.
func GenerateDomains(domains []*internal.Domain) map[string]*bytes.Buffer {
fb := make(fileBuffers)
@ -66,14 +69,15 @@ func GenerateDomains(domains []*internal.Domain) map[string]*bytes.Buffer {
// generateCDPTypes generates the internal types for domain d.
//
// because there are circular package dependencies, some types need to be moved
// to the shared internal package.
// Because there are circular package dependencies, some types need to be moved
// to eliminate the circular dependencies. Please see the fixup package for a
// list of the "internal" CDP types.
func (fb fileBuffers) generateCDPTypes(domains []*internal.Domain) {
var types []*internal.Type
for _, d := range domains {
// process internal types
for _, t := range d.Types {
if internal.IsCDPType(d.Domain, t.IdOrName()) {
if internal.IsCDPType(d.Domain, t.IDorName()) {
types = append(types, t)
}
}
@ -95,10 +99,10 @@ func (fb fileBuffers) generateCDPTypes(domains []*internal.Domain) {
// generateUtilPackage generates the util package.
//
// currently only contains the message unmarshaler: if this wasn't in a
// separate package, there would be circular dependencies.
// Currently only contains the low-level message unmarshaler -- if this wasn't
// in a separate package, then there would be circular dependencies.
func (fb fileBuffers) generateUtilPackage(domains []*internal.Domain) {
// generate imports
// generate import map data
importMap := map[string]string{
*internal.FlagPkg: "cdp",
}
@ -112,7 +116,7 @@ func (fb fileBuffers) generateUtilPackage(domains []*internal.Domain) {
fb.release(w)
}
// generateTypes generates the types.
// generateTypes generates the types for a domain.
func (fb fileBuffers) generateTypes(
path string,
types []*internal.Type, prefix, suffix string, d *internal.Domain, domains []*internal.Domain,
@ -126,7 +130,7 @@ func (fb fileBuffers) generateTypes(
// process type list
var names []string
for _, t := range types {
if internal.IsCDPType(d.Domain, t.IdOrName()) {
if internal.IsCDPType(d.Domain, t.IDorName()) {
continue
}
templates.StreamTypeTemplate(w, t, prefix, suffix, d, domains, nil, false, false)

View File

@ -1,3 +1,5 @@
// Package internal contains the types and util funcs common to the
// chromedp-gen command.
package internal
import (
@ -198,8 +200,8 @@ func (t *Type) ResolveType(d *Domain, domains []*Domain) (DomainType, *Type, str
return d.Domain, t, t.Type.GoType()
}
// IdOrName returns either the ID or the Name for the type.
func (t Type) IdOrName() string {
// IDorName returns either the ID or the Name for the type.
func (t Type) IDorName() string {
if t.ID != "" {
return t.ID
}
@ -214,7 +216,7 @@ func (t Type) String() string {
desc = " - " + desc
}
return ForceCamelWithFirstLower(t.IdOrName()) + desc
return ForceCamelWithFirstLower(t.IDorName()) + desc
}
// GetDescription returns the cleaned description for the type.
@ -241,7 +243,7 @@ func (t *Type) GoName(noExposeOverride bool) string {
return n
}
return ForceCamel(t.IdOrName())
return ForceCamel(t.IDorName())
}
// EnumValueName returns the name for a enum value.
@ -258,7 +260,7 @@ func (t *Type) EnumValueName(v string) string {
neg = "Negative"
}
return ForceCamel(t.IdOrName()) + neg + ForceCamel(v)
return ForceCamel(t.IDorName()) + neg + ForceCamel(v)
}
// GoTypeDef returns the Go type definition for the type.
@ -398,7 +400,7 @@ func (t *Type) Base64EncodedRetParam() *Type {
// CamelName returns the CamelCase name of the type.
func (t *Type) CamelName() string {
return ForceCamel(t.IdOrName())
return ForceCamel(t.IDorName())
}
// ProtoName returns the protocol name of the type.

View File

@ -154,7 +154,7 @@ func CDPTypeList() []string {
return types
}
// goReservedNames is the list of reserved names.
// goReservedNames is the list of reserved names in Go.
var goReservedNames = map[string]bool{
// language words
"break": true,

View File

@ -1,3 +1,7 @@
// chromedp-gen is a tool to generate the low-level Chrome Debugging Protocol
// implementation types used by chromedp, based off Chrome's protocol.json.
//
// Please see README.md for more information on using this tool.
package main
//go:generate qtc -dir templates -ext qtpl
@ -81,7 +85,7 @@ func main() {
}
// fixup
fixup.FixupDomains(processed)
fixup.FixDomains(processed)
// generate
files := gen.GenerateDomains(processed)
@ -115,7 +119,7 @@ func cleanupTypes(n string, dtyp string, types []*internal.Type) []*internal.Typ
var ret []*internal.Type
for _, t := range types {
typ := dtyp + "." + t.IdOrName()
typ := dtyp + "." + t.IDorName()
if !*internal.FlagDep && t.Deprecated.Bool() {
log.Printf("skipping %s %s [deprecated]", n, typ)
continue

View File

@ -7179,6 +7179,12 @@
"$ref": "Runtime.RemoteObject",
"optional": true,
"description": "Event listener remove function."
},
{
"name": "backendNodeId",
"$ref": "DOM.BackendNodeId",
"optional": true,
"description": "Node the listener is added to (if any)."
}
],
"experimental": true
@ -7307,6 +7313,20 @@
"name": "objectId",
"$ref": "Runtime.RemoteObjectId",
"description": "Identifier of the object to return listeners for."
},
{
"name": "depth",
"type": "integer",
"optional": true,
"description": "The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.",
"experimental": true
},
{
"name": "pierce",
"type": "boolean",
"optional": true,
"description": "Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). Reports listeners for all contexts if pierce is enabled.",
"experimental": true
}
],
"returns": [

View File

@ -93,7 +93,8 @@ func (p {%s= typ %}) {%s= optName %}({%s= v %} {%s= t.GoType(d, domains) %}) *{%
b64ret := c.Base64EncodedRetParam()
// determine if there's a conditional return value with it
// determine if there's a conditional that indicates whether or not the
// returned value is b64 encoded.
b64cond := false
for _, p := range c.Returns {
if p.Name == internal.Base64EncodedParamName {
@ -102,11 +103,12 @@ func (p {%s= typ %}) {%s= optName %}({%s= v %} {%s= t.GoType(d, domains) %}) *{%
}
}
%}
// Do executes {%s= c.ProtoName(d) %}.{% if len(c.Returns) > 0 %}
// Do executes {%s= c.ProtoName(d) %} against the provided context and
// target handler.{% if len(c.Returns) > 0 %}
//
// returns:{% for _, p := range c.Returns %}{% if p.Name == internal.Base64EncodedParamName %}{% continue %}{% end %}
// {%s= p.String() %}{% endfor %}{% endif %}
func (p *{%s= typ %}) Do(ctxt context.Context, h cdp.FrameHandler) ({%s= retTypeList %}err error) {
func (p *{%s= typ %}) Do(ctxt context.Context, h cdp.Handler) ({%s= retTypeList %}err error) {
if ctxt == nil {
ctxt = context.Background()
}{% if !hasEmptyParams %}
@ -154,7 +156,7 @@ func (p *{%s= typ %}) Do(ctxt context.Context, h cdp.FrameHandler) ({%s= retType
}
case <-ctxt.Done():
return {%s= emptyRet %}cdp.ErrContextDone
return {%s= emptyRet %}ctxt.Err()
}
return {%s= emptyRet %}cdp.ErrUnknownResult

View File

@ -431,7 +431,8 @@ func StreamCommandDoFuncTemplate(qw422016 *qt422016.Writer, c *internal.Type, d
b64ret := c.Base64EncodedRetParam()
// determine if there's a conditional return value with it
// determine if there's a conditional that indicates whether or not the
// returned value is b64 encoded.
b64cond := false
for _, p := range c.Returns {
if p.Name == internal.Base64EncodedParamName {
@ -440,86 +441,87 @@ func StreamCommandDoFuncTemplate(qw422016 *qt422016.Writer, c *internal.Type, d
}
}
//line templates/domain.qtpl:104
//line templates/domain.qtpl:105
qw422016.N().S(`
// Do executes `)
//line templates/domain.qtpl:105
//line templates/domain.qtpl:106
qw422016.N().S(c.ProtoName(d))
//line templates/domain.qtpl:105
qw422016.N().S(`.`)
//line templates/domain.qtpl:105
//line templates/domain.qtpl:106
qw422016.N().S(` against the provided context and
// target handler.`)
//line templates/domain.qtpl:107
if len(c.Returns) > 0 {
//line templates/domain.qtpl:105
//line templates/domain.qtpl:107
qw422016.N().S(`
//
// returns:`)
//line templates/domain.qtpl:107
//line templates/domain.qtpl:109
for _, p := range c.Returns {
//line templates/domain.qtpl:107
//line templates/domain.qtpl:109
if p.Name == internal.Base64EncodedParamName {
//line templates/domain.qtpl:107
//line templates/domain.qtpl:109
continue
//line templates/domain.qtpl:107
//line templates/domain.qtpl:109
}
//line templates/domain.qtpl:107
//line templates/domain.qtpl:109
qw422016.N().S(`
// `)
//line templates/domain.qtpl:108
//line templates/domain.qtpl:110
qw422016.N().S(p.String())
//line templates/domain.qtpl:108
//line templates/domain.qtpl:110
}
//line templates/domain.qtpl:108
//line templates/domain.qtpl:110
}
//line templates/domain.qtpl:108
//line templates/domain.qtpl:110
qw422016.N().S(`
func (p *`)
//line templates/domain.qtpl:109
//line templates/domain.qtpl:111
qw422016.N().S(typ)
//line templates/domain.qtpl:109
qw422016.N().S(`) Do(ctxt context.Context, h cdp.FrameHandler) (`)
//line templates/domain.qtpl:109
//line templates/domain.qtpl:111
qw422016.N().S(`) Do(ctxt context.Context, h cdp.Handler) (`)
//line templates/domain.qtpl:111
qw422016.N().S(retTypeList)
//line templates/domain.qtpl:109
//line templates/domain.qtpl:111
qw422016.N().S(`err error) {
if ctxt == nil {
ctxt = context.Background()
}`)
//line templates/domain.qtpl:112
//line templates/domain.qtpl:114
if !hasEmptyParams {
//line templates/domain.qtpl:112
//line templates/domain.qtpl:114
qw422016.N().S(`
// marshal
buf, err := easyjson.Marshal(p)
if err != nil {
return `)
//line templates/domain.qtpl:117
//line templates/domain.qtpl:119
qw422016.N().S(emptyRet)
//line templates/domain.qtpl:117
//line templates/domain.qtpl:119
qw422016.N().S(`err
}`)
//line templates/domain.qtpl:118
//line templates/domain.qtpl:120
}
//line templates/domain.qtpl:118
//line templates/domain.qtpl:120
qw422016.N().S(`
// execute
ch := h.Execute(ctxt, cdp.`)
//line templates/domain.qtpl:121
//line templates/domain.qtpl:123
qw422016.N().S(c.CommandMethodType(d))
//line templates/domain.qtpl:121
//line templates/domain.qtpl:123
qw422016.N().S(`, `)
//line templates/domain.qtpl:121
//line templates/domain.qtpl:123
if hasEmptyParams {
//line templates/domain.qtpl:121
//line templates/domain.qtpl:123
qw422016.N().S(`cdp.Empty`)
//line templates/domain.qtpl:121
//line templates/domain.qtpl:123
} else {
//line templates/domain.qtpl:121
//line templates/domain.qtpl:123
qw422016.N().S(`easyjson.RawMessage(buf)`)
//line templates/domain.qtpl:121
//line templates/domain.qtpl:123
}
//line templates/domain.qtpl:121
//line templates/domain.qtpl:123
qw422016.N().S(`)
// read response
@ -527,132 +529,132 @@ func (p *`)
case res := <-ch:
if res == nil {
return `)
//line templates/domain.qtpl:127
//line templates/domain.qtpl:129
qw422016.N().S(emptyRet)
//line templates/domain.qtpl:127
//line templates/domain.qtpl:129
qw422016.N().S(`cdp.ErrChannelClosed
}
switch v := res.(type) {
case easyjson.RawMessage:`)
//line templates/domain.qtpl:131
//line templates/domain.qtpl:133
if !hasEmptyRet {
//line templates/domain.qtpl:131
//line templates/domain.qtpl:133
qw422016.N().S(`
// unmarshal
var r `)
//line templates/domain.qtpl:133
//line templates/domain.qtpl:135
qw422016.N().S(c.CommandReturnsType())
//line templates/domain.qtpl:133
//line templates/domain.qtpl:135
qw422016.N().S(`
err = easyjson.Unmarshal(v, &r)
if err != nil {
return `)
//line templates/domain.qtpl:136
//line templates/domain.qtpl:138
qw422016.N().S(emptyRet)
//line templates/domain.qtpl:136
//line templates/domain.qtpl:138
qw422016.N().S(`cdp.ErrInvalidResult
}`)
//line templates/domain.qtpl:137
//line templates/domain.qtpl:139
if b64ret != nil {
//line templates/domain.qtpl:137
//line templates/domain.qtpl:139
qw422016.N().S(`
// decode
var dec []byte`)
//line templates/domain.qtpl:140
//line templates/domain.qtpl:142
if b64cond {
//line templates/domain.qtpl:140
//line templates/domain.qtpl:142
qw422016.N().S(`
if r.Base64encoded {`)
//line templates/domain.qtpl:141
//line templates/domain.qtpl:143
}
//line templates/domain.qtpl:141
//line templates/domain.qtpl:143
qw422016.N().S(`
dec, err = base64.StdEncoding.DecodeString(r.`)
//line templates/domain.qtpl:142
//line templates/domain.qtpl:144
qw422016.N().S(b64ret.GoName(false))
//line templates/domain.qtpl:142
//line templates/domain.qtpl:144
qw422016.N().S(`)
if err != nil {
return nil, err
}`)
//line templates/domain.qtpl:145
//line templates/domain.qtpl:147
if b64cond {
//line templates/domain.qtpl:145
//line templates/domain.qtpl:147
qw422016.N().S(`
} else {
dec = []byte(r.`)
//line templates/domain.qtpl:147
//line templates/domain.qtpl:149
qw422016.N().S(b64ret.GoName(false))
//line templates/domain.qtpl:147
//line templates/domain.qtpl:149
qw422016.N().S(`)
}`)
//line templates/domain.qtpl:148
//line templates/domain.qtpl:150
}
//line templates/domain.qtpl:148
//line templates/domain.qtpl:150
}
//line templates/domain.qtpl:148
//line templates/domain.qtpl:150
qw422016.N().S(`
`)
//line templates/domain.qtpl:149
//line templates/domain.qtpl:151
}
//line templates/domain.qtpl:149
//line templates/domain.qtpl:151
qw422016.N().S(`
return `)
//line templates/domain.qtpl:150
//line templates/domain.qtpl:152
qw422016.N().S(retValueList)
//line templates/domain.qtpl:150
//line templates/domain.qtpl:152
qw422016.N().S(`nil
case error:
return `)
//line templates/domain.qtpl:153
//line templates/domain.qtpl:155
qw422016.N().S(emptyRet)
//line templates/domain.qtpl:153
//line templates/domain.qtpl:155
qw422016.N().S(`v
}
case <-ctxt.Done():
return `)
//line templates/domain.qtpl:157
//line templates/domain.qtpl:159
qw422016.N().S(emptyRet)
//line templates/domain.qtpl:157
qw422016.N().S(`cdp.ErrContextDone
//line templates/domain.qtpl:159
qw422016.N().S(`ctxt.Err()
}
return `)
//line templates/domain.qtpl:160
//line templates/domain.qtpl:162
qw422016.N().S(emptyRet)
//line templates/domain.qtpl:160
//line templates/domain.qtpl:162
qw422016.N().S(`cdp.ErrUnknownResult
}
`)
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
}
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
func WriteCommandDoFuncTemplate(qq422016 qtio422016.Writer, c *internal.Type, d *internal.Domain, domains []*internal.Domain) {
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
StreamCommandDoFuncTemplate(qw422016, c, d, domains)
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
qt422016.ReleaseWriter(qw422016)
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
}
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
func CommandDoFuncTemplate(c *internal.Type, d *internal.Domain, domains []*internal.Domain) string {
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
qb422016 := qt422016.AcquireByteBuffer()
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
WriteCommandDoFuncTemplate(qb422016, c, d, domains)
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
qs422016 := string(qb422016.B)
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
qt422016.ReleaseByteBuffer(qb422016)
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
return qs422016
//line templates/domain.qtpl:162
//line templates/domain.qtpl:164
}

View File

@ -5,7 +5,7 @@
// ExtraTimestampTemplate is a special template for the Timestamp type that
// defines its JSON unmarshaling.
{% func ExtraTimestampTemplate(t *internal.Type, d *internal.Domain) %}{%code
typ := t.IdOrName()
typ := t.IDorName()
%}
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t {%s= typ %}) MarshalEasyJSON(out *jwriter.Writer) {
@ -215,17 +215,30 @@ func (t ErrorType) Error() string {
return string(t)
}
// FrameHandler is the common interface for a frame handler.
type FrameHandler interface {
// Handler is the common interface for a Chrome Debugging Protocol target.
type Handler interface {
// SetActive changes the top level frame id.
SetActive(context.Context, FrameID) error
// GetRoot returns the root document node for the top level frame.
GetRoot(context.Context) (*Node, error)
// WaitFrame waits for a frame to be available.
WaitFrame(context.Context, FrameID) (*Frame, error)
// WaitNode waits for a node to be available.
WaitNode(context.Context, *Frame, NodeID) (*Node, error)
Listen(...MethodType) <-chan interface{}
// Execute executes the specified command using the supplied context and
// parameters.
Execute(context.Context, MethodType, easyjson.RawMessage) <-chan interface{}
// Listen creates a channel that will receive an event for the types
// specified.
Listen(...MethodType) <-chan interface{}
// Release releases a channel returned from Listen.
Release(<-chan interface{})
}
// Empty is an empty JSON object message.

View File

@ -28,7 +28,7 @@ var (
//line templates/extra.qtpl:7
func StreamExtraTimestampTemplate(qw422016 *qt422016.Writer, t *internal.Type, d *internal.Domain) {
//line templates/extra.qtpl:8
typ := t.IdOrName()
typ := t.IDorName()
//line templates/extra.qtpl:9
qw422016.N().S(`
@ -476,17 +476,30 @@ func (t ErrorType) Error() string {
return string(t)
}
// FrameHandler is the common interface for a frame handler.
type FrameHandler interface {
// Handler is the common interface for a Chrome Debugging Protocol target.
type Handler interface {
// SetActive changes the top level frame id.
SetActive(context.Context, FrameID) error
// GetRoot returns the root document node for the top level frame.
GetRoot(context.Context) (*Node, error)
// WaitFrame waits for a frame to be available.
WaitFrame(context.Context, FrameID) (*Frame, error)
// WaitNode waits for a node to be available.
WaitNode(context.Context, *Frame, NodeID) (*Node, error)
Listen(...MethodType) <-chan interface{}
// Execute executes the specified command using the supplied context and
// parameters.
Execute(context.Context, MethodType, easyjson.RawMessage) <-chan interface{}
// Listen creates a channel that will receive an event for the types
// specified.
Listen(...MethodType) <-chan interface{}
// Release releases a channel returned from Listen.
Release(<-chan interface{})
}
// Empty is an empty JSON object message.
@ -500,40 +513,40 @@ var Empty = easyjson.RawMessage(`)
//line templates/extra.qtpl:211
qw422016.N().S(`)
`)
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
}
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
func WriteExtraCDPTypes(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
StreamExtraCDPTypes(qw422016)
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
}
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
func ExtraCDPTypes() string {
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
WriteExtraCDPTypes(qb422016)
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
return qs422016
//line templates/extra.qtpl:233
//line templates/extra.qtpl:246
}
// ExtraUtilTemplate generates the decode func for the Message type.
//line templates/extra.qtpl:236
//line templates/extra.qtpl:249
func StreamExtraUtilTemplate(qw422016 *qt422016.Writer, domains []*internal.Domain) {
//line templates/extra.qtpl:236
//line templates/extra.qtpl:249
qw422016.N().S(`
type empty struct{}
var emptyVal = &empty{}
@ -542,66 +555,66 @@ var emptyVal = &empty{}
func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
var v easyjson.Unmarshaler
switch msg.Method {`)
//line templates/extra.qtpl:243
//line templates/extra.qtpl:256
for _, d := range domains {
//line templates/extra.qtpl:243
//line templates/extra.qtpl:256
for _, c := range d.Commands {
//line templates/extra.qtpl:243
//line templates/extra.qtpl:256
qw422016.N().S(`
case cdp.`)
//line templates/extra.qtpl:244
//line templates/extra.qtpl:257
qw422016.N().S(c.CommandMethodType(d))
//line templates/extra.qtpl:244
//line templates/extra.qtpl:257
qw422016.N().S(`:`)
//line templates/extra.qtpl:244
//line templates/extra.qtpl:257
if len(c.Returns) == 0 {
//line templates/extra.qtpl:244
//line templates/extra.qtpl:257
qw422016.N().S(`
return emptyVal, nil`)
//line templates/extra.qtpl:245
//line templates/extra.qtpl:258
} else {
//line templates/extra.qtpl:245
//line templates/extra.qtpl:258
qw422016.N().S(`
v = new(`)
//line templates/extra.qtpl:246
//line templates/extra.qtpl:259
qw422016.N().S(d.PackageRefName())
//line templates/extra.qtpl:246
//line templates/extra.qtpl:259
qw422016.N().S(`.`)
//line templates/extra.qtpl:246
//line templates/extra.qtpl:259
qw422016.N().S(c.CommandReturnsType())
//line templates/extra.qtpl:246
//line templates/extra.qtpl:259
qw422016.N().S(`)`)
//line templates/extra.qtpl:246
//line templates/extra.qtpl:259
}
//line templates/extra.qtpl:246
//line templates/extra.qtpl:259
qw422016.N().S(`
`)
//line templates/extra.qtpl:247
//line templates/extra.qtpl:260
}
//line templates/extra.qtpl:247
//line templates/extra.qtpl:260
for _, e := range d.Events {
//line templates/extra.qtpl:247
//line templates/extra.qtpl:260
qw422016.N().S(`
case cdp.`)
//line templates/extra.qtpl:248
//line templates/extra.qtpl:261
qw422016.N().S(e.EventMethodType(d))
//line templates/extra.qtpl:248
//line templates/extra.qtpl:261
qw422016.N().S(`:
v = new(`)
//line templates/extra.qtpl:249
//line templates/extra.qtpl:262
qw422016.N().S(d.PackageRefName())
//line templates/extra.qtpl:249
//line templates/extra.qtpl:262
qw422016.N().S(`.`)
//line templates/extra.qtpl:249
//line templates/extra.qtpl:262
qw422016.N().S(e.EventType())
//line templates/extra.qtpl:249
//line templates/extra.qtpl:262
qw422016.N().S(`)
`)
//line templates/extra.qtpl:250
//line templates/extra.qtpl:263
}
//line templates/extra.qtpl:250
//line templates/extra.qtpl:263
}
//line templates/extra.qtpl:250
//line templates/extra.qtpl:263
qw422016.N().S(`}
var buf easyjson.RawMessage
@ -624,69 +637,69 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
return v, nil
}
`)
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
}
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
func WriteExtraUtilTemplate(qq422016 qtio422016.Writer, domains []*internal.Domain) {
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
StreamExtraUtilTemplate(qw422016, domains)
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
}
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
func ExtraUtilTemplate(domains []*internal.Domain) string {
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
WriteExtraUtilTemplate(qb422016, domains)
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
return qs422016
//line templates/extra.qtpl:271
//line templates/extra.qtpl:284
}
//line templates/extra.qtpl:273
//line templates/extra.qtpl:286
func StreamExtraMethodTypeDomainDecoder(qw422016 *qt422016.Writer) {
//line templates/extra.qtpl:273
//line templates/extra.qtpl:286
qw422016.N().S(`
// Domain returns the Chrome Debugging Protocol domain of the event or command.
func (t MethodType) Domain() string {
return string(t[:strings.IndexByte(string(t), '.')])
}
`)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
}
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
func WriteExtraMethodTypeDomainDecoder(qq422016 qtio422016.Writer) {
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
qw422016 := qt422016.AcquireWriter(qq422016)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
StreamExtraMethodTypeDomainDecoder(qw422016)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
qt422016.ReleaseWriter(qw422016)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
}
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
func ExtraMethodTypeDomainDecoder() string {
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
qb422016 := qt422016.AcquireByteBuffer()
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
WriteExtraMethodTypeDomainDecoder(qb422016)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
qs422016 := string(qb422016.B)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
qt422016.ReleaseByteBuffer(qb422016)
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
return qs422016
//line templates/extra.qtpl:278
//line templates/extra.qtpl:291
}

View File

@ -7,7 +7,7 @@
// FileHeader is the file header template.
{% func FileHeader(pkgName string, d *internal.Domain) %}
{% if d != nil %}// Package {%s= d.PackageName() %} provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome {%s= d.String() %} domain.
// commands, types, and events for the {%s= d.String() %} domain.
// {% if desc := d.Description; desc != "" %}
{%s= formatComment(desc, "", "") %}
//{% endif %}

View File

@ -39,7 +39,7 @@ func StreamFileHeader(qw422016 *qt422016.Writer, pkgName string, d *internal.Dom
qw422016.N().S(d.PackageName())
//line templates/file.qtpl:9
qw422016.N().S(` provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome `)
// commands, types, and events for the `)
//line templates/file.qtpl:10
qw422016.N().S(d.String())
//line templates/file.qtpl:10

View File

@ -1,3 +1,5 @@
// Package templates contains the valyala/quicktemplate based code generation
// templates used by chromedp-gen.
package templates
import (

View File

@ -1,3 +1,11 @@
// chromedp-proxy provides a cli utility that will proxy requests from a Chrome
// Debugging Protocol client to a application instance.
//
// chromedp-proxy is particularly useful for recording events/data from
// Selenium (ChromeDriver), Chrome DevTools in the browser, or for debugging
// remote application instances compatible with the debugging protocol.
//
// Please see README.md for more information on using chromedp-proxy.
package main
import (
@ -25,21 +33,21 @@ var (
)
const (
IncomingBufferSize = 10 * 1024 * 1024
OutgoingBufferSize = 25 * 1024 * 1024
incomingBufferSize = 10 * 1024 * 1024
outgoingBufferSize = 25 * 1024 * 1024
)
var wsUpgrader = &websocket.Upgrader{
ReadBufferSize: IncomingBufferSize,
WriteBufferSize: OutgoingBufferSize,
ReadBufferSize: incomingBufferSize,
WriteBufferSize: outgoingBufferSize,
CheckOrigin: func(r *http.Request) bool {
return true
},
}
var wsDialer = &websocket.Dialer{
ReadBufferSize: OutgoingBufferSize,
WriteBufferSize: IncomingBufferSize,
ReadBufferSize: outgoingBufferSize,
WriteBufferSize: incomingBufferSize,
}
func main() {

13
contrib/coverage.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
SRC=$(realpath $(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../)
set -ve
pushd $SRC &> /dev/null
echo 'mode: atomic' > coverage.out && go list ./... | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.out' && rm coverage.tmp
go tool cover -html=coverage.out
popd &> /dev/null

29
contrib/meta.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
SRC=$(realpath $(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../)
pushd $SRC &> /dev/null
gometalinter \
--disable=aligncheck \
--deadline=100s \
--cyclo-over=25 \
--sort=path \
--exclude='\(defer (.+?)\)\) \(errcheck\)$' \
--exclude='func easyjson.*should be' \
--exclude='/easyjson\.go.*(passes|copies) lock' \
--exclude='/easyjson\.go.*warning' \
--exclude='^cdp/.*gocyclo' \
--exclude='^cdp/.*Potential hardcoded credentials' \
--exclude='^cmd/chromedp-proxy/main\.go.*\(gas\)$' \
--exclude='^cmd/chromedp-gen/fixup/fixup\.go.*goconst' \
--exclude='^cmd/chromedp-gen/internal/enum\.go.*unreachable' \
--exclude='^cmd/chromedp-gen/main\.go.*\(gas\)$' \
--exclude='^cmd/chromedp-gen/.*gocyclo' \
--exclude='^cmd/chromedp-gen/.*interfacer' \
--exclude='^kb/gen\.go.*\((gas|vet)\)$' \
--exclude='^runner/.*\(gas\)$' \
--exclude='^handler\.go.*cmd can be easyjson\.Marshaler' \
./...
popd &> /dev/null

View File

@ -1,6 +1,6 @@
#!/bin/bash
SRC=$GOPATH/src/github.com/knq/chromedp
SRC=$(realpath $(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../)
FILES=$(find $SRC/cmd/chromedp-gen -type f -iname \*.go -not -iname \*.qtpl.go -print0|wc -l --files0-from=-|head -n -1)$'\n'
FILES+=$(find $SRC/{client,runner,contrib,examples} -type f -iname \*.go -print0|wc -l --files0-from=-|head -n -1)$'\n'

7
doc.go Normal file
View File

@ -0,0 +1,7 @@
// Package chromedp is a high level Chrome Debugging Protocol domain manager
// that simplifies driving web browsers (Chrome, Safari, Edge, Android Web
// Views, and others) for scraping, unit testing, or profiling web pages.
//
// chromedp requires no third-party dependencies (ie, Selenium), implementing
// the async Chrome Debugging Protocol natively.
package chromedp

45
eval.go
View File

@ -8,19 +8,18 @@ import (
rundom "github.com/knq/chromedp/cdp/runtime"
)
// Evaluate evaluates the Javascript expression, unmarshaling the result of the
// script evaluation to res.
// Evaluate is an action to evaluate the Javascript expression, unmarshaling
// the result of the script evaluation to res.
//
// If res is *[]byte, then the result of the script evaluation will be returned
// "by value" (ie, JSON-encoded) and res will be set to the raw value.
// When res is a type other than *[]byte, or **chromedp/cdp/runtime.RemoteObject,
// then the result of the script evaluation will be returned "by value" (ie,
// JSON-encoded), and subsequently an attempt will be made to json.Unmarshal
// the script result to res.
//
// Alternatively, if res is **chromedp/cdp/runtime.RemoteObject, then it will
// be set to the returned RemoteObject and no attempt will be made to convert
// the value to an equivalent Go type.
//
// Otherwise, if res is any other Go type, the result of the script evaluation
// will be returned "by value" (ie, JSON-encoded), and subsequently will be
// json.Unmarshal'd into res.
// Otherwise, when res is a *[]byte, the raw JSON-encoded value of the script
// result will be placed in res. Similarly, if res is a *runtime.RemoteObject,
// then res will be set to the low-level protocol type, and no attempt will be
// made to convert the result.
//
// Note: any exception encountered will be returned as an error.
func Evaluate(expression string, res interface{}, opts ...EvaluateOption) Action {
@ -28,7 +27,7 @@ func Evaluate(expression string, res interface{}, opts ...EvaluateOption) Action
panic("res cannot be nil")
}
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
var err error
// set up parameters
@ -68,16 +67,16 @@ func Evaluate(expression string, res interface{}, opts ...EvaluateOption) Action
})
}
// EvaluateAsDevTools is an action that evaluates a Javascript expression in
// the same context as Chrome DevTools would, exposing the Command Line API to
// the script evaluating the expression in the "console" context.
// EvaluateAsDevTools is an action that evaluates a Javascript expression as
// Chrome DevTools would, evaluating the expression in the "console" context,
// and making the Command Line API available to the script.
//
// Note: this should not be used with any untrusted code.
// Note: this should not be used with untrusted Javascript.
func EvaluateAsDevTools(expression string, res interface{}, opts ...EvaluateOption) Action {
return Evaluate(expression, res, append(opts, EvalObjectGroup("console"), EvalWithCommandLineAPI)...)
}
// EvaluateOption is an Evaluate call option.
// EvaluateOption is the type for script evaulation options.
type EvaluateOption func(*rundom.EvaluateParams) *rundom.EvaluateParams
// EvalObjectGroup is a evaluate option to set the object group.
@ -90,19 +89,19 @@ func EvalObjectGroup(objectGroup string) EvaluateOption {
// EvalWithCommandLineAPI is an evaluate option to make the DevTools Command
// Line API available to the evaluated script.
//
// Note: this should not be used with any untrusted code.
// Note: this should not be used with untrusted Javascript.
func EvalWithCommandLineAPI(p *rundom.EvaluateParams) *rundom.EvaluateParams {
return p.WithIncludeCommandLineAPI(true)
}
// EvalSilent is a evaluate option that will cause script evaluation to ignore
// exceptions.
func EvalSilent(p *rundom.EvaluateParams) *rundom.EvaluateParams {
// EvalIgnoreExceptions is a evaluate option that will cause script evaluation
// to ignore exceptions.
func EvalIgnoreExceptions(p *rundom.EvaluateParams) *rundom.EvaluateParams {
return p.WithSilent(true)
}
// EvalAsValue is a evaluate option that will case the script to encode its
// result as a value.
// EvalAsValue is a evaluate option that will cause the evaluated script to
// encode the result of the expression as a JSON-encoded value.
func EvalAsValue(p *rundom.EvaluateParams) *rundom.EvaluateParams {
return p.WithReturnByValue(true)
}

View File

@ -71,7 +71,7 @@ func googleSearch(q, text string, site, res *string) cdp.Tasks {
cdp.WaitNotVisible(`div.v-middle > div.la-ball-clip-rotate`, cdp.ByQuery),
cdp.Location(site),
cdp.Screenshot(`#testimonials`, &buf, cdp.ByID),
cdp.ActionFunc(func(context.Context, cdptypes.FrameHandler) error {
cdp.ActionFunc(func(context.Context, cdptypes.Handler) error {
return ioutil.WriteFile("testimonials.png", buf, 0644)
}),
}

View File

@ -51,7 +51,7 @@ func googleSearch(q, text string, site, res *string) cdp.Tasks {
cdp.WaitNotVisible(`div.v-middle > div.la-ball-clip-rotate`, cdp.ByQuery),
cdp.Location(site),
cdp.Screenshot(`#testimonials`, &buf, cdp.ByID),
cdp.ActionFunc(func(context.Context, cdptypes.FrameHandler) error {
cdp.ActionFunc(func(context.Context, cdptypes.Handler) error {
return ioutil.WriteFile("testimonials.png", buf, 0644)
}),
}

View File

@ -62,7 +62,7 @@ func googleSearch(q, text string, site, res *string) cdp.Tasks {
cdp.WaitNotVisible(`div.v-middle > div.la-ball-clip-rotate`, cdp.ByQuery),
cdp.Location(site),
cdp.Screenshot(`#testimonials`, &buf, cdp.ByID),
cdp.ActionFunc(func(context.Context, cdptypes.FrameHandler) error {
cdp.ActionFunc(func(context.Context, cdptypes.Handler) error {
return ioutil.WriteFile("testimonials.png", buf, 0644)
}),
}

View File

@ -49,21 +49,21 @@ func visible() cdp.Tasks {
return cdp.Tasks{
cdp.Navigate("file:" + os.Getenv("GOPATH") + "/src/github.com/knq/chromedp/testdata/visible.html"),
cdp.Evaluate(makeVisibleScript, &res),
cdp.ActionFunc(func(context.Context, cdptypes.FrameHandler) error {
cdp.ActionFunc(func(context.Context, cdptypes.Handler) error {
log.Printf(">>> res: %+v", res)
return nil
}),
cdp.WaitVisible(`#box1`),
cdp.ActionFunc(func(context.Context, cdptypes.FrameHandler) error {
cdp.ActionFunc(func(context.Context, cdptypes.Handler) error {
log.Printf(">>>>>>>>>>>>>>>>>>>> BOX1 IS VISIBLE")
return nil
}),
cdp.WaitVisible(`#box2`),
cdp.ActionFunc(func(context.Context, cdptypes.FrameHandler) error {
cdp.ActionFunc(func(context.Context, cdptypes.Handler) error {
log.Printf(">>>>>>>>>>>>>>>>>>>> BOX2 IS VISIBLE")
return nil
}),
cdp.ActionFunc(func(context.Context, cdptypes.FrameHandler) error {
cdp.ActionFunc(func(context.Context, cdptypes.Handler) error {
log.Printf(">>>>>>>>>>>>>>>>>>>> WAITING TO EXIT")
time.Sleep(150 * time.Second)
return errors.New("exiting")

View File

@ -22,10 +22,6 @@ import (
"github.com/knq/chromedp/client"
)
var (
_ cdp.FrameHandler = &TargetHandler{}
)
// TargetHandler manages a Chrome Debugging Protocol target.
type TargetHandler struct {
conn client.Transport
@ -61,7 +57,7 @@ type TargetHandler struct {
sync.RWMutex
}
// NewTargetHandler creates a new manager for the specified client target.
// NewTargetHandler creates a new handler for the specified client target.
func NewTargetHandler(t client.Target) (*TargetHandler, error) {
conn, err := client.Dial(t)
if err != nil {
@ -71,7 +67,7 @@ func NewTargetHandler(t client.Target) (*TargetHandler, error) {
return &TargetHandler{conn: conn}, nil
}
// Run starts the processing of commands and events to the client target
// Run starts the processing of commands and events of the client target
// provided to NewTargetHandler.
//
// Callers can stop Run by closing the passed context.
@ -266,7 +262,7 @@ func (h *TargetHandler) processEvent(ctxt context.Context, msg *cdp.Message) err
// documentUpdated handles the document updated event, retrieving the document
// root for the root frame.
func (h *TargetHandler) documentUpdated(ctxt context.Context) {
f, err := h.WaitFrame(ctxt, emptyFrameID)
f, err := h.WaitFrame(ctxt, EmptyFrameID)
if err != nil {
log.Printf("could not get current frame, got: %v", err)
return
@ -336,7 +332,7 @@ func (h *TargetHandler) processCommand(cmd *cdp.Message) error {
//
// Note: the returned channel will be closed after the result is read. If the
// passed context finishes prior to receiving the command result, then
// ErrContextDone will be sent to the channel.
// ctxt.Err() will be sent to the channel.
func (h *TargetHandler) Execute(ctxt context.Context, commandType cdp.MethodType, params easyjson.RawMessage) <-chan interface{} {
ch := make(chan interface{}, 1)
@ -372,19 +368,13 @@ func (h *TargetHandler) Execute(ctxt context.Context, commandType cdp.MethodType
}
case <-ctxt.Done():
ch <- cdp.ErrContextDone
ch <- ctxt.Err()
}
}()
return ch
}
// Listen adds a listener for the specified event types to the appropriate
// domain.
func (h *TargetHandler) Listen(eventTypes ...cdp.MethodType) <-chan interface{} {
return nil
}
// GetRoot returns the current top level frame's root document node.
func (h *TargetHandler) GetRoot(ctxt context.Context) (*cdp.Node, error) {
// TODO: fix this
@ -452,7 +442,7 @@ loop:
var ok bool
h.RLock()
if id == emptyFrameID {
if id == EmptyFrameID {
f, ok = h.cur, h.cur != nil
} else {
f, ok = h.frames[id]
@ -466,7 +456,7 @@ loop:
time.Sleep(DefaultCheckDuration)
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
case <-timeout:
break loop
@ -499,7 +489,7 @@ loop:
time.Sleep(DefaultCheckDuration)
case <-ctxt.Done():
return nil, cdp.ErrContextDone
return nil, ctxt.Err()
case <-timeout:
break loop
@ -572,7 +562,7 @@ func (h *TargetHandler) domEvent(ctxt context.Context, ev interface{}) {
defer h.domWaitGroup.Done()
// wait current frame
f, err := h.WaitFrame(ctxt, emptyFrameID)
f, err := h.WaitFrame(ctxt, EmptyFrameID)
if err != nil {
log.Printf("error processing DOM event %s: error waiting for frame, got: %v", reflect.TypeOf(ev), err)
return
@ -601,7 +591,7 @@ func (h *TargetHandler) domEvent(ctxt context.Context, ev interface{}) {
id, op = e.NodeID, childNodeCountUpdated(e.ChildNodeCount)
case *dom.EventChildNodeInserted:
if e.PreviousNodeID != emptyNodeID {
if e.PreviousNodeID != EmptyNodeID {
_, err = h.WaitNode(ctxt, f, e.PreviousNodeID)
if err != nil {
return
@ -657,3 +647,13 @@ func (h *TargetHandler) domEvent(ctxt context.Context, ev interface{}) {
op(n)
}
// Listen creates a listener for the specified event types.
func (h *TargetHandler) Listen(eventTypes ...cdp.MethodType) <-chan interface{} {
return nil
}
// Release releases a channel returned from Listen.
func (h *TargetHandler) Release(ch <-chan interface{}) {
}

View File

@ -31,7 +31,7 @@ func MouseAction(typ input.MouseType, x, y int64, opts ...MouseOption) Action {
// MouseClickXY sends a left mouse button click (ie, mousePressed and
// mouseReleased event) at the X, Y location.
func MouseClickXY(x, y int64, opts ...MouseOption) Action {
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
me := &input.DispatchMouseEventParams{
Type: input.MousePressed,
X: x,
@ -58,7 +58,7 @@ func MouseClickXY(x, y int64, opts ...MouseOption) Action {
// MouseClickNode dispatches a mouse left button click event at the center of a
// specified node.
func MouseClickNode(n *cdp.Node, opts ...MouseOption) Action {
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
var err error
/*err = dom.Focus(n.NodeID).Do(ctxt, h)
@ -154,7 +154,7 @@ func ClickCount(n int) MouseOption {
// Note: only well known, "printable" characters will have "char" events
// synthesized.
func KeyAction(keys string, opts ...KeyOption) Action {
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
var err error
for _, r := range keys {
@ -175,7 +175,7 @@ func KeyAction(keys string, opts ...KeyOption) Action {
// KeyActionNode dispatches a key event on a node.
func KeyActionNode(n *cdp.Node, keys string, opts ...KeyOption) Action {
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
err := dom.Focus(n.NodeID).Do(ctxt, h)
if err != nil {
return err

12
nav.go
View File

@ -10,7 +10,7 @@ import (
// Navigate navigates the current frame.
func Navigate(urlstr string) Action {
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
frameID, err := page.Navigate(urlstr).Do(ctxt, h)
if err != nil {
return err
@ -27,7 +27,7 @@ func NavigationEntries(currentIndex *int64, entries *[]*page.NavigationEntry) Ac
panic("currentIndex and entries cannot be nil")
}
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
var err error
*currentIndex, *entries, err = page.GetNavigationHistory().Do(ctxt, h)
return err
@ -41,7 +41,7 @@ func NavigateToHistoryEntry(entryID int64) Action {
}
// NavigateBack navigates the current frame backwards in its history.
func NavigateBack(ctxt context.Context, h cdp.FrameHandler) error {
func NavigateBack(ctxt context.Context, h cdp.Handler) error {
cur, entries, err := page.GetNavigationHistory().Do(ctxt, h)
if err != nil {
return err
@ -62,7 +62,7 @@ func NavigateBack(ctxt context.Context, h cdp.FrameHandler) error {
}
// NavigateForward navigates the current frame forwards in its history.
func NavigateForward(ctxt context.Context, h cdp.FrameHandler) error {
func NavigateForward(ctxt context.Context, h cdp.Handler) error {
cur, entries, err := page.GetNavigationHistory().Do(ctxt, h)
if err != nil {
return err
@ -88,7 +88,7 @@ func CaptureScreenshot(res *[]byte) Action {
panic("res cannot be nil")
}
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
var err error
*res, err = page.CaptureScreenshot().Do(ctxt, h)
return err
@ -101,7 +101,7 @@ func AddOnLoadScript(source string, id *page.ScriptIdentifier) Action {
panic("id cannot be nil")
}
return ActionFunc(func(ctxt context.Context, h cdp.FrameHandler) error {
return ActionFunc(func(ctxt context.Context, h cdp.Handler) error {
var err error
*id, err = page.AddScriptToEvaluateOnLoad(source).Do(ctxt, h)
return err

View File

@ -16,7 +16,7 @@ const (
DefaultEndPort = 10000
)
// Pool provides a pool of running Chrome processes.
// Pool manages a pool of running Chrome processes.
type Pool struct {
// start is the start port.
start int

View File

@ -28,7 +28,7 @@ func Nodes(sel interface{}, nodes *[]*cdp.Node, opts ...QueryOption) Action {
panic("nodes cannot be nil")
}
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, n ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, n ...*cdp.Node) error {
*nodes = n
return nil
}, opts...)
@ -40,7 +40,7 @@ func NodeIDs(sel interface{}, ids *[]cdp.NodeID, opts ...QueryOption) Action {
panic("nodes cannot be nil")
}
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
nodeIDs := make([]cdp.NodeID, len(nodes))
for i, n := range nodes {
nodeIDs[i] = n.NodeID
@ -54,7 +54,7 @@ func NodeIDs(sel interface{}, ids *[]cdp.NodeID, opts ...QueryOption) Action {
// Focus focuses the first element returned by the selector.
func Focus(sel interface{}, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -65,7 +65,7 @@ func Focus(sel interface{}, opts ...QueryOption) Action {
// Blur unfocuses (blurs) the first element returned by the selector.
func Blur(sel interface{}, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -88,7 +88,7 @@ func Text(sel interface{}, text *string, opts ...QueryOption) Action {
panic("text cannot be nil")
}
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -99,7 +99,7 @@ func Text(sel interface{}, text *string, opts ...QueryOption) Action {
// Clear clears input and textarea fields of their values.
func Clear(sel interface{}, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -144,7 +144,7 @@ func Dimensions(sel interface{}, model **dom.BoxModel, opts ...QueryOption) Acti
if model == nil {
panic("model cannot be nil")
}
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -160,7 +160,7 @@ func Value(sel interface{}, value *string, opts ...QueryOption) Action {
panic("value cannot be nil")
}
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -171,7 +171,7 @@ func Value(sel interface{}, value *string, opts ...QueryOption) Action {
// SetValue sets the value of an element.
func SetValue(sel interface{}, value string, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -195,7 +195,7 @@ func Attributes(sel interface{}, attributes *map[string]string, opts ...QueryOpt
panic("attributes cannot be nil")
}
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -217,7 +217,7 @@ func Attributes(sel interface{}, attributes *map[string]string, opts ...QueryOpt
// SetAttributes sets the attributes for the specified element.
func SetAttributes(sel interface{}, attributes map[string]string, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return errors.New("expected at least one element")
}
@ -233,7 +233,7 @@ func AttributeValue(sel interface{}, name string, value *string, ok *bool, opts
panic("value cannot be nil")
}
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return errors.New("expected at least one element")
}
@ -262,7 +262,7 @@ func AttributeValue(sel interface{}, name string, value *string, ok *bool, opts
// SetAttributeValue sets an element's attribute with name to value.
func SetAttributeValue(sel interface{}, name, value string, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -273,7 +273,7 @@ func SetAttributeValue(sel interface{}, name, value string, opts ...QueryOption)
// RemoveAttribute removes an element's attribute with name.
func RemoveAttribute(sel interface{}, name string, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -284,7 +284,7 @@ func RemoveAttribute(sel interface{}, name string, opts ...QueryOption) Action {
// Click sends a click to the first element returned by the selector.
func Click(sel interface{}, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -295,7 +295,7 @@ func Click(sel interface{}, opts ...QueryOption) Action {
// DoubleClick does a double click on the first element returned by selector.
func DoubleClick(sel interface{}, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -309,7 +309,7 @@ func DoubleClick(sel interface{}, opts ...QueryOption) Action {
// Hover hovers (moves) the mouse over the first element returned by the
// selector.
//func Hover(sel interface{}, opts ...QueryOption) Action {
// return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
// return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
// if len(nodes) < 1 {
// return fmt.Errorf("selector `%s` did not return any nodes", sel)
// }
@ -320,7 +320,7 @@ func DoubleClick(sel interface{}, opts ...QueryOption) Action {
// SendKeys sends keys to the first element returned by selector.
func SendKeys(sel interface{}, v string, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -334,7 +334,7 @@ func Screenshot(sel interface{}, picbuf *[]byte, opts ...QueryOption) Action {
panic("picbuf cannot be nil")
}
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -393,7 +393,7 @@ func Screenshot(sel interface{}, picbuf *[]byte, opts ...QueryOption) Action {
// Submit is an action that submits whatever form the first element matching
// the selector belongs to.
func Submit(sel interface{}, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}
@ -415,7 +415,7 @@ func Submit(sel interface{}, opts ...QueryOption) Action {
// Reset is an action that resets whatever form the first element matching the
// selector belongs to.
func Reset(sel interface{}, opts ...QueryOption) Action {
return QueryAfter(sel, func(ctxt context.Context, h cdp.FrameHandler, nodes ...*cdp.Node) error {
return QueryAfter(sel, func(ctxt context.Context, h cdp.Handler, nodes ...*cdp.Node) error {
if len(nodes) < 1 {
return fmt.Errorf("selector `%s` did not return any nodes", sel)
}

48
sel.go
View File

@ -38,9 +38,9 @@ var (
type Selector struct {
sel interface{}
exp int
by func(context.Context, cdp.FrameHandler, *cdp.Node) ([]cdp.NodeID, error)
wait func(context.Context, cdp.FrameHandler, *cdp.Node, ...cdp.NodeID) ([]*cdp.Node, error)
after func(context.Context, cdp.FrameHandler, ...*cdp.Node) error
by func(context.Context, cdp.Handler, *cdp.Node) ([]cdp.NodeID, error)
wait func(context.Context, cdp.Handler, *cdp.Node, ...cdp.NodeID) ([]*cdp.Node, error)
after func(context.Context, cdp.Handler, ...*cdp.Node) error
}
// Query is an action to query for document nodes match the specified sel and
@ -68,7 +68,7 @@ func Query(sel interface{}, opts ...QueryOption) Action {
}
// Do satisfies the Action interface.
func (s *Selector) Do(ctxt context.Context, h cdp.FrameHandler) error {
func (s *Selector) Do(ctxt context.Context, h cdp.Handler) error {
// TODO: fix this
ctxt, cancel := context.WithTimeout(ctxt, 100*time.Second)
defer cancel()
@ -86,7 +86,7 @@ func (s *Selector) Do(ctxt context.Context, h cdp.FrameHandler) error {
// run runs the selector action, starting over if the original returned nodes
// are invalidated prior to finishing the selector's by, wait, check, and after
// funcs.
func (s *Selector) run(ctxt context.Context, h cdp.FrameHandler) chan error {
func (s *Selector) run(ctxt context.Context, h cdp.Handler) chan error {
ch := make(chan error)
go func() {
@ -153,7 +153,7 @@ func (s *Selector) selAsInt() int {
// QueryAfter is an action that will match the specified sel using the supplied
// query options, and after the visibility conditions of the query have been
// met, will execute f.
func QueryAfter(sel interface{}, f func(context.Context, cdp.FrameHandler, ...*cdp.Node) error, opts ...QueryOption) Action {
func QueryAfter(sel interface{}, f func(context.Context, cdp.Handler, ...*cdp.Node) error, opts ...QueryOption) Action {
return Query(sel, append(opts, After(f))...)
}
@ -161,7 +161,7 @@ func QueryAfter(sel interface{}, f func(context.Context, cdp.FrameHandler, ...*c
type QueryOption func(*Selector)
// ByFunc is a query option to set the func used to select elements.
func ByFunc(f func(context.Context, cdp.FrameHandler, *cdp.Node) ([]cdp.NodeID, error)) QueryOption {
func ByFunc(f func(context.Context, cdp.Handler, *cdp.Node) ([]cdp.NodeID, error)) QueryOption {
return func(s *Selector) {
s.by = f
}
@ -170,13 +170,13 @@ func ByFunc(f func(context.Context, cdp.FrameHandler, *cdp.Node) ([]cdp.NodeID,
// ByQuery is a query option to select a single element using
// DOM.querySelector.
func ByQuery(s *Selector) {
ByFunc(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) ([]cdp.NodeID, error) {
ByFunc(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) ([]cdp.NodeID, error) {
nodeID, err := dom.QuerySelector(n.NodeID, s.selAsString()).Do(ctxt, h)
if err != nil {
return nil, err
}
if nodeID == emptyNodeID {
if nodeID == EmptyNodeID {
return []cdp.NodeID{}, nil
}
@ -186,7 +186,7 @@ func ByQuery(s *Selector) {
// ByQueryAll is a query option to select elements by DOM.querySelectorAll.
func ByQueryAll(s *Selector) {
ByFunc(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) ([]cdp.NodeID, error) {
ByFunc(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) ([]cdp.NodeID, error) {
return dom.QuerySelectorAll(n.NodeID, s.selAsString()).Do(ctxt, h)
})(s)
}
@ -200,7 +200,7 @@ func ByID(s *Selector) {
// BySearch is a query option via DOM.performSearch (works with both CSS and
// XPath queries).
func BySearch(s *Selector) {
ByFunc(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) ([]cdp.NodeID, error) {
ByFunc(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) ([]cdp.NodeID, error) {
id, count, err := dom.PerformSearch(s.selAsString()).Do(ctxt, h)
if err != nil {
return nil, err
@ -226,7 +226,7 @@ func ByNodeID(s *Selector) {
panic("ByNodeID can only work on []cdp.NodeID")
}
ByFunc(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) ([]cdp.NodeID, error) {
ByFunc(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) ([]cdp.NodeID, error) {
var err error
for _, id := range ids {
err = dom.RequestChildNodes(id).WithPierce(true).Do(ctxt, h)
@ -240,9 +240,9 @@ func ByNodeID(s *Selector) {
}
// waitReady waits for the specified nodes to be ready.
func (s *Selector) waitReady(check func(context.Context, cdp.FrameHandler, *cdp.Node) error) func(context.Context, cdp.FrameHandler, *cdp.Node, ...cdp.NodeID) ([]*cdp.Node, error) {
return func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node, ids ...cdp.NodeID) ([]*cdp.Node, error) {
f, err := h.WaitFrame(ctxt, emptyFrameID)
func (s *Selector) waitReady(check func(context.Context, cdp.Handler, *cdp.Node) error) func(context.Context, cdp.Handler, *cdp.Node, ...cdp.NodeID) ([]*cdp.Node, error) {
return func(ctxt context.Context, h cdp.Handler, n *cdp.Node, ids ...cdp.NodeID) ([]*cdp.Node, error) {
f, err := h.WaitFrame(ctxt, EmptyFrameID)
if err != nil {
return nil, err
}
@ -288,7 +288,7 @@ func (s *Selector) waitReady(check func(context.Context, cdp.FrameHandler, *cdp.
}
// WaitFunc is a query option to set a custom wait func.
func WaitFunc(wait func(context.Context, cdp.FrameHandler, *cdp.Node, ...cdp.NodeID) ([]*cdp.Node, error)) QueryOption {
func WaitFunc(wait func(context.Context, cdp.Handler, *cdp.Node, ...cdp.NodeID) ([]*cdp.Node, error)) QueryOption {
return func(s *Selector) {
s.wait = wait
}
@ -301,7 +301,7 @@ func ElementReady(s *Selector) {
// ElementVisible is a query option to wait until the element is visible.
func ElementVisible(s *Selector) {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) error {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) error {
var err error
// check box model
@ -329,7 +329,7 @@ func ElementVisible(s *Selector) {
// ElementNotVisible is a query option to wait until the element is not visible.
func ElementNotVisible(s *Selector) {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) error {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) error {
var err error
// check box model
@ -359,7 +359,7 @@ func ElementNotVisible(s *Selector) {
//
// This is the old, complicated, implementation (deprecated).
func ElementVisibleOld(s *Selector) {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) error {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) error {
var err error
// check node has box model
@ -408,7 +408,7 @@ func ElementVisibleOld(s *Selector) {
//
// This is the old, complicated, implementation (deprecated).
func ElementNotVisibleOld(s *Selector) {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) error {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) error {
var err error
// check node has box model
@ -454,7 +454,7 @@ func ElementNotVisibleOld(s *Selector) {
// ElementEnabled is a query option to wait until the element is enabled.
func ElementEnabled(s *Selector) {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) error {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) error {
n.RLock()
defer n.RUnlock()
@ -470,7 +470,7 @@ func ElementEnabled(s *Selector) {
// ElementSelected is a query option to wait until the element is selected.
func ElementSelected(s *Selector) {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node) error {
WaitFunc(s.waitReady(func(ctxt context.Context, h cdp.Handler, n *cdp.Node) error {
n.RLock()
defer n.RUnlock()
@ -488,7 +488,7 @@ func ElementSelected(s *Selector) {
// present matching the selector.
func ElementNotPresent(s *Selector) {
s.exp = 0
WaitFunc(func(ctxt context.Context, h cdp.FrameHandler, n *cdp.Node, ids ...cdp.NodeID) ([]*cdp.Node, error) {
WaitFunc(func(ctxt context.Context, h cdp.Handler, n *cdp.Node, ids ...cdp.NodeID) ([]*cdp.Node, error) {
if len(ids) != 0 {
return nil, ErrHasResults
}
@ -506,7 +506,7 @@ func AtLeast(n int) QueryOption {
// After is a query option to set a func that will be executed after the wait
// has succeeded.
func After(f func(context.Context, cdp.FrameHandler, ...*cdp.Node) error) QueryOption {
func After(f func(context.Context, cdp.Handler, ...*cdp.Node) error) QueryOption {
return func(s *Selector) {
s.after = f
}

19
util.go
View File

@ -1,16 +1,25 @@
package chromedp
import (
"time"
"github.com/knq/chromedp/cdp"
"github.com/knq/chromedp/cdp/util"
)
const (
// emptyFrameID is the "non-existent" (ie current) frame.
emptyFrameID cdp.FrameID = cdp.FrameID("")
// DefaultNewTargetTimeout is the default time to wait for a new target to
// be started.
DefaultNewTargetTimeout = 3 * time.Second
// emptyNodeID is the "non-existent" node id.
emptyNodeID cdp.NodeID = cdp.NodeID(0)
// DefaultCheckDuration is the default time to sleep between a check.
DefaultCheckDuration = 50 * time.Millisecond
// EmptyFrameID is the "non-existent" (ie current) frame.
EmptyFrameID cdp.FrameID = cdp.FrameID("")
// EmptyNodeID is the "non-existent" node id.
EmptyNodeID cdp.NodeID = cdp.NodeID(0)
)
// UnmarshalMessage unmarshals the message result or params.
@ -39,7 +48,7 @@ func frameAttached(id cdp.FrameID) FrameOp {
}*/
func frameDetached(f *cdp.Frame) {
f.ParentID = emptyFrameID
f.ParentID = EmptyFrameID
clearFrameState(f, cdp.FrameAttached)
}