eval

package
v0.0.0-...-af4f867 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyExecutionContextID = cdpruntime.ExecutionContextID(-1)
	EmptyObjectID           = cdpruntime.RemoteObjectID("")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CompiledFunction

type CompiledFunction struct {
	// contains filtered or unexported fields
}

func CF

type Function

type Function struct {
	// contains filtered or unexported fields
}

func F

func F(exp string) *Function

func (*Function) AsAnonymous

func (fn *Function) AsAnonymous() *Function

func (*Function) AsAsync

func (fn *Function) AsAsync() *Function

func (*Function) AsNamed

func (fn *Function) AsNamed(name string) *Function

func (*Function) AsSync

func (fn *Function) AsSync() *Function

func (*Function) CallOn

func (fn *Function) CallOn(id cdpruntime.RemoteObjectID) *Function

func (*Function) Length

func (fn *Function) Length() int

func (*Function) String

func (fn *Function) String() string

func (*Function) WithArg

func (fn *Function) WithArg(value any) *Function

func (*Function) WithArgRef

func (fn *Function) WithArgRef(id cdpruntime.RemoteObjectID) *Function

func (*Function) WithArgRemoteValue

func (fn *Function) WithArgRemoteValue(value RemoteValue) *Function

func (*Function) WithArgSelector

func (fn *Function) WithArgSelector(selector drivers.QuerySelector) *Function

func (*Function) WithArgValue

func (fn *Function) WithArgValue(value runtime.Value) *Function

type FunctionArguments

type FunctionArguments []cdpruntime.CallArgument

func (FunctionArguments) MarshalZerologArray

func (args FunctionArguments) MarshalZerologArray(a *zerolog.Array)

type RemoteClassName

type RemoteClassName string
const (
	UnknownClassName  RemoteClassName = ""
	DocumentClassName RemoteClassName = "HTMLDocument"
)

List of supported remote classses

func ToRemoteClassName

func ToRemoteClassName(ref cdpruntime.RemoteObject) RemoteClassName

type RemoteObjectType

type RemoteObjectType string
const (
	UnknownObjectType     RemoteObjectType = ""
	NullObjectType        RemoteObjectType = "null"
	UndefinedObjectType   RemoteObjectType = "undefined"
	ArrayObjectType       RemoteObjectType = "array"
	NodeObjectType        RemoteObjectType = "node"
	RegexpObjectType      RemoteObjectType = "regexp"
	DateObjectType        RemoteObjectType = "date"
	MapObjectType         RemoteObjectType = "map"
	SetObjectType         RemoteObjectType = "set"
	WeakMapObjectType     RemoteObjectType = "weakmap"
	WeakSetObjectType     RemoteObjectType = "weakset"
	IteratorObjectType    RemoteObjectType = "iterator"
	GeneratorObjectType   RemoteObjectType = "generator"
	ErrorObjectType       RemoteObjectType = "error"
	ProxyObjectType       RemoteObjectType = "proxy"
	PromiseObjectType     RemoteObjectType = "promise"
	TypedArrayObjectType  RemoteObjectType = "typedarray"
	ArrayBufferObjectType RemoteObjectType = "arraybuffer"
	DataViewObjectType    RemoteObjectType = "dataview"
)

List of possible remote object types

func ToRemoteObjectType

func ToRemoteObjectType(ref cdpruntime.RemoteObject) RemoteObjectType

type RemoteType

type RemoteType string
const (
	UnknownType   RemoteType = ""
	UndefinedType RemoteType = "undefined"
	StringType    RemoteType = "string"
	NumberType    RemoteType = "number"
	BooleanType   RemoteType = "boolean"
	SymbolType    RemoteType = "symbol"
	BigintType    RemoteType = "bigint"
	ObjectType    RemoteType = "object"
)

List of possible remote types "object", "function", "undefined", "string", "number", "boolean", "symbol", "bigint"

func ToRemoteType

func ToRemoteType(ref cdpruntime.RemoteObject) RemoteType

type RemoteValue

type RemoteValue interface {
	RemoteID() cdpruntime.RemoteObjectID
}

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver(runtime cdp.Runtime, frameID page.FrameID) *Resolver

func (*Resolver) SetLoader

func (r *Resolver) SetLoader(loader ValueLoader) *Resolver

func (*Resolver) ToElement

func (*Resolver) ToProperties

func (r *Resolver) ToProperties(
	ctx context.Context,
	id cdpruntime.RemoteObjectID,
) (*runtime.Array, error)

func (*Resolver) ToProperty

func (r *Resolver) ToProperty(
	ctx context.Context,
	id cdpruntime.RemoteObjectID,
	propName string,
) (runtime.Value, error)

func (*Resolver) ToValue

type ReturnType

type ReturnType int
const (
	ReturnNothing ReturnType = iota
	ReturnValue
	ReturnRef
)

func (ReturnType) String

func (rt ReturnType) String() string

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func Create

func Create(
	ctx context.Context,
	logger zerolog.Logger,
	client *cdp.Client,
	frameID page.FrameID,
) (*Runtime, error)

func New

func New(
	logger zerolog.Logger,
	client *cdp.Client,
	frameID page.FrameID,
	contextID cdpruntime.ExecutionContextID,
) *Runtime

func (*Runtime) Call

func (rt *Runtime) Call(ctx context.Context, fn *CompiledFunction) error

func (*Runtime) CallElement

func (rt *Runtime) CallElement(ctx context.Context, fn *CompiledFunction) (drivers.HTMLElement, error)

func (*Runtime) CallElements

func (rt *Runtime) CallElements(ctx context.Context, fn *CompiledFunction) (runtime.List, error)

func (*Runtime) CallRef

func (*Runtime) CallValue

func (rt *Runtime) CallValue(ctx context.Context, fn *CompiledFunction) (runtime.Value, error)

func (*Runtime) Compile

func (rt *Runtime) Compile(ctx context.Context, fn *Function) (*CompiledFunction, error)

func (*Runtime) ContextID

func (rt *Runtime) ContextID() cdpruntime.ExecutionContextID

func (*Runtime) Eval

func (rt *Runtime) Eval(ctx context.Context, fn *Function) error

func (*Runtime) EvalElement

func (rt *Runtime) EvalElement(ctx context.Context, fn *Function) (runtime.Value, error)

func (*Runtime) EvalElements

func (rt *Runtime) EvalElements(ctx context.Context, fn *Function) (*runtime.Array, error)

func (*Runtime) EvalRef

func (rt *Runtime) EvalRef(ctx context.Context, fn *Function) (cdpruntime.RemoteObject, error)

func (*Runtime) EvalValue

func (rt *Runtime) EvalValue(ctx context.Context, fn *Function) (runtime.Value, error)

func (*Runtime) SetLoader

func (rt *Runtime) SetLoader(loader ValueLoader) *Runtime

type ValueLoader

type ValueLoader interface {
	Load(
		ctx context.Context,
		frameID page.FrameID,
		remoteType RemoteObjectType,
		remoteClass RemoteClassName,
		id cdpruntime.RemoteObjectID,
	) (runtime.Value, error)
}

type ValueLoaderFn

type ValueLoaderFn func(
	ctx context.Context,
	frameID page.FrameID,
	remoteType RemoteObjectType,
	remoteClass RemoteClassName,
	id cdpruntime.RemoteObjectID,
) (runtime.Value, error)

func (ValueLoaderFn) Load

func (f ValueLoaderFn) Load(
	ctx context.Context,
	frameID page.FrameID,
	remoteType RemoteObjectType,
	remoteClass RemoteClassName,
	id cdpruntime.RemoteObjectID,
) (runtime.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL