Documentation
¶
Overview ¶
Package rodadapter provides a go-rod implementation of scrape-kdl's BrowserAdapter interface.
Index ¶
- type Adapter
- func (a *Adapter) Acquire(ctx context.Context) (func(), error)
- func (a *Adapter) Attribute(ctx context.Context, element scrapekdl.BrowserElement, name string) (string, bool, error)
- func (a *Adapter) Click(ctx context.Context, selector string, timeout time.Duration) error
- func (a *Adapter) Close() error
- func (a *Adapter) Evaluate(ctx context.Context, source string, options scrapekdl.BrowserEvaluateOptions) (any, error)
- func (a *Adapter) Fill(ctx context.Context, selector, value string, timeout time.Duration) error
- func (a *Adapter) HTML(ctx context.Context, element scrapekdl.BrowserElement) (string, error)
- func (a *Adapter) Navigate(ctx context.Context, target string, options scrapekdl.BrowserNavigateOptions) error
- func (a *Adapter) Press(ctx context.Context, selector, key string, timeout time.Duration) error
- func (a *Adapter) QueryAll(ctx context.Context, scope scrapekdl.BrowserElement, selector string) ([]scrapekdl.BrowserElement, error)
- func (a *Adapter) QueryLimit(ctx context.Context, scope scrapekdl.BrowserElement, selector string, ...) ([]scrapekdl.BrowserElement, error)
- func (a *Adapter) Scroll(ctx context.Context, x, y float64) error
- func (a *Adapter) Text(ctx context.Context, element scrapekdl.BrowserElement) (string, error)
- func (a *Adapter) WaitFor(ctx context.Context, selector, state string, timeout time.Duration) error
- func (a *Adapter) WaitForNetworkIdle(ctx context.Context, idle, timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter executes browser-mode extractors against one rod page. A single Adapter must not be used for concurrent extractions.
func New ¶
New creates an adapter around an existing page. The page remains owned by the caller and is not closed by Adapter.Close.
func NewBrowser ¶
NewBrowser creates a fresh about:blank page in an existing connected browser. The adapter owns and closes the page, but not the browser.
func (*Adapter) Acquire ¶
Acquire reserves the page for one complete scrape-kdl extraction. The runtime calls this optional capability before navigation and releases it after output extraction, preventing workflow and read operations from interleaving across concurrent Program.Extract calls.
func (*Adapter) QueryAll ¶
func (a *Adapter) QueryAll(ctx context.Context, scope scrapekdl.BrowserElement, selector string) ([]scrapekdl.BrowserElement, error)
func (*Adapter) QueryLimit ¶
func (a *Adapter) QueryLimit(ctx context.Context, scope scrapekdl.BrowserElement, selector string, limit int) ([]scrapekdl.BrowserElement, error)