drivers

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

Package drivers defines shared HTML driver interfaces, values, and options.

Index

Constants

View Source
const (
	DefaultPageLoadTimeout = 60000
	DefaultWaitTimeout     = 5000
	DefaultKeyboardDelay   = 80
	DefaultMouseDelay      = 40
	DefaultTimeout         = 30000
)
View Source
const (
	NavigationEvent = "navigation"
	RequestEvent    = "request"
	ResponseEvent   = "response"
)
View Source
const (
	// WaitEventPresence indicating to wait for Value to appear.
	WaitEventPresence = 0

	// WaitEventAbsence indicating to wait for Value to disappear.
	WaitEventAbsence = 1
)

Variables

View Source
var (
	ErrDetached = errors.New("element detached")
	ErrNotFound = errors.New("element(s) not found")
)
View Source
var (
	HTTPRequestType  = runtime.NewTypeFor[*HTTPRequest]()
	HTTPResponseType = runtime.NewTypeFor[*HTTPResponse]()
	HTTPHeadersType  = runtime.NewTypeFor[*HTTPHeaders]()
	HTTPCookieType   = runtime.NewTypeFor[*HTTPCookie]()
	HTTPCookiesType  = runtime.NewTypeFor[*HTTPCookies]()
	HTMLElementType  = runtime.NewTypeFor[HTMLElement]()
	HTMLDocumentType = runtime.NewTypeFor[HTMLDocument]()
	HTMLPageType     = runtime.NewTypeFor[HTMLPage]()
)
View Source
var (
	TypeQuerySelector = runtime.NewType(reflect.TypeOf(QuerySelector{}).PkgPath(), reflect.TypeOf(QuerySelector{}).Name(), func(value runtime.Value) bool {
		switch value.(type) {
		case *runtime.Box[QuerySelector], *sdk.Proxy[QuerySelector]:
			return true
		default:
			return false
		}
	})
)

Functions

func Compare

func Compare(first, second runtime.Type) int

func CompareTo

func CompareTo(first runtime.Type, second runtime.Value) int

func CompareTypes

func CompareTypes(first, second runtime.Value) int

func IsScreenshotFormatValid

func IsScreenshotFormatValid(format string) bool

func NewHTTPHeadersProxy

func NewHTTPHeadersProxy(header *HTTPHeaders) runtime.Value

Types

type AttributeTarget

type AttributeTarget interface {
	GetAttributes(ctx context.Context) (runtime.Map, error)
	GetAttribute(ctx context.Context, name runtime.String) (runtime.Value, error)
	SetAttributes(ctx context.Context, values runtime.Map) error
	SetAttribute(ctx context.Context, name, value runtime.String) error
	RemoveAttribute(ctx context.Context, name ...runtime.String) error
}

func ToAttributeTarget

func ToAttributeTarget(value runtime.Value) (AttributeTarget, error)

type Container

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

func NewContainer

func NewContainer() *Container

func (*Container) Default

func (c *Container) Default() (Driver, bool)

func (*Container) Get

func (c *Container) Get(name string) (Driver, bool)

func (*Container) GetAll

func (c *Container) GetAll() []Driver

func (*Container) Has

func (c *Container) Has(name string) bool

func (*Container) Register

func (c *Container) Register(drv Driver) error

func (*Container) Remove

func (c *Container) Remove(name string)

func (*Container) SetDefault

func (c *Container) SetDefault(name string)

func (*Container) WithContext

func (c *Container) WithContext(ctx context.Context) context.Context

type ContentTarget

type ContentTarget interface {
	GetInnerText(ctx context.Context) (runtime.String, error)
	SetInnerText(ctx context.Context, innerText runtime.String) error
	GetInnerHTML(ctx context.Context) (runtime.String, error)
	SetInnerHTML(ctx context.Context, innerHTML runtime.String) error
	GetInnerHTMLBySelector(ctx context.Context, selector QuerySelector) (runtime.String, error)
	SetInnerHTMLBySelector(ctx context.Context, selector QuerySelector, innerHTML runtime.String) error
	GetInnerHTMLBySelectorAll(ctx context.Context, selector QuerySelector) (runtime.List, error)
	GetInnerTextBySelector(ctx context.Context, selector QuerySelector) (runtime.String, error)
	SetInnerTextBySelector(ctx context.Context, selector QuerySelector, innerText runtime.String) error
	GetInnerTextBySelectorAll(ctx context.Context, selector QuerySelector) (runtime.List, error)
}

