http

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: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DriverName = "http"

Variables

View Source
var (
	DefaultConcurrency = 1
	DefaultMaxRetries  = 5
	DefaultTimeout     = time.Second * 30
)

Functions

func EvalXPathTo

func EvalXPathTo(selection *goquery.Selection, expression string) (runtime.Value, error)

func EvalXPathToElement

func EvalXPathToElement(selection *goquery.Selection, expression string) (drivers.HTMLElement, error)

func EvalXPathToNode

func EvalXPathToNode(selection *goquery.Selection, expression string) (drivers.HTMLNode, error)

func EvalXPathToNodes

func EvalXPathToNodes(selection *goquery.Selection, expression string) (runtime.List, error)

func EvalXPathToNodesWith

func EvalXPathToNodesWith(selection *goquery.Selection, expression string, mapper func(node *html.Node) (runtime.Value, error)) (runtime.List, error)

func NewHTMLElement

func NewHTMLElement(node *goquery.Selection) (drivers.HTMLElement, error)

Types

type Driver

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

func NewDriver

func NewDriver(opts ...Option) *Driver

func (*Driver) Close

func (drv *Driver) Close() error

func (*Driver) Name

func (drv *Driver) Name() string

func (*Driver) Open

func (drv *Driver) Open(ctx context.Context, params drivers.Params) (drivers.HTMLPage, error)

func (*Driver) Parse

func (drv *Driver) Parse(_ context.Context, params drivers.ParseParams) (drivers.HTMLPage, error)

type HTMLDocument

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

func NewHTMLDocument

func NewHTMLDocument(
	node *goquery.Document,
	url string,
	parent drivers.HTMLDocument,
) (*HTMLDocument, error)

func NewRootHTMLDocument

func NewRootHTMLDocument(
	node *goquery.Document,
	url string,
) (*HTMLDocument, error)

func (*HTMLDocument) Clone

func (*HTMLDocument) Close

func (doc *HTMLDocument) Close() error

func (*HTMLDocument) Compare

func (doc *HTMLDocument) Compare(other runtime.Value) int64

func (*HTMLDocument) Copy

func (doc *HTMLDocument) Copy() runtime.Value

func (*HTMLDocument) CountBySelector

func (doc *HTMLDocument) CountBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Int, error)

func (*HTMLDocument) Dispatch

func (doc *HTMLDocument) Dispatch(ctx context.Context, event runtime.DispatchEvent) (runtime.Value, error)

func (*HTMLDocument) ExistsBySelector

func (doc *HTMLDocument) ExistsBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Boolean, error)

func (*HTMLDocument) Get

func (doc *HTMLDocument) Get(ctx context.Context, key runtime.Value) (runtime.Value, error)

func (*HTMLDocument) GetChildDocuments

func (doc *HTMLDocument) GetChildDocuments(ctx context.Context) (runtime.List, error)

func (*HTMLDocument) GetChildNode

func (doc *HTMLDocument) GetChildNode(ctx context.Context, idx runtime.Int) (runtime.Value, error)

func (*HTMLDocument) GetChildNodes

func (doc *HTMLDocument) GetChildNodes(ctx context.Context) (runtime.List, error)

func (*HTMLDocument) GetElement

func (doc *HTMLDocument) GetElement() drivers.HTMLElement

func (*HTMLDocument) GetName

func (doc *HTMLDocument) GetName() runtime.String

func (*HTMLDocument) GetNodeName

func (doc *HTMLDocument) GetNodeName(_ context.Context) (runtime.String, error)

func (*HTMLDocument) GetNodeType

func (doc *HTMLDocument) GetNodeType(_ context.Context) (runtime.Int, error)

func (*HTMLDocument) GetParentDocument

func (doc *HTMLDocument) GetParentDocument(_ context.Context) (drivers.HTMLDocument, error)

func (*HTMLDocument) GetTitle

func (doc *HTMLDocument) GetTitle() runtime.String

func (*HTMLDocument) GetURL

func (doc *HTMLDocument) GetURL() runtime.String

func (*HTMLDocument) Hash

func (doc *HTMLDocument) Hash() uint64

func (*HTMLDocument) Iterate

func (doc *HTMLDocument) Iterate(_ context.Context) (runtime.Iterator, error)

func (*HTMLDocument) Length

func (doc *HTMLDocument) Length(_ context.Context) (runtime.Int, error)

func (*HTMLDocument) MarshalJSON

func (doc *HTMLDocument) MarshalJSON() ([]byte, error)

func (*HTMLDocument) MoveMouseByXY

func (doc *HTMLDocument) MoveMouseByXY(_ context.Context, _, _ runtime.Float) error

func (*HTMLDocument) Query

func (doc *HTMLDocument) Query(ctx context.Context, q runtime.Query) (runtime.Value, error)

func (*HTMLDocument) QuerySelector

func (doc *HTMLDocument) QuerySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Value, error)

func (*HTMLDocument) QuerySelectorAll

func (doc *HTMLDocument) QuerySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)

func (*HTMLDocument) Scroll

func (*HTMLDocument) ScrollBottom

func (doc *HTMLDocument) ScrollBottom(_ context.Context, _ drivers.ScrollOptions) error

func (*HTMLDocument) ScrollBySelector

func (*HTMLDocument) ScrollTop

func (doc *HTMLDocument) ScrollTop(_ context.Context, _ drivers.ScrollOptions) error

func (*HTMLDocument) Set

func (doc *HTMLDocument) Set(ctx context.Context, key runtime.Value, value runtime.Value) error

func (*HTMLDocument) String

func (doc *HTMLDocument) String() string

func (*HTMLDocument) Type

func (doc *HTMLDocument) Type() runtime.Type

func (*HTMLDocument) Unwrap

func (doc *HTMLDocument) Unwrap() any

func (*HTMLDocument) XPath

func (doc *HTMLDocument) XPath(ctx context.Context, expression runtime.String) (runtime.Value, error)

type HTMLElement

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

func (*HTMLElement) Blur

func (el *HTMLElement) Blur(_ context.Context) error

func (*HTMLElement) BlurBySelector

func (el *HTMLElement) BlurBySelector(_ context.Context, _ drivers.QuerySelector) error

func (*HTMLElement) Clear

func (el *HTMLElement) Clear(_ context.Context) error

func (*HTMLElement) ClearBySelector

func (el *HTMLElement) ClearBySelector(_ context.Context, _ drivers.QuerySelector) error

func (*HTMLElement) Click

func (el *HTMLElement) Click(_ context.Context, _ runtime.Int) error

func (*HTMLElement) ClickBySelector

func (el *HTMLElement) ClickBySelector(_ context.Context, _ drivers.QuerySelector, _ runtime.Int) error

func (*HTMLElement) ClickBySelectorAll

func (el *HTMLElement) ClickBySelectorAll(_ context.Context, _ drivers.QuerySelector, _ runtime.Int) error

func (*HTMLElement) Close

func (el *HTMLElement) Close() error

func (*HTMLElement) Compare

func (el *HTMLElement) Compare(other runtime.Value) int64

func (*HTMLElement) Copy

func (el *HTMLElement) Copy() runtime.Value

func (*HTMLElement) CountBySelector

func (el *HTMLElement) CountBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.Int, error)

func (*HTMLElement) Dispatch

func (el *HTMLElement) Dispatch(ctx context.Context, event runtime.DispatchEvent) (runtime.Value, error)

func (*HTMLElement) ExistsBySelector

func (el *HTMLElement) ExistsBySelector(_ context.Context, selector drivers.QuerySelector) (runtime.Boolean, error)

func (*HTMLElement) Focus

func (el *HTMLElement) Focus(_ context.Context) error

func (*HTMLElement) FocusBySelector

func (el *HTMLElement) FocusBySelector(_ context.Context, _ drivers.QuerySelector) error

func (*HTMLElement) Get

func (el *HTMLElement) Get(ctx context.Context, path runtime.Value) (runtime.Value, error)

func (*HTMLElement) GetAttribute

func (el *HTMLElement) GetAttribute(ctx context.Context, name runtime.String) (runtime.Value, error)

func (*HTMLElement) GetAttributes

func (el *HTMLElement) GetAttributes(ctx context.Context) (runtime.Map, error)

func (*HTMLElement) GetChildNode

func (el *HTMLElement) GetChildNode(ctx context.Context, idx runtime.Int) (runtime.Value, error)

func (*HTMLElement) GetChildNodes

func (el *HTMLElement) GetChildNodes(_ context.Context) (runtime.List, error)

func (*HTMLElement) GetInnerHTML

func (el *HTMLElement) GetInnerHTML(_ context.Context) (runtime.String, error)

func (*HTMLElement) GetInnerHTMLBySelector

func (el *HTMLElement) GetInnerHTMLBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.String, error)

func (*HTMLElement) GetInnerHTMLBySelectorAll

func (el *HTMLElement) GetInnerHTMLBySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)

func (*HTMLElement) GetInnerText

