drivers

package
v0.0.0-...-1479fa0 Latest Latest
Warning

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

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

Documentation

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](pkg, "HTTPRequest")
	HTTPResponseType = runtime.NewTypeFor[*HTTPResponse](pkg, "HTTPResponse")
	HTTPHeadersType  = runtime.NewTypeFor[*HTTPHeaders](pkg, "HTTPHeaders")
	HTTPCookieType   = runtime.NewTypeFor[*HTTPCookie](pkg, "HTTPCookie")
	HTTPCookiesType  = runtime.NewTypeFor[*HTTPCookies](pkg, "HTTPCookies")
	HTMLElementType  = runtime.NewTypeFor[HTMLElement](pkg, "HTMLElement")
	HTMLDocumentType = runtime.NewTypeFor[HTMLDocument](pkg, "HTMLDocument")
	HTMLPageType     = runtime.NewTypeFor[HTMLPage](pkg, "HTMLPage")
)

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

func WithContext

func WithContext(ctx context.Context, drv Driver, opts ...GlobalOption) context.Context

Types

type Container

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

func NewContainer

func NewContainer() *Container

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, opts ...GlobalOption) error

func (*Container) Remove

func (c *Container) Remove(name string)

func (*Container) WithContext

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

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 DriverEntry

type DriverEntry struct {
	Driver  Driver
	Options []GlobalOption
}

type GlobalOption

type GlobalOption func(drv Driver, opts *globalOptions)

func AsDefault

func AsDefault() GlobalOption

type HTMLDocument

type HTMLDocument interface {
	HTMLNode

	GetTitle() runtime.String

	GetElement() HTMLElement

	GetURL() runtime.String

	GetName() runtime.String

	GetParentDocument(ctx context.Context) (HTMLDocument, error)

	GetChildDocuments(ctx context.Context) (runtime.List, error)

	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 ToDocument

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

type HTMLElement

type HTMLElement interface {
	HTMLNode

	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

	GetValue(ctx context.Context) (runtime.Value, error)

	SetValue(ctx context.Context, value runtime.Value) error

	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

	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

	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)

	GetPreviousElementSibling(ctx context.Context) (runtime.Value, error)

	GetNextElementSibling(ctx context.Context) (runtime.Value, error)

	GetParentElement(ctx context.Context) (runtime.Value, error)

	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

	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
}

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

type HTMLNode interface {
	runtime.Value
	runtime.Iterable
	runtime.KeyReadable
	runtime.KeyWritable
	runtime.Measurable
	runtime.Queryable
	runtime.Dispatchable
	io.Closer

	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)

	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)
}

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

type HTMLPage interface {
	runtime.Value
	runtime.Iterable
	runtime.KeyReadable
	runtime.KeyWritable
	runtime.Measurable
	runtime.Observable
	runtime.Dispatchable
	io.Closer

	IsClosed() runtime.Boolean

	GetURL() runtime.String

	GetMainFrame() HTMLDocument

	GetFrames(ctx context.Context) (runtime.List, error)

	GetFrame(ctx context.Context, idx runtime.Int) (runtime.Value, error)

	GetCookies(ctx context.Context) (*HTTPCookies, error)

	SetCookies(ctx context.Context, cookies *HTTPCookies) error

	DeleteCookies(ctx context.Context, cookies *HTTPCookies) error

	GetResponse(ctx context.Context) (HTTPResponse, error)

	PrintToPDF(ctx context.Context, params PDFParams) (runtime.Binary, error)

	CaptureScreenshot(ctx context.Context, params ScreenshotParams) (runtime.Binary, error)

	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)
}

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 {
	Name     string    `json:"name"`
	Value    string    `json:"Value"`
	Path     string    `json:"path"`
	Domain   string    `json:"domain"`
	Expires  time.Time `json:"expires"`
	MaxAge   int       `json:"maxAge"`
	Secure   bool      `json:"secure"`
	HTTPOnly bool      `json:"HTTPOnly"`
	SameSite SameSite  `json:"sameSite"`
}

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) 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) 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 {
	URL          string
	StatusCode   int
	Status       string
	Headers      *HTTPHeaders
	Body         []byte
	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 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 {
	Name      string       `json:"name"`
	Proxy     string       `json:"proxy"`
	UserAgent string       `json:"userAgent"`
	Headers   *HTTPHeaders `json:"headers"`
	Cookies   *HTTPCookies `json:"cookies"`
}

type PDFParams

type PDFParams struct {
	// Paper orientation. Defaults to false.
	Landscape runtime.Boolean `json:"landscape"`
	// Display Data and footer. Defaults to false.
	DisplayHeaderFooter runtime.Boolean `json:"displayHeaderFooter"`
	// Print background graphics. Defaults to false.
	PrintBackground runtime.Boolean `json:"printBackground"`
	// Scale of the webpage rendering. Defaults to 1.
	Scale runtime.Float `json:"scale"`
	// Paper width in inches. Defaults to 8.5 inches.
	PaperWidth runtime.Float `json:"paperWidth"`
	// Paper height in inches. Defaults to 11 inches.
	PaperHeight runtime.Float `json:"paperHeight"`
	// Top margin in inches. Defaults to 1cm (~0.4 inches).
	MarginTop runtime.Float `json:"marginTop"`
	// Bottom margin in inches. Defaults to 1cm (~0.4 inches).
	MarginBottom runtime.Float `json:"marginBottom"`
	// Left margin in inches. Defaults to 1cm (~0.4 inches).
	MarginLeft runtime.Float `json:"marginLeft"`
	// Right margin in inches. Defaults to 1cm (~0.4 inches).
	MarginRight runtime.Float `json:"marginRight"`
	// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
	PageRanges runtime.String `json:"pageRanges"`
	// HTML template for the print runtime. Should be valid HTML markup with following classes used to inject printing Data into them: - `date`: formatted print date - `title`: document title - `url`: document location - `pageNumber`: current page number - `totalPages`: total pages in the document
	// For example, `<span class=title></span>` would generate span containing the title.
	HeaderTemplate runtime.String `json:"headerTemplate"`
	// HTML template for the print footer. Should use the same format as the `headerTemplate`.
	FooterTemplate runtime.String `json:"footerTemplate"`
	// Whether or not to prefer page size as defined by css.
	// Defaults to false, in which case the content will be scaled to fit the paper size.
	PreferCSSPageSize runtime.Boolean `json:"preferCSSPageSize"`
}

PDFParams represents the arguments for PrintToPDF function.

func NewDefaultHTMLPDFParams

func NewDefaultHTMLPDFParams() PDFParams

type Params

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

func SetDefaultParams

func SetDefaultParams(opts *Options, params Params) Params

type ParseParams

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

type QuerySelector

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

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 ResourceFilter

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

type SameSite

type SameSite int

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 {
	X       runtime.Float
	Y       runtime.Float
	Width   runtime.Float
	Height  runtime.Float
	Format  ScreenshotFormat
	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 {
	Top      runtime.Float             `json:"top"`
	Left     runtime.Float             `json:"left"`
	Behavior ScrollBehavior            `json:"behavior"`
	Block    ScrollVerticalAlignment   `json:"block"`
	Inline   ScrollHorizontalAlignment `json:"inline"`
}

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 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

Directories

Path Synopsis
cdp
dom

Jump to

Keyboard shortcuts

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