func ToContentTarget

func ToContentTarget(value runtime.Value) (ContentTarget, error)

type DocumentMetadataTarget

type DocumentMetadataTarget interface {
	GetTitle() runtime.String
	GetElement() HTMLElement
	GetURL() runtime.String
	GetName() runtime.String
	GetParentDocument(ctx context.Context) (HTMLDocument, error)
	GetChildDocuments(ctx context.Context) (runtime.List, error)
}

type DocumentViewportTarget

type DocumentViewportTarget interface {
	Scroll(ctx context.Context, options ScrollOptions) error
	ScrollTop(ctx context.Context, options ScrollOptions) error
	ScrollBottom(ctx context.Context, options ScrollOptions) error
	ScrollBySelector(ctx context.Context, selector QuerySelector, options ScrollOptions) error
	MoveMouseByXY(ctx context.Context, x, y runtime.Float) error
}

func ToDocumentViewportTarget

func ToDocumentViewportTarget(value runtime.Value) (DocumentViewportTarget, error)

type Driver

type Driver interface {
	io.Closer
	Name() string
	Open(ctx context.Context, params Params) (HTMLPage, error)
	Parse(ctx context.Context, params ParseParams) (HTMLPage, error)
}

func FromContext

func FromContext(ctx context.Context, name string) (Driver, error)

type HTMLDocument

type HTMLDocument interface {
	HTMLNode

	DocumentMetadataTarget
}

func ToDocument

func ToDocument(value runtime.Value) (HTMLDocument, error)

type HTMLElement

HTMLElement is the most general base interface which most objects in a GetMainFrame implement.

func ToElement

func ToElement(value runtime.Value) (HTMLElement, error)

type HTMLNode

HTMLNode is an interface from which a number of DOM API object types inherit. It allows those types to be treated similarly; for example, inheriting the same set of methods, or being tested in the same way.

type HTMLPage

HTMLPage interface represents any web page loaded in the browser and serves as an entry point into the web page's content.

func ToPage

func ToPage(value runtime.Value) (HTMLPage, error)

type HTTPCookie

type HTTPCookie struct {
	Expires  time.Time `json:"expires"`
	Name     string    `json:"name"`
	Value    string    `json:"value"`
	Path     string    `json:"path"`
	Domain   string    `json:"domain"`
	MaxAge   int       `json:"maxAge"`
	SameSite SameSite  `json:"sameSite"`
	Secure   bool      `json:"secure"`
	HTTPOnly bool      `json:"httpOnly"`
}

HTTPCookie HTTPCookie object

func (HTTPCookie) Compare

func (c HTTPCookie) Compare(other runtime.Value) int

func (HTTPCookie) Copy

func (c HTTPCookie) Copy() runtime.Value

func (HTTPCookie) Get

func (HTTPCookie) Hash

func (c HTTPCookie) Hash() uint64

func (HTTPCookie) MarshalJSON

func (c HTTPCookie) MarshalJSON() ([]byte, error)

func (HTTPCookie) String

func (c HTTPCookie) String() string

func (HTTPCookie) Type

func (c HTTPCookie) Type() runtime.Type

type HTTPCookies

type HTTPCookies struct {
	Data map[string]HTTPCookie
}

func NewHTTPCookies

func NewHTTPCookies() *HTTPCookies

func NewHTTPCookiesFrom

func NewHTTPCookiesFrom(cookies *HTTPCookies) *HTTPCookies

func NewHTTPCookiesWith

func NewHTTPCookiesWith(values map[string]HTTPCookie) *HTTPCookies

func (*HTTPCookies) Copy

func (c *HTTPCookies) Copy() runtime.Value

func (*HTTPCookies) Get

func (*HTTPCookies) Hash

func (c *HTTPCookies) Hash() uint64

func (*HTTPCookies) Iterate

func (c *HTTPCookies) Iterate(_ context.Context) (runtime.Iterator, error)

func (*HTTPCookies) MarshalJSON

func (c *HTTPCookies) MarshalJSON() ([]byte, error)

func (*HTTPCookies) Set

func (c *HTTPCookies) Set(_ context.Context, key, value runtime.Value) error

func (*HTTPCookies) SetCookie

func (c *HTTPCookies) SetCookie(cookie HTTPCookie)

func (*HTTPCookies) String

func (c *HTTPCookies) String() string

func (*HTTPCookies) Type

func (c *HTTPCookies) Type() runtime.Type

type HTTPHeaders

type HTTPHeaders struct {
	Data textproto.MIMEHeader
}

HTTPHeaders HTTP header object

func NewHTTPHeaders

func NewHTTPHeaders() *HTTPHeaders

func NewHTTPHeadersWith

func NewHTTPHeadersWith(values map[string][]string) *HTTPHeaders

func (*HTTPHeaders) Clone

func (h *HTTPHeaders) Clone() *HTTPHeaders

func (*HTTPHeaders) Compare

func (h *HTTPHeaders) Compare(other runtime.Value) int

func (*HTTPHeaders) CompareTo

func (h *HTTPHeaders) CompareTo(other *HTTPHeaders) int

func (*HTTPHeaders) Copy

func (h *HTTPHeaders) Copy() runtime.Value

func (*HTTPHeaders) Get

func (*HTTPHeaders) Hash

func (h *HTTPHeaders) Hash() uint64

func (*HTTPHeaders) Iterate

func (h *HTTPHeaders) Iterate(_ context.Context) (runtime.Iterator, error)

func (*HTTPHeaders) MarshalJSON

func (h *HTTPHeaders) MarshalJSON() ([]byte, error)

func (*HTTPHeaders) Set

func (h *HTTPHeaders) Set(_ context.Context, key, value runtime.Value) error

func (*HTTPHeaders) String

func (h *HTTPHeaders) String() string

func (*HTTPHeaders) Type

func (h *HTTPHeaders) Type() runtime.Type

type HTTPRequest

type HTTPRequest struct {
	URL     string
	Method  string
	Headers *HTTPHeaders
	Body    []byte
}

HTTPRequest HTTP request object.

func (*HTTPRequest) Compare

func (req *HTTPRequest) Compare(other runtime.Value) int

func (*HTTPRequest) Copy

func (req *HTTPRequest) Copy() runtime.Value

func (*HTTPRequest) Get

func (req *HTTPRequest) Get(_ context.Context, key runtime.Value) (runtime.Value, error)

func (*HTTPRequest) Hash

func (req *HTTPRequest) Hash() uint64

func (*HTTPRequest) MarshalJSON

func (req *HTTPRequest) MarshalJSON() ([]byte, error)

func (*HTTPRequest) String

func (req *HTTPRequest) String() string

func (*HTTPRequest) Type

func (req *HTTPRequest) Type() runtime.Type

func (*HTTPRequest) Unwrap

func (req *HTTPRequest) Unwrap() any

type HTTPResponse

type HTTPResponse struct {
	Headers      *HTTPHeaders
	URL          string
	Status       string
	Body         []byte
	StatusCode   int
	ResponseTime float64
}

HTTPResponse HTTP response object.

func (*HTTPResponse) Compare

func (resp *HTTPResponse) Compare(other runtime.Value) int

func (*HTTPResponse) Copy

func (resp *HTTPResponse) Copy() runtime.Value

func (*HTTPResponse) Get

func (resp *HTTPResponse) Get(_ context.Context, key runtime.Value) (runtime.Value, error)

func (*HTTPResponse) Hash

func (resp *HTTPResponse) Hash() uint64

func (*HTTPResponse) MarshalJSON

func (resp *HTTPResponse) MarshalJSON() ([]byte, error)

func (*HTTPResponse) String

func (resp *HTTPResponse) String() string

func (*HTTPResponse) Type

func (resp *HTTPResponse) Type() runtime.Type

func (*HTTPResponse) Unwrap

func (resp *HTTPResponse) Unwrap() any

type Ignore

type Ignore struct {
	Resources   []ResourceFilter   `json:"resources"`
	StatusCodes []StatusCodeFilter `json:"statusCodes"`
}

type InteractionTarget

type InteractionTarget interface {
	Click(ctx context.Context, count runtime.Int) error
	ClickBySelector(ctx context.Context, selector QuerySelector, count runtime.Int) error
	ClickBySelectorAll(ctx context.Context, selector QuerySelector, count runtime.Int) error
	Clear(ctx context.Context) error
	ClearBySelector(ctx context.Context, selector QuerySelector) error
	Input(ctx context.Context, value runtime.Value, delay runtime.Int) error
	InputBySelector(ctx context.Context, selector QuerySelector, value runtime.Value, delay runtime.Int) error
	Press(ctx context.Context, keys []runtime.String, count runtime.Int) error
	PressBySelector(ctx context.Context, selector QuerySelector, keys []runtime.String, count runtime.Int) error
	Select(ctx context.Context, value runtime.List) (runtime.List, error)
	SelectBySelector(ctx context.Context, selector QuerySelector, value runtime.List) (runtime.List, error)
	ScrollIntoView(ctx context.Context, options ScrollOptions) error
	Focus(ctx context.Context) error
	FocusBySelector(ctx context.Context, selector QuerySelector) error
	Blur(ctx context.Context) error
	BlurBySelector(ctx context.Context, selector QuerySelector) error
	Hover(ctx context.Context) error
	HoverBySelector(ctx context.Context, selector QuerySelector) error
}

func ToInteractionTarget

func ToInteractionTarget(value runtime.Value) (InteractionTarget, error)

type NodeInspector

type NodeInspector interface {
	GetNodeType(ctx context.Context) (runtime.Int, error)
	GetNodeName(ctx context.Context) (runtime.String, error)
	GetChildNodes(ctx context.Context) (runtime.List, error)
	GetChildNode(ctx context.Context, idx runtime.Int) (runtime.Value, error)
}

type Option

type Option func(opts *Options)

func WithCookie

func WithCookie(cookie HTTPCookie) Option

func WithCookies

func WithCookies(cookies []HTTPCookie) Option

func WithCustomName

func WithCustomName(name string) Option

func WithHeader

func WithHeader(name string, value []string) Option

func WithHeaders

func WithHeaders(headers textproto.MIMEHeader) Option

func WithProxy

func WithProxy(address string) Option

func WithUserAgent

func WithUserAgent(value string) Option

type Options

type Options struct {
	Headers   *HTTPHeaders `json:"headers"`
	Cookies   *HTTPCookies `json:"cookies"`
	Name      string       `json:"name"`
	Proxy     string       `json:"proxy"`
	UserAgent string       `json:"userAgent"`
}

type PDFParams

type PDFParams struct {
	PageRanges          runtime.String  `json:"pageRanges"`
	FooterTemplate      runtime.String  `json:"footerTemplate"`
	HeaderTemplate      runtime.String  `json:"headerTemplate"`
	MarginTop           runtime.Float   `json:"marginTop"`
	PaperWidth          runtime.Float   `json:"paperWidth"`
	PaperHeight         runtime.Float   `json:"paperHeight"`
	MarginBottom        runtime.Float   `json:"marginBottom"`
	MarginLeft          runtime.Float   `json:"marginLeft"`
	MarginRight         runtime.Float   `json:"marginRight"`
	Scale               runtime.Float   `json:"scale"`
	Landscape           runtime.Boolean `json:"landscape"`
	PrintBackground     runtime.Boolean `json:"printBackground"`
	DisplayHeaderFooter runtime.Boolean `json:"displayHeaderFooter"`
	PreferCSSPageSize   runtime.Boolean `json:"preferCSSPageSize"`
}

PDFParams represents the arguments for PrintToPDF function.

func NewDefaultHTMLPDFParams

func NewDefaultHTMLPDFParams() PDFParams

type PageCookieReader

type PageCookieReader interface {
	GetCookies(ctx context.Context) (*HTTPCookies, error)
}

func ToPageCookieReader

func ToPageCookieReader(value runtime.Value) (PageCookieReader, error)

type PageCookieTarget

type PageCookieTarget interface {
	PageCookieReader
	SetCookies(ctx context.Context, cookies *HTTPCookies) error
	DeleteCookies(ctx context.Context, cookies *HTTPCookies) error
}

func ToPageCookieTarget

func ToPageCookieTarget(value runtime.Value) (PageCookieTarget, error)

type PageFrameTarget

type PageFrameTarget interface {
	GetMainFrame() HTMLDocument
	GetFrames(ctx context.Context) (runtime.List, error)
	GetFrame(ctx context.Context, idx runtime.Int) (runtime.Value, error)
}
type PageNavigationTarget interface {
	WaitForNavigation(ctx context.Context, targetURL runtime.String) error
	WaitForFrameNavigation(ctx context.Context, frame HTMLDocument, targetURL runtime.String) error
	Navigate(ctx context.Context, url runtime.String) error
	NavigateBack(ctx context.Context, skip runtime.Int) (runtime.Boolean, error)
	NavigateForward(ctx context.Context, skip runtime.Int) (runtime.Boolean, error)
}

func ToPageNavigationTarget

func ToPageNavigationTarget(value runtime.Value) (PageNavigationTarget, error)

type PageResponseTarget

type PageResponseTarget interface {
	GetResponse(ctx context.Context) (HTTPResponse, error)
}

func ToPageResponseTarget

func ToPageResponseTarget(value runtime.Value) (PageResponseTarget, error)

type PageSnapshotTarget

type PageSnapshotTarget interface {
	PrintToPDF(ctx context.Context, params PDFParams) (runtime.Binary, error)
	CaptureScreenshot(ctx context.Context, params ScreenshotParams) (runtime.Binary, error)
}

func ToPageSnapshotTarget

func ToPageSnapshotTarget(value runtime.Value) (PageSnapshotTarget, error)

type PageStateTarget

type PageStateTarget interface {
	IsClosed() runtime.Boolean
	GetURL() runtime.String
}

type Params

type Params struct {
	Cookies     *HTTPCookies `json:"cookies"`
	Headers     *HTTPHeaders `json:"headers"`
	Viewport    *Viewport    `json:"viewport"`
	Ignore      *Ignore      `json:"ignore"`
	URL         string       `json:"url"`
	UserAgent   string       `json:"userAgent"`
	Charset     string       `json:"charset"`
	KeepCookies bool         `json:"keepCookies"`
}

func SetDefaultParams

func SetDefaultParams(opts *Options, params Params) Params

type ParseParams

type ParseParams struct {
	Cookies     *HTTPCookies `json:"cookies"`
	Headers     *HTTPHeaders `json:"headers"`
	Viewport    *Viewport    `json:"viewport"`
	Content     []byte       `json:"content"`
	KeepCookies bool         `json:"keepCookies"`
}

type QuerySelector

type QuerySelector struct {
	Value runtime.String    `json:"Value"`
	Kind  QuerySelectorKind `json:"Kind"`
}

func NewCSSSelector

func NewCSSSelector(value runtime.String) QuerySelector

func NewXPathSelector

func NewXPathSelector(value runtime.String) QuerySelector

func ToQuerySelector

func ToQuerySelector(value runtime.Value) (QuerySelector, error)

func (QuerySelector) MarshalJSON

func (q QuerySelector) MarshalJSON() ([]byte, error)

func (QuerySelector) String

func (q QuerySelector) String() string

type QuerySelectorKind

type QuerySelectorKind int
const (
	UnknownSelector QuerySelectorKind = iota
	CSSSelector
	XPathSelector
)

func (QuerySelectorKind) String

func (v QuerySelectorKind) String() string

type QueryTarget

type QueryTarget interface {
	QuerySelector(ctx context.Context, selector QuerySelector) (runtime.Value, error)
	QuerySelectorAll(ctx context.Context, selector QuerySelector) (runtime.List, error)
	CountBySelector(ctx context.Context, selector QuerySelector) (runtime.Int, error)
	ExistsBySelector(ctx context.Context, selector QuerySelector) (runtime.Boolean, error)
	XPath(ctx context.Context, expression runtime.String) (runtime.Value, error)
}

func ToQueryTarget

func ToQueryTarget(value runtime.Value) (QueryTarget, error)

type RelationTarget

type RelationTarget interface {
	GetPreviousElementSibling(ctx context.Context) (runtime.Value, error)
	GetNextElementSibling(ctx context.Context) (runtime.Value, error)
	GetParentElement(ctx context.Context) (runtime.Value, error)
}

func ToRelationTarget

func ToRelationTarget(value runtime.Value) (RelationTarget, error)

type ResourceFilter

type ResourceFilter struct {
	URL  string `json:"url"`
	Type string `json:"type"`
}

type SameSite

type SameSite int

SameSite Polyfill for Go 1.10

const (
	SameSiteDefaultMode SameSite = iota + 1
	SameSiteLaxMode
	SameSiteStrictMode
)

func (SameSite) String

func (s SameSite) String() string

type ScreenshotFormat

type ScreenshotFormat string

ScreenshotFormat represents the format of a screenshot.

const (
	// ScreenshotFormatPNG represents the PNG format for screenshots.
	ScreenshotFormatPNG ScreenshotFormat = "png"

	// ScreenshotFormatJPEG represents the JPEG format for screenshots.
	ScreenshotFormatJPEG ScreenshotFormat = "jpeg"
)

Screenshot formats.

type ScreenshotParams

type ScreenshotParams struct {
	Format  ScreenshotFormat
	X       runtime.Float
	Y       runtime.Float
	Width   runtime.Float
	Height  runtime.Float
	Quality runtime.Int
}

ScreenshotParams defines parameters for the screenshot function.

type ScrollBehavior

type ScrollBehavior string

ScrollBehavior defines the transition animation. In HTML specification, default Value is auto, but in Ferret it's instant. More details here https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

const (
	ScrollBehaviorInstant ScrollBehavior = "instant"
	ScrollBehaviorSmooth  ScrollBehavior = "smooth"
	ScrollBehaviorAuto    ScrollBehavior = "auto"
)

func NewScrollBehavior

func NewScrollBehavior(value string) ScrollBehavior

func (ScrollBehavior) MarshalJSON

func (b ScrollBehavior) MarshalJSON() ([]byte, error)

func (ScrollBehavior) String

func (b ScrollBehavior) String() string

type ScrollHorizontalAlignment

type ScrollHorizontalAlignment string

ScrollHorizontalAlignment defines horizontal alignment after scrolling. In HTML specification, default Value is nearest, but in Ferret it's center. More details here https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

const (
	ScrollHorizontalAlignmentCenter  ScrollHorizontalAlignment = "center"
	ScrollHorizontalAlignmentStart   ScrollHorizontalAlignment = "start"
	ScrollHorizontalAlignmentEnd     ScrollHorizontalAlignment = "end"
	ScrollHorizontalAlignmentNearest ScrollHorizontalAlignment = "nearest"
)

func NewScrollHorizontalAlignment

func NewScrollHorizontalAlignment(value string) ScrollHorizontalAlignment

func (ScrollHorizontalAlignment) MarshalJSON

func (a ScrollHorizontalAlignment) MarshalJSON() ([]byte, error)

func (ScrollHorizontalAlignment) String

func (a ScrollHorizontalAlignment) String() string

type ScrollOptions

type ScrollOptions struct {
	Behavior ScrollBehavior            `json:"behavior"`
	Block    ScrollVerticalAlignment   `json:"block"`
	Inline   ScrollHorizontalAlignment `json:"inline"`
	Top      runtime.Float             `json:"top"`
	Left     runtime.Float             `json:"left"`
}

ScrollOptions defines how scroll animation should be performed.

type ScrollVerticalAlignment

type ScrollVerticalAlignment string

ScrollVerticalAlignment defines vertical alignment after scrolling. In HTML specification, default Value is start, but in Ferret it's center. More details here https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

const (
	ScrollVerticalAlignmentCenter  ScrollVerticalAlignment = "center"
	ScrollVerticalAlignmentStart   ScrollVerticalAlignment = "start"
	ScrollVerticalAlignmentEnd     ScrollVerticalAlignment = "end"
	ScrollVerticalAlignmentNearest ScrollVerticalAlignment = "nearest"
)

func NewScrollVerticalAlignment

func NewScrollVerticalAlignment(value string) ScrollVerticalAlignment

func (ScrollVerticalAlignment) MarshalJSON

func (a ScrollVerticalAlignment) MarshalJSON() ([]byte, error)

func (ScrollVerticalAlignment) String

func (a ScrollVerticalAlignment) String() string

type StatusCodeFilter

type StatusCodeFilter struct {
	URL  string `json:"url"`
	Code int    `json:"code"`
}

type StyleTarget

type StyleTarget interface {
	GetStyles(ctx context.Context) (runtime.Map, error)
	GetStyle(ctx context.Context, name runtime.String) (runtime.Value, error)
	SetStyles(ctx context.Context, values runtime.Map) error
	SetStyle(ctx context.Context, name, value runtime.String) error
	RemoveStyle(ctx context.Context, name ...runtime.String) error
}