func (el *HTMLElement) GetInnerText(_ context.Context) (runtime.String, error)

func (*HTMLElement) GetInnerTextBySelector

func (el *HTMLElement) GetInnerTextBySelector(ctx context.Context, selector drivers.QuerySelector) (runtime.String, error)

func (*HTMLElement) GetInnerTextBySelectorAll

func (el *HTMLElement) GetInnerTextBySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)

func (*HTMLElement) GetNextElementSibling

func (el *HTMLElement) GetNextElementSibling(_ context.Context) (runtime.Value, error)

func (*HTMLElement) GetNodeName

func (el *HTMLElement) GetNodeName(_ context.Context) (runtime.String, error)

func (*HTMLElement) GetNodeType

func (el *HTMLElement) GetNodeType(_ context.Context) (runtime.Int, error)

func (*HTMLElement) GetParentElement

func (el *HTMLElement) GetParentElement(_ context.Context) (runtime.Value, error)

func (*HTMLElement) GetPreviousElementSibling

func (el *HTMLElement) GetPreviousElementSibling(_ context.Context) (runtime.Value, error)

func (*HTMLElement) GetStyle

func (el *HTMLElement) GetStyle(ctx context.Context, name runtime.String) (runtime.Value, error)

func (*HTMLElement) GetStyles

func (el *HTMLElement) GetStyles(ctx context.Context) (runtime.Map, error)

func (*HTMLElement) GetValue

func (el *HTMLElement) GetValue(_ context.Context) (runtime.Value, error)

func (*HTMLElement) Hash

func (el *HTMLElement) Hash() uint64

func (*HTMLElement) Hover

func (el *HTMLElement) Hover(_ context.Context) error

func (*HTMLElement) HoverBySelector

func (el *HTMLElement) HoverBySelector(_ context.Context, _ drivers.QuerySelector) error

func (*HTMLElement) Input

func (el *HTMLElement) Input(_ context.Context, _ runtime.Value, _ runtime.Int) error

func (*HTMLElement) InputBySelector

func (el *HTMLElement) InputBySelector(_ context.Context, _ drivers.QuerySelector, _ runtime.Value, _ runtime.Int) error

func (*HTMLElement) Iterate

func (el *HTMLElement) Iterate(_ context.Context) (runtime.Iterator, error)

func (*HTMLElement) Length

func (el *HTMLElement) Length(ctx context.Context) (runtime.Int, error)

func (*HTMLElement) MarshalJSON

func (el *HTMLElement) MarshalJSON() ([]byte, error)

func (*HTMLElement) Press

func (el *HTMLElement) Press(_ context.Context, _ []runtime.String, _ runtime.Int) error

func (*HTMLElement) PressBySelector

func (el *HTMLElement) PressBySelector(_ context.Context, _ drivers.QuerySelector, _ []runtime.String, _ runtime.Int) error

func (*HTMLElement) Query

func (el *HTMLElement) Query(ctx context.Context, q runtime.Query) (runtime.Value, error)

func (*HTMLElement) QuerySelector

func (el *HTMLElement) QuerySelector(_ context.Context, selector drivers.QuerySelector) (runtime.Value, error)

func (*HTMLElement) QuerySelectorAll

func (el *HTMLElement) QuerySelectorAll(ctx context.Context, selector drivers.QuerySelector) (runtime.List, error)

func (*HTMLElement) RemoveAttribute

func (el *HTMLElement) RemoveAttribute(ctx context.Context, name ...runtime.String) error

func (*HTMLElement) RemoveStyle

func (el *HTMLElement) RemoveStyle(ctx context.Context, name ...runtime.String) error

func (*HTMLElement) ScrollIntoView

func (el *HTMLElement) ScrollIntoView(_ context.Context, _ drivers.ScrollOptions) error

func (*HTMLElement) Select

func (el *HTMLElement) Select(_ context.Context, _ *runtime.Array) (runtime.List, error)

func (*HTMLElement) SelectBySelector

func (el *HTMLElement) SelectBySelector(_ context.Context, _ drivers.QuerySelector, _ runtime.List) (runtime.List, error)

func (*HTMLElement) Set

func (el *HTMLElement) Set(ctx context.Context, path, value runtime.Value) error

func (*HTMLElement) SetAttribute

func (el *HTMLElement) SetAttribute(ctx context.Context, name, value runtime.String) error

func (*HTMLElement) SetAttributes

func (el *HTMLElement) SetAttributes(ctx context.Context, values runtime.Map) error

func (*HTMLElement) SetInnerHTML

func (el *HTMLElement) SetInnerHTML(_ context.Context, value runtime.String) error

