Documentation
¶
Overview ¶
Package drivers defines shared HTML driver interfaces, values, and options.
Index ¶
- Constants
- Variables
- func Compare(first, second runtime.Type) int
- func CompareTo(first runtime.Type, second runtime.Value) int
- func CompareTypes(first, second runtime.Value) int
- func IsScreenshotFormatValid(format string) bool
- func NewHTTPHeadersProxy(header *HTTPHeaders) runtime.Value
- type AttributeTarget
- type Container
- func (c *Container) Default() (Driver, bool)
- func (c *Container) Get(name string) (Driver, bool)
- func (c *Container) GetAll() []Driver
- func (c *Container) Has(name string) bool
- func (c *Container) Register(drv Driver) error
- func (c *Container) Remove(name string)
- func (c *Container) SetDefault(name string)
- func (c *Container) WithContext(ctx context.Context) context.Context
- type ContentTarget
- type DocumentMetadataTarget
- type DocumentViewportTarget
- type Driver
- type HTMLDocument
- type HTMLElement
- type HTMLNode
- type HTMLPage
- type HTTPCookie
- func (c HTTPCookie) Compare(other runtime.Value) int
- func (c HTTPCookie) Copy() runtime.Value
- func (c HTTPCookie) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (c HTTPCookie) Hash() uint64
- func (c HTTPCookie) MarshalJSON() ([]byte, error)
- func (c HTTPCookie) String() string
- func (c HTTPCookie) Type() runtime.Type
- type HTTPCookies
- func (c *HTTPCookies) Copy() runtime.Value
- func (c *HTTPCookies) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (c *HTTPCookies) Hash() uint64
- func (c *HTTPCookies) Iterate(_ context.Context) (runtime.Iterator, error)
- func (c *HTTPCookies) MarshalJSON() ([]byte, error)
- func (c *HTTPCookies) Set(_ context.Context, key, value runtime.Value) error
- func (c *HTTPCookies) SetCookie(cookie HTTPCookie)
- func (c *HTTPCookies) String() string
- func (c *HTTPCookies) Type() runtime.Type
- type HTTPHeaders
- func (h *HTTPHeaders) Clone() *HTTPHeaders
- func (h *HTTPHeaders) Compare(other runtime.Value) int
- func (h *HTTPHeaders) CompareTo(other *HTTPHeaders) int
- func (h *HTTPHeaders) Copy() runtime.Value
- func (h *HTTPHeaders) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (h *HTTPHeaders) Hash() uint64
- func (h *HTTPHeaders) Iterate(_ context.Context) (runtime.Iterator, error)
- func (h *HTTPHeaders) MarshalJSON() ([]byte, error)
- func (h *HTTPHeaders) Set(_ context.Context, key, value runtime.Value) error
- func (h *HTTPHeaders) String() string
- func (h *HTTPHeaders) Type() runtime.Type
- type HTTPRequest
- func (req *HTTPRequest) Compare(other runtime.Value) int
- func (req *HTTPRequest) Copy() runtime.Value
- func (req *HTTPRequest) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (req *HTTPRequest) Hash() uint64
- func (req *HTTPRequest) MarshalJSON() ([]byte, error)
- func (req *HTTPRequest) String() string
- func (req *HTTPRequest) Type() runtime.Type
- func (req *HTTPRequest) Unwrap() any
- type HTTPResponse
- func (resp *HTTPResponse) Compare(other runtime.Value) int
- func (resp *HTTPResponse) Copy() runtime.Value
- func (resp *HTTPResponse) Get(_ context.Context, key runtime.Value) (runtime.Value, error)
- func (resp *HTTPResponse) Hash() uint64
- func (resp *HTTPResponse) MarshalJSON() ([]byte, error)
- func (resp *HTTPResponse) String() string
- func (resp *HTTPResponse) Type() runtime.Type
- func (resp *HTTPResponse) Unwrap() any
- type Ignore
- type InteractionTarget
- type NodeInspector
- type Option
- func WithCookie(cookie HTTPCookie) Option
- func WithCookies(cookies []HTTPCookie) Option
- func WithCustomName(name string) Option
- func WithHeader(name string, value []string) Option
- func WithHeaders(headers textproto.MIMEHeader) Option
- func WithProxy(address string) Option
- func WithUserAgent(value string) Option
- type Options
- type PDFParams
- type PageCookieReader
- type PageCookieTarget
- type PageFrameTarget
- type PageNavigationTarget
- type PageResponseTarget
- type PageSnapshotTarget
- type PageStateTarget
- type Params
- type ParseParams
- type QuerySelector
- type QuerySelectorKind
- type QueryTarget
- type RelationTarget
- type ResourceFilter
- type SameSite
- type ScreenshotFormat
- type ScreenshotParams
- type ScrollBehavior
- type ScrollHorizontalAlignment
- type ScrollOptions
- type ScrollVerticalAlignment
- type StatusCodeFilter
- type StyleTarget
- type ValueTarget
- type Viewport
- type WaitEvent
- type WaitTarget
Constants ¶
const ( DefaultPageLoadTimeout = 60000 DefaultWaitTimeout = 5000 DefaultKeyboardDelay = 80 DefaultMouseDelay = 40 DefaultTimeout = 30000 )
const ( RequestEvent = "request" ResponseEvent = "response" )
const ( // WaitEventPresence indicating to wait for Value to appear. WaitEventPresence = 0 // WaitEventAbsence indicating to wait for Value to disappear. WaitEventAbsence = 1 )
Variables ¶
var ( ErrDetached = errors.New("element detached") ErrNotFound = errors.New("element(s) not found") )
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]() )
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 CompareTypes ¶
func IsScreenshotFormatValid ¶
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) SetDefault ¶
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 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 HTMLDocument ¶
type HTMLDocument interface {
HTMLNode
DocumentMetadataTarget
}
func ToDocument ¶
func ToDocument(value runtime.Value) (HTMLDocument, error)
type HTMLElement ¶
type HTMLElement interface {
HTMLNode
ContentTarget
AttributeTarget
StyleTarget
ValueTarget
RelationTarget
}
HTMLElement is the most general base interface which most objects in a GetMainFrame implement.
type HTMLNode ¶
type HTMLNode interface {
runtime.Value
runtime.Iterable
runtime.KeyReadable
runtime.Measurable
runtime.Queryable
io.Closer
json.Marshaler
NodeInspector
QueryTarget
}
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.Measurable
io.Closer
PageStateTarget
PageFrameTarget
}
HTMLPage interface represents any web page loaded in the browser and serves as an entry point into the web page's content.
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) Copy ¶
func (c HTTPCookie) Copy() runtime.Value
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) Hash ¶
func (c *HTTPCookies) Hash() uint64
func (*HTTPCookies) MarshalJSON ¶
func (c *HTTPCookies) MarshalJSON() ([]byte, 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) CompareTo ¶
func (h *HTTPHeaders) CompareTo(other *HTTPHeaders) int
func (*HTTPHeaders) Copy ¶
func (h *HTTPHeaders) Copy() runtime.Value
func (*HTTPHeaders) Hash ¶
func (h *HTTPHeaders) Hash() uint64
func (*HTTPHeaders) MarshalJSON ¶
func (h *HTTPHeaders) MarshalJSON() ([]byte, 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) Copy ¶
func (req *HTTPRequest) Copy() runtime.Value
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) Copy ¶
func (resp *HTTPResponse) Copy() runtime.Value
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 Option ¶
type Option func(opts *Options)
func WithCookie ¶
func WithCookie(cookie HTTPCookie) Option
func WithCookies ¶
func WithCookies(cookies []HTTPCookie) Option
func WithCustomName ¶
func WithHeader ¶
func WithHeaders ¶
func WithHeaders(headers textproto.MIMEHeader) Option
func WithUserAgent ¶
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"`
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"`
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 PageNavigationTarget ¶
type PageNavigationTarget interface {
}
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 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 ¶
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 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 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 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)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
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. |