func ToStyleTarget

func ToStyleTarget(value runtime.Value) (StyleTarget, error)

type ValueTarget

type ValueTarget interface {
	GetValue(ctx context.Context) (runtime.Value, error)
	SetValue(ctx context.Context, value runtime.Value) error
}

func ToValueTarget

func ToValueTarget(value runtime.Value) (ValueTarget, error)

type Viewport

type Viewport struct {
	Height      int     `json:"height"`
	Width       int     `json:"width"`
	ScaleFactor float64 `json:"scaleFactor"`
	Mobile      bool    `json:"mobile"`
	Landscape   bool    `json:"landscape"`
}

type WaitEvent

type WaitEvent int

WaitEvent is an enum that represents what event is needed to wait for.

type WaitTarget

type WaitTarget interface {
	WaitForElement(ctx context.Context, selector QuerySelector, when WaitEvent) error
	WaitForElementAll(ctx context.Context, selector QuerySelector, when WaitEvent) error
	WaitForAttribute(ctx context.Context, name runtime.String, value runtime.Value, when WaitEvent) error
	WaitForAttributeBySelector(ctx context.Context, selector QuerySelector, name runtime.String, value runtime.Value, when WaitEvent) error
	WaitForAttributeBySelectorAll(ctx context.Context, selector QuerySelector, name runtime.String, value runtime.Value, when WaitEvent) error
	WaitForStyle(ctx context.Context, name runtime.String, value runtime.Value, when WaitEvent) error
	WaitForStyleBySelector(ctx context.Context, selector QuerySelector, name runtime.String, value runtime.Value, when WaitEvent) error
	WaitForStyleBySelectorAll(ctx context.Context, selector QuerySelector, name runtime.String, value runtime.Value, when WaitEvent) error
	WaitForClass(ctx context.Context, class runtime.String, when WaitEvent) error
	WaitForClassBySelector(ctx context.Context, selector QuerySelector, class runtime.String, when WaitEvent) error
	WaitForClassBySelectorAll(ctx context.Context, selector QuerySelector, class runtime.String, when WaitEvent) error
}

func ToWaitTarget

func ToWaitTarget(value runtime.Value) (WaitTarget, error)

Directories

Path Synopsis
cdp
Package cdp implements the Chrome DevTools Protocol HTML driver.
Package cdp implements the Chrome DevTools Protocol HTML driver.
dom
Package dom provides DOM helpers for the CDP HTML driver.
Package dom provides DOM helpers for the CDP HTML driver.
eval
Package eval builds JavaScript evaluation helpers for the CDP HTML driver.
Package eval builds JavaScript evaluation helpers for the CDP HTML driver.
events
Package events provides event stream helpers for the CDP HTML driver.
Package events provides event stream helpers for the CDP HTML driver.
input
Package input provides input emulation helpers for the CDP HTML driver.
Package input provides input emulation helpers for the CDP HTML driver.
network
Package network provides network management for the CDP HTML driver.
Package network provides network management for the CDP HTML driver.
session
Package session manages page-scoped CDP target sessions for the HTML driver.
Package session manages page-scoped CDP target sessions for the HTML driver.
templates
Package templates provides JavaScript templates for the CDP HTML driver.
Package templates provides JavaScript templates for the CDP HTML driver.
utils
Package utils provides utility helpers for the CDP HTML driver.
Package utils provides utility helpers for the CDP HTML driver.
internal
cssx
Package cssx compiles and validates CSSX expressions for HTML drivers.
Package cssx compiles and validates CSSX expressions for HTML drivers.
data
Package data provides runtime value access helpers for HTML driver objects.
Package data provides runtime value access helpers for HTML driver objects.
frameutil
Package frameutil provides helpers for walking HTML document frame trees.
Package frameutil provides helpers for walking HTML document frame trees.
lazy
Package lazy provides lazy-loaded runtime values for HTML drivers.
Package lazy provides lazy-loaded runtime values for HTML drivers.
nodeutil
Package nodeutil provides helpers for HTML node metadata and empty values.
Package nodeutil provides helpers for HTML node metadata and empty values.
query
Package query parses HTML query selector kinds.
Package query parses HTML query selector kinds.
Package memory implements the in-memory HTML driver.
Package memory implements the in-memory HTML driver.

Jump to

Keyboard shortcuts

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