func (*HTMLElement) SetInnerHTMLBySelector

func (el *HTMLElement) SetInnerHTMLBySelector(ctx context.Context, selector drivers.QuerySelector, innerHTML runtime.String) error

func (*HTMLElement) SetInnerText

func (el *HTMLElement) SetInnerText(_ context.Context, innerText runtime.String) error

func (*HTMLElement) SetInnerTextBySelector

func (el *HTMLElement) SetInnerTextBySelector(ctx context.Context, selector drivers.QuerySelector, innerText runtime.String) error

func (*HTMLElement) SetStyle

func (el *HTMLElement) SetStyle(ctx context.Context, name, value runtime.String) error

func (*HTMLElement) SetStyles

func (el *HTMLElement) SetStyles(ctx context.Context, values runtime.Map) error

func (*HTMLElement) SetValue

func (el *HTMLElement) SetValue(_ context.Context, value runtime.Value) error

func (*HTMLElement) String

func (el *HTMLElement) String() string

func (*HTMLElement) Type

func (el *HTMLElement) Type() runtime.Type

func (*HTMLElement) Unwrap

func (el *HTMLElement) Unwrap() any

func (*HTMLElement) WaitForAttribute

func (el *HTMLElement) WaitForAttribute(_ context.Context, _ runtime.String, _ runtime.Value, _ drivers.WaitEvent) error

func (*HTMLElement) WaitForAttributeBySelector

func (el *HTMLElement) WaitForAttributeBySelector(_ context.Context, _ drivers.QuerySelector, _ runtime.String, _ runtime.Value, _ drivers.WaitEvent) error

func (*HTMLElement) WaitForAttributeBySelectorAll

func (el *HTMLElement) WaitForAttributeBySelectorAll(_ context.Context, _ drivers.QuerySelector, _ runtime.String, _ runtime.Value, _ drivers.WaitEvent) error

func (*HTMLElement) WaitForClass

func (el *HTMLElement) WaitForClass(_ context.Context, _ runtime.String, _ drivers.WaitEvent) error

func (*HTMLElement) WaitForClassBySelector

func (el *HTMLElement) WaitForClassBySelector(_ context.Context, _ drivers.QuerySelector, _ runtime.String, _ drivers.WaitEvent) error

func (*HTMLElement) WaitForClassBySelectorAll

func (el *HTMLElement) WaitForClassBySelectorAll(_ context.Context, _ drivers.QuerySelector, _ runtime.String, _ drivers.WaitEvent) error

func (*HTMLElement) WaitForElement

func (el *HTMLElement) WaitForElement(_ context.Context, _ drivers.QuerySelector, _ drivers.WaitEvent) error

func (*HTMLElement) WaitForElementAll

func (el *HTMLElement) WaitForElementAll(_ context.Context, _ drivers.QuerySelector, _ drivers.WaitEvent) error

func (*HTMLElement) WaitForStyle

func (*HTMLElement) WaitForStyleBySelector

func (el *HTMLElement) WaitForStyleBySelector(_ context.Context, _ drivers.QuerySelector, _ runtime.String, _ runtime.Value, _ drivers.WaitEvent) error

func (*HTMLElement) WaitForStyleBySelectorAll

func (el *HTMLElement) WaitForStyleBySelectorAll(_ context.Context, _ drivers.QuerySelector, _ runtime.String, _ runtime.Value, _ drivers.WaitEvent) error

func (*HTMLElement) XPath

func (el *HTMLElement) XPath(_ context.Context, expression runtime.String) (runtime.Value, error)

type HTMLPage

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

func NewHTMLPage

func NewHTMLPage(
	qdoc *goquery.Document,
	url string,
	response drivers.HTTPResponse,
	cookies *drivers.HTTPCookies,
) (*HTMLPage, error)

func (*HTMLPage) CaptureScreenshot

func (p *HTMLPage) CaptureScreenshot(_ context.Context, _ drivers.ScreenshotParams) (runtime.Binary, error)

func (*HTMLPage) Close

func (p *HTMLPage) Close() error

func (*HTMLPage) Compare

func (p *HTMLPage) Compare(other runtime.Value) int64

func (*HTMLPage) Copy

func (p *HTMLPage) Copy() runtime.Value

func (*HTMLPage) DeleteCookies

func (p *HTMLPage) DeleteCookies(_ context.Context, _ *drivers.HTTPCookies) error

func (*HTMLPage) Dispatch

func (p *HTMLPage) Dispatch(ctx context.Context, event runtime.DispatchEvent) (runtime.Value, error)

func (*HTMLPage) Get

func (p *HTMLPage) Get(ctx context.Context, key runtime.Value) (runtime.Value, error)

func (*HTMLPage) GetCookies

func (p *HTMLPage) GetCookies(_ context.Context) (*drivers.HTTPCookies, error)

func (*HTMLPage) GetFrame

func (p *HTMLPage) GetFrame(ctx context.Context, idx runtime.Int) (runtime.Value, error)

func (*HTMLPage) GetFrames

func (p *HTMLPage) GetFrames(ctx context.Context) (runtime.List, error)

func (*HTMLPage) GetMainFrame

func (p *HTMLPage) GetMainFrame() drivers.HTMLDocument

func (*HTMLPage) GetResponse

func (p *HTMLPage) GetResponse(_ context.Context) (drivers.HTTPResponse, error)

func (*HTMLPage) GetURL

func (p *HTMLPage) GetURL() runtime.String

func (*HTMLPage) Hash

func (p *HTMLPage) Hash() uint64

func (*HTMLPage) IsClosed

func (p *HTMLPage) IsClosed() runtime.Boolean

func (*HTMLPage) Iterate

func (p *HTMLPage) Iterate(ctx context.Context) (runtime.Iterator, error)

func (*HTMLPage) Length

func (p *HTMLPage) Length(ctx context.Context) (runtime.Int, error)

func (*HTMLPage) MarshalJSON

func (p *HTMLPage) MarshalJSON() ([]byte, error)

func (*HTMLPage) Navigate

func (p *HTMLPage) Navigate(_ context.Context, _ runtime.String) error

func (*HTMLPage) NavigateBack

func (p *HTMLPage) NavigateBack(_ context.Context, _ runtime.Int) (runtime.Boolean, error)

func (*HTMLPage) NavigateForward

func (p *HTMLPage) NavigateForward(_ context.Context, _ runtime.Int) (runtime.Boolean, error)

func (*HTMLPage) PrintToPDF

func (p *HTMLPage) PrintToPDF(_ context.Context, _ drivers.PDFParams) (runtime.Binary, error)

func (*HTMLPage) Set

func (p *HTMLPage) Set(ctx context.Context, key, value runtime.Value) error

func (*HTMLPage) SetCookies

func (p *HTMLPage) SetCookies(_ context.Context, _ *drivers.HTTPCookies) error

func (*HTMLPage) String

func (p *HTMLPage) String() string

func (*HTMLPage) Subscribe

func (*HTMLPage) Type

func (p *HTMLPage) Type() runtime.Type

func (*HTMLPage) Unwrap

func (p *HTMLPage) Unwrap() any

func (*HTMLPage) WaitForFrameNavigation

func (p *HTMLPage) WaitForFrameNavigation(_ context.Context, _ drivers.HTMLDocument, _ runtime.String) error

func (*HTMLPage) WaitForNavigation

func (p *HTMLPage) WaitForNavigation(_ context.Context, _ runtime.String) error

type Option

type Option func(opts *Options)

func WithAllowedHTTPCode

func WithAllowedHTTPCode(httpCode int) Option

func WithAllowedHTTPCodes

func WithAllowedHTTPCodes(httpCodes []int) Option

func WithConcurrency

func WithConcurrency(value int) Option

func WithCookie

func WithCookie(cookie drivers.HTTPCookie) Option

func WithCookies

func WithCookies(cookies []drivers.HTTPCookie) Option

func WithCustomName

func WithCustomName(name string) Option

func WithCustomTransport

func WithCustomTransport(transport *stdhttp.Transport) Option

func WithDefaultBackoff

func WithDefaultBackoff() Option

func WithExponentialBackoff

func WithExponentialBackoff() Option

func WithHeader

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

func WithHeaders

func WithHeaders(headers *drivers.HTTPHeaders) Option

func WithLinearBackoff

func WithLinearBackoff() Option

func WithMaxRetries

func WithMaxRetries(value int) Option

func WithProxy

func WithProxy(address string) Option

func WithTimeout

func WithTimeout(duration time.Duration) Option

func WithUserAgent

func WithUserAgent(value string) Option

type Options

type Options struct {
	*drivers.Options
	Backoff         pester.BackoffStrategy
	MaxRetries      int
	Concurrency     int
	HTTPCodesFilter []compiledStatusCodeFilter
	HTTPTransport   *stdhttp.Transport
	Timeout         time.Duration
}

func NewOptions

func NewOptions(setters []Option) *Options

Jump to

Keyboard shortcuts

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