113 lines
1.9 KiB
Go
113 lines
1.9 KiB
Go
// Package inspector provides the Chrome Debugging Protocol
|
|
// commands, types, and events for the Chrome Inspector domain.
|
|
//
|
|
// Generated by the chromedp-gen command.
|
|
package inspector
|
|
|
|
// AUTOGENERATED. DO NOT EDIT.
|
|
|
|
import (
|
|
"context"
|
|
|
|
. "github.com/knq/chromedp/cdp"
|
|
"github.com/mailru/easyjson"
|
|
)
|
|
|
|
var (
|
|
_ BackendNode
|
|
_ BackendNodeID
|
|
_ ComputedProperty
|
|
_ ErrorType
|
|
_ Frame
|
|
_ FrameID
|
|
_ LoaderID
|
|
_ Message
|
|
_ MessageError
|
|
_ MethodType
|
|
_ Node
|
|
_ NodeID
|
|
_ NodeType
|
|
_ PseudoType
|
|
_ RGBA
|
|
_ ShadowRootType
|
|
_ Timestamp
|
|
)
|
|
|
|
// EnableParams enables inspector domain notifications.
|
|
type EnableParams struct{}
|
|
|
|
// Enable enables inspector domain notifications.
|
|
func Enable() *EnableParams {
|
|
return &EnableParams{}
|
|
}
|
|
|
|
// Do executes Inspector.enable.
|
|
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|
if ctxt == nil {
|
|
ctxt = context.Background()
|
|
}
|
|
|
|
// execute
|
|
ch := h.Execute(ctxt, CommandInspectorEnable, Empty)
|
|
|
|
// read response
|
|
select {
|
|
case res := <-ch:
|
|
if res == nil {
|
|
return ErrChannelClosed
|
|
}
|
|
|
|
switch v := res.(type) {
|
|
case easyjson.RawMessage:
|
|
return nil
|
|
|
|
case error:
|
|
return v
|
|
}
|
|
|
|
case <-ctxt.Done():
|
|
return ErrContextDone
|
|
}
|
|
|
|
return ErrUnknownResult
|
|
}
|
|
|
|
// DisableParams disables inspector domain notifications.
|
|
type DisableParams struct{}
|
|
|
|
// Disable disables inspector domain notifications.
|
|
func Disable() *DisableParams {
|
|
return &DisableParams{}
|
|
}
|
|
|
|
// Do executes Inspector.disable.
|
|
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
|
|
if ctxt == nil {
|
|
ctxt = context.Background()
|
|
}
|
|
|
|
// execute
|
|
ch := h.Execute(ctxt, CommandInspectorDisable, Empty)
|
|
|
|
// read response
|
|
select {
|
|
case res := <-ch:
|
|
if res == nil {
|
|
return ErrChannelClosed
|
|
}
|
|
|
|
switch v := res.(type) {
|
|
case easyjson.RawMessage:
|
|
return nil
|
|
|
|
case error:
|
|
return v
|
|
}
|
|
|
|
case <-ctxt.Done():
|
|
return ErrContextDone
|
|
}
|
|
|
|
return ErrUnknownResult
|
|
}
|