drivers

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 18 Imported by: 40

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   = core.NewType("ferret.drivers.HTTPRequest")
	HTTPResponseType  = core.NewType("ferret.drivers.HTTPResponse")
	HTTPHeaderType    = core.NewType("ferret.drivers.HTTPHeaders")
	HTTPCookieType    = core.NewType("ferret.drivers.HTTPCookie")
	HTTPCookiesType   = core.NewType("ferret.drivers.HTTPCookies")
	HTMLElementType   = core.NewType("ferret.drivers.HTMLElement")
	HTMLDocumentType  = core.NewType("ferret.drivers.HTMLDocument")
	HTMLPageType      = core.NewType("ferret.drivers.HTMLPageType")
	QuerySelectorType = core.NewType("ferret.drivers.QuerySelector")
)

Functions

func Compare added in v0.7.0

func Compare(first, second core.Type) int64

func IsScreenshotFormatValid added in v0.7.0

func IsScreenshotFormatValid(format string) bool

func WithContext added in v0.7.0

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

Types

type Container added in v0.15.0

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

func NewContainer added in v0.15.0

func NewContainer() *Container

func (*Container) Get added in v0.15.0

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

func (*Container) GetAll added in v0.15.0

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

func (*Container) Has added in v0.15.0

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

func (*Container) Register added in v0.15.0

func (c *Container) Register(drv Driver, opts ...GlobalOption) error

func (*Container) Remove added in v0.15.0

func (c *Container) Remove(name string)

func (*Container) WithContext added in v0.16.0

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

type Driver added in v0.7.0

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 added in v0.7.0

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

type DriverEntry added in v0.16.0

type DriverEntry struct {
	Driver  Driver
	Options []GlobalOption
}

type GlobalOption added in v0.14.1

type GlobalOption func(drv Driver, opts *globalOptions)

func AsDefault added in v0.7.0

func AsDefault() GlobalOption

type HTMLDocument added in v0.7.0

type HTMLDocument interface {
	HTMLNode

	GetTitle() values.String

	GetElement() HTMLElement

	GetURL() values.String

	GetName() values.String

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

	GetChildDocuments(ctx context.Context) (*values.Array, 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 values.Float) error
}

func ToDocument added in v0.8.0

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

type HTMLElement added in v0.7.0

type HTMLElement interface {
	HTMLNode

	GetInnerText(ctx context.Context) (values.String, error)

	SetInnerText(ctx context.Context, innerText values.String) error

	GetInnerHTML(ctx context.Context) (values.String, error)

	SetInnerHTML(ctx context.Context, innerHTML values.String) error

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

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

	GetStyles(ctx context.Context) (*values.Object, error)

	GetStyle(ctx context.Context, name values.String) (core.Value, error)

	SetStyles(ctx context.Context, values *values.Object) error

	SetStyle(ctx context.Context, name, value values.String) error

	RemoveStyle(ctx context.Context, name ...values.String) error

	GetAttributes(ctx context.Context) (*values.Object, error)

	GetAttribute(ctx context.Context, name values.String) (core.Value, error)

	SetAttributes(ctx context.Context, values *values.Object) error

	SetAttribute(ctx context.Context, name, value values.String) error

	RemoveAttribute(ctx context.Context, name ...values.String) error

	GetInnerHTMLBySelector(ctx context.Context, selector QuerySelector) (values.String, error)

	SetInnerHTMLBySelector(ctx context.Context, selector QuerySelector, innerHTML values.String) error

	GetInnerHTMLBySelectorAll(ctx context.Context, selector QuerySelector) (*values.Array, error)

	GetInnerTextBySelector(ctx context.Context, selector QuerySelector) (values.String, error)

	SetInnerTextBySelector(ctx context.Context, selector QuerySelector, innerText values.String) error

	GetInnerTextBySelectorAll(ctx context.Context, selector QuerySelector) (*values.Array, error)

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

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

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

	Click(ctx context.Context, count values.Int) error

	ClickBySelector(ctx context.Context, selector QuerySelector, count values.Int) error

	ClickBySelectorAll(ctx context.Context, selector QuerySelector, count values.Int) error

	Clear(ctx context.Context) error

	ClearBySelector(ctx context.Context, selector QuerySelector) error

	Input(ctx context.Context, value core.Value, delay values.Int) error

	InputBySelector(ctx context.Context, selector QuerySelector, value core.Value, delay values.Int) error

	Press(ctx context.Context, keys []values.String, count values.Int) error

	PressBySelector(ctx context.Context, selector QuerySelector, keys []values.String, count values.Int) error

	Select(ctx context.Context, value *values.Array) (*values.Array, error)

	SelectBySelector(ctx context.Context, selector QuerySelector, value *values.Array) (*values.Array, 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 values.String, value core.Value, when WaitEvent) error

	WaitForAttributeBySelector(ctx context.Context, selector QuerySelector, name values.String, value core.Value, when WaitEvent) error

	WaitForAttributeBySelectorAll(ctx context.Context, selector QuerySelector, name values.String, value core.Value, when WaitEvent) error

	WaitForStyle(ctx context.Context, name values.String, value core.Value, when WaitEvent) error

	WaitForStyleBySelector(ctx context.Context, selector QuerySelector, name values.String, value core.Value, when WaitEvent) error

	WaitForStyleBySelectorAll(ctx context.Context, selector QuerySelector, name values.String, value core.Value, when WaitEvent) error

	WaitForClass(ctx context.Context, class values.String, when WaitEvent) error

	WaitForClassBySelector(ctx context.Context, selector QuerySelector, class values.String, when WaitEvent) error

	WaitForClassBySelectorAll(ctx context.Context, selector QuerySelector, class values.String, when WaitEvent) error
}

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

func ToElement added in v0.8.0

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

type HTMLNode added in v0.7.0

type HTMLNode interface {
	core.Value
	core.Iterable
	core.Getter
	core.Setter
	collections.Measurable
	io.Closer

	GetNodeType(ctx context.Context) (values.Int, error)

	GetNodeName(ctx context.Context) (values.String, error)

	GetChildNodes(ctx context.Context) (*values.Array, error)

	GetChildNode(ctx context.Context, idx values.Int) (core.Value, error)

	QuerySelector(ctx context.Context, selector QuerySelector) (core.Value, error)

	QuerySelectorAll(ctx context.Context, selector QuerySelector) (*values.Array, error)

	CountBySelector(ctx context.Context, selector QuerySelector) (values.Int, error)

	ExistsBySelector(ctx context.Context, selector QuerySelector) (values.Boolean, error)

	XPath(ctx context.Context, expression values.String) (core.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 added in v0.8.0

type HTMLPage interface {
	core.Value
	core.Iterable
	core.Getter
	core.Setter
	collections.Measurable
	events.Observable
	io.Closer

	IsClosed() values.Boolean

	GetURL() values.String

	GetMainFrame() HTMLDocument

	GetFrames(ctx context.Context) (*values.Array, error)

	GetFrame(ctx context.Context, idx values.Int) (core.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) (values.Binary, error)

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

	WaitForNavigation(ctx context.Context, targetURL values.String) error

	WaitForFrameNavigation(ctx context.Context, frame HTMLDocument, targetURL values.String) error

	Navigate(ctx context.Context, url values.String) error

	NavigateBack(ctx context.Context, skip values.Int) (values.Boolean, error)

	NavigateForward(ctx context.Context, skip values.Int) (values.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 added in v0.8.0

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

type HTTPCookie added in v0.7.0

type HTTPCookie struct {
	Name     string
	Value    string
	Path     string
	Domain   string
	Expires  time.Time
	MaxAge   int
	Secure   bool
	HTTPOnly bool
	SameSite SameSite
}

HTTPCookie HTTPCookie object

func (HTTPCookie) Compare added in v0.7.0

func (c HTTPCookie) Compare(other core.Value) int64

func (HTTPCookie) Copy added in v0.7.0

func (c HTTPCookie) Copy() core.Value

func (HTTPCookie) GetIn added in v0.7.0

func (c HTTPCookie) GetIn(_ context.Context, path []core.Value) (core.Value, core.PathError)

func (HTTPCookie) Hash added in v0.7.0

func (c HTTPCookie) Hash() uint64

func (HTTPCookie) MarshalJSON added in v0.7.0

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

func (HTTPCookie) String added in v0.7.0

func (c HTTPCookie) String() string

func (HTTPCookie) Type added in v0.7.0

func (c HTTPCookie) Type() core.Type

func (HTTPCookie) Unwrap added in v0.7.0

func (c HTTPCookie) Unwrap() interface{}

type HTTPCookies added in v0.9.0

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

func NewHTTPCookies added in v0.10.0

func NewHTTPCookies() *HTTPCookies

func NewHTTPCookiesWith added in v0.14.1

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

func (*HTTPCookies) Clone added in v0.14.1

func (c *HTTPCookies) Clone() core.Cloneable

func (*HTTPCookies) Compare added in v0.10.0

func (c *HTTPCookies) Compare(other core.Value) int64

func (*HTTPCookies) Copy added in v0.10.0

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

func (*HTTPCookies) ForEach added in v0.14.1

func (c *HTTPCookies) ForEach(predicate func(value HTTPCookie, key values.String) bool)

func (*HTTPCookies) Get added in v0.10.0

func (*HTTPCookies) GetIn added in v0.10.0

func (c *HTTPCookies) GetIn(ctx context.Context, path []core.Value) (core.Value, core.PathError)

func (*HTTPCookies) Hash added in v0.10.0

func (c *HTTPCookies) Hash() uint64

func (*HTTPCookies) Keys added in v0.10.0

func (c *HTTPCookies) Keys() []values.String

func (*HTTPCookies) Length added in v0.10.0

func (c *HTTPCookies) Length() values.Int

func (*HTTPCookies) MarshalJSON added in v0.10.0

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

func (*HTTPCookies) Set added in v0.10.0

func (c *HTTPCookies) Set(cookie HTTPCookie)

func (*HTTPCookies) String added in v0.10.0

func (c *HTTPCookies) String() string

func (*HTTPCookies) Type added in v0.10.0

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

func (*HTTPCookies) Unwrap added in v0.10.0

func (c *HTTPCookies) Unwrap() interface{}

func (*HTTPCookies) Values added in v0.14.1

func (c *HTTPCookies) Values() []HTTPCookie

type HTTPHeaders added in v0.8.2

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

HTTPHeaders HTTP header object

func NewHTTPHeaders added in v0.8.2

func NewHTTPHeaders() *HTTPHeaders

func NewHTTPHeadersWith added in v0.14.1

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

func (*HTTPHeaders) Clone added in v0.14.1

func (h *HTTPHeaders) Clone() core.Cloneable

func (*HTTPHeaders) Compare added in v0.8.2

func (h *HTTPHeaders) Compare(other core.Value) int64

func (*HTTPHeaders) Copy added in v0.8.2

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

func (*HTTPHeaders) ForEach added in v0.14.1

func (h *HTTPHeaders) ForEach(predicate func(value []string, key string) bool)

func (*HTTPHeaders) Get added in v0.8.2

func (h *HTTPHeaders) Get(key string) string

func (*HTTPHeaders) GetIn added in v0.8.2

func (h *HTTPHeaders) GetIn(_ context.Context, path []core.Value) (core.Value, core.PathError)

func (*HTTPHeaders) Hash added in v0.8.2

func (h *HTTPHeaders) Hash() uint64

func (*HTTPHeaders) Length added in v0.14.1

func (h *HTTPHeaders) Length() values.Int

func (*HTTPHeaders) MarshalJSON added in v0.8.2

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

func (*HTTPHeaders) Set added in v0.8.2

func (h *HTTPHeaders) Set(key, value string)

func (*HTTPHeaders) SetArr added in v0.14.1

func (h *HTTPHeaders) SetArr(key string, value []string)

func (*HTTPHeaders) String added in v0.8.2

func (h *HTTPHeaders) String() string

func (*HTTPHeaders) Type added in v0.8.2

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

func (*HTTPHeaders) Unwrap added in v0.8.2

func (h *HTTPHeaders) Unwrap() interface{}

type HTTPRequest added in v0.16.0

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

HTTPRequest HTTP request object.

func (*HTTPRequest) Compare added in v0.16.0

func (req *HTTPRequest) Compare(other core.Value) int64

func (*HTTPRequest) Copy added in v0.16.0

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

func (*HTTPRequest) GetIn added in v0.16.0

func (req *HTTPRequest) GetIn(ctx context.Context, path []core.Value) (core.Value, core.PathError)

func (*HTTPRequest) Hash added in v0.16.0

func (req *HTTPRequest) Hash() uint64

func (*HTTPRequest) MarshalJSON added in v0.16.0

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

func (*HTTPRequest) String added in v0.16.0

func (req *HTTPRequest) String() string

func (*HTTPRequest) Type added in v0.16.0

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

func (*HTTPRequest) Unwrap added in v0.16.0

func (req *HTTPRequest) Unwrap() interface{}

type HTTPResponse added in v0.10.0

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

HTTPResponse HTTP response object.

func (*HTTPResponse) Compare added in v0.10.0

func (resp *HTTPResponse) Compare(other core.Value) int64

func (*HTTPResponse) Copy added in v0.10.0

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

func (*HTTPResponse) GetIn added in v0.10.0

func (resp *HTTPResponse) GetIn(ctx context.Context, path []core.Value) (core.Value, core.PathError)

func (*HTTPResponse) Hash added in v0.10.0

func (resp *HTTPResponse) Hash() uint64

func (*HTTPResponse) MarshalJSON added in v0.10.0

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

func (*HTTPResponse) String added in v0.10.0

func (resp *HTTPResponse) String() string

func (*HTTPResponse) Type added in v0.10.0

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

func (*HTTPResponse) Unwrap added in v0.10.0

func (resp *HTTPResponse) Unwrap() interface{}

type Ignore added in v0.14.0

type Ignore struct {
	Resources   []ResourceFilter
	StatusCodes []StatusCodeFilter
}

type Option added in v0.7.0

type Option func(opts *Options)

func WithCookie added in v0.14.1

func WithCookie(cookie HTTPCookie) Option

func WithCookies added in v0.14.1

func WithCookies(cookies []HTTPCookie) Option

func WithCustomName added in v0.14.1

func WithCustomName(name string) Option

func WithHeader added in v0.14.1

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

func WithHeaders added in v0.14.1

func WithHeaders(headers *HTTPHeaders) Option

func WithProxy added in v0.14.1

func WithProxy(address string) Option

func WithUserAgent added in v0.14.1

func WithUserAgent(value string) Option

type Options added in v0.14.1

type Options struct {
	Name      string
	Proxy     string
	UserAgent string
	Headers   *HTTPHeaders
	Cookies   *HTTPCookies
}

type PDFParams added in v0.7.0

type PDFParams struct {
	// Paper orientation. Defaults to false.
	Landscape values.Boolean
	// Display values and footer. Defaults to false.
	DisplayHeaderFooter values.Boolean
	// Print background graphics. Defaults to false.
	PrintBackground values.Boolean
	// Scale of the webpage rendering. Defaults to 1.
	Scale values.Float
	// Paper width in inches. Defaults to 8.5 inches.
	PaperWidth values.Float
	// Paper height in inches. Defaults to 11 inches.
	PaperHeight values.Float
	// Top margin in inches. Defaults to 1cm (~0.4 inches).
	MarginTop values.Float
	// Bottom margin in inches. Defaults to 1cm (~0.4 inches).
	MarginBottom values.Float
	// Left margin in inches. Defaults to 1cm (~0.4 inches).
	MarginLeft values.Float
	// Right margin in inches. Defaults to 1cm (~0.4 inches).
	MarginRight values.Float
	// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
	PageRanges values.String
	// HTML template for the print values. Should be valid HTML markup with following classes used to inject printing values 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 values.String
	// HTML template for the print footer. Should use the same format as the `headerTemplate`.
	FooterTemplate values.String
	// 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 values.Boolean
}

PDFParams represents the arguments for PrintToPDF function.

func NewDefaultHTMLPDFParams added in v0.7.0

func NewDefaultHTMLPDFParams() PDFParams

type Params added in v0.8.0

type Params struct {
	URL         string
	UserAgent   string
	KeepCookies bool
	Cookies     *HTTPCookies
	Headers     *HTTPHeaders
	Viewport    *Viewport
	Charset     string
	Ignore      *Ignore
}

func SetDefaultParams added in v0.14.1

func SetDefaultParams(opts *Options, params Params) Params

type ParseParams added in v0.10.0

type ParseParams struct {
	Content     []byte
	KeepCookies bool
	Cookies     *HTTPCookies
	Headers     *HTTPHeaders
	Viewport    *Viewport
}

type QuerySelector added in v0.16.0

type QuerySelector struct {
	core.Value
	// contains filtered or unexported fields
}

func NewCSSSelector added in v0.16.0

func NewCSSSelector(value values.String) QuerySelector

func NewXPathSelector added in v0.16.0

func NewXPathSelector(value values.String) QuerySelector

func ToQuerySelector added in v0.16.0

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

func (QuerySelector) Compare added in v0.16.0

func (q QuerySelector) Compare(other core.Value) int64

func (QuerySelector) Copy added in v0.16.0

func (q QuerySelector) Copy() core.Value

func (QuerySelector) Hash added in v0.16.0

func (q QuerySelector) Hash() uint64

func (QuerySelector) Kind added in v0.16.0

func (QuerySelector) MarshalJSON added in v0.16.0

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

func (QuerySelector) String added in v0.16.0

func (q QuerySelector) String() string

func (QuerySelector) Type added in v0.16.0

func (q QuerySelector) Type() core.Type

func (QuerySelector) Unwrap added in v0.16.0

func (q QuerySelector) Unwrap() interface{}

type QuerySelectorKind added in v0.16.0

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

func (QuerySelectorKind) String added in v0.16.0

func (v QuerySelectorKind) String() string

type ResourceFilter added in v0.14.0

type ResourceFilter struct {
	URL  string
	Type string
}

type SameSite added in v0.7.0

type SameSite int

Polyfill for Go 1.10

const (
	SameSiteDefaultMode SameSite = iota + 1
	SameSiteLaxMode
	SameSiteStrictMode
)

func (SameSite) String added in v0.8.0

func (s SameSite) String() string

type ScreenshotFormat added in v0.7.0

type ScreenshotFormat string
const (
	ScreenshotFormatPNG  ScreenshotFormat = "png"
	ScreenshotFormatJPEG ScreenshotFormat = "jpeg"
)

type ScreenshotParams added in v0.7.0

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

type ScrollBehavior added in v0.11.0

type ScrollBehavior int

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 = 0
	ScrollBehaviorSmooth  ScrollBehavior = 1
	ScrollBehaviorAuto    ScrollBehavior = 2
)

func NewScrollBehavior added in v0.11.0

func NewScrollBehavior(value string) ScrollBehavior

func (ScrollBehavior) MarshalJSON added in v0.16.0

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

func (ScrollBehavior) String added in v0.11.0

func (b ScrollBehavior) String() string

type ScrollHorizontalAlignment added in v0.11.0

type ScrollHorizontalAlignment int

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 = 0
	ScrollHorizontalAlignmentStart   ScrollHorizontalAlignment = 1
	ScrollHorizontalAlignmentEnd     ScrollHorizontalAlignment = 2
	ScrollHorizontalAlignmentNearest ScrollHorizontalAlignment = 3
)

func NewScrollHorizontalAlignment added in v0.11.0

func NewScrollHorizontalAlignment(value string) ScrollHorizontalAlignment

func (ScrollHorizontalAlignment) MarshalJSON added in v0.16.0

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

func (ScrollHorizontalAlignment) String added in v0.11.0

func (a ScrollHorizontalAlignment) String() string

type ScrollOptions added in v0.11.0

type ScrollOptions struct {
	Top      values.Float              `json:"top"`
	Left     values.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 added in v0.11.0

type ScrollVerticalAlignment int

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 = 0
	ScrollVerticalAlignmentStart   ScrollVerticalAlignment = 1
	ScrollVerticalAlignmentEnd     ScrollVerticalAlignment = 2
	ScrollVerticalAlignmentNearest ScrollVerticalAlignment = 3
)

func NewScrollVerticalAlignment added in v0.11.0

func NewScrollVerticalAlignment(value string) ScrollVerticalAlignment

func (ScrollVerticalAlignment) MarshalJSON added in v0.16.0

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

func (ScrollVerticalAlignment) String added in v0.11.0

func (a ScrollVerticalAlignment) String() string

type StatusCodeFilter added in v0.14.0

type StatusCodeFilter struct {
	URL  string
	Code int
}

type Viewport added in v0.8.0

type Viewport struct {
	Height      int
	Width       int
	ScaleFactor float64
	Mobile      bool
	Landscape   bool
}

type WaitEvent added in v0.7.0

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