rod

package
v0.0.0-...-249b389 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package rod contains go-rod implementation. It is used to parse a file or URL to the rod Page format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Bin         string
	Preferences string
	WorkingDir  string
	UserDataDir string

	InLambda bool
}

type Option

type Option func(*Config)

func WithBin

func WithBin(bin string) Option

func WithLambda

func WithLambda(inLambda bool) Option

func WithPreferences

func WithPreferences(preferences string) Option

func WithUserDataDir

func WithUserDataDir(userDataDir string) Option

func WithWorkingDir

func WithWorkingDir(workingDir string) Option

type Rod

type Rod struct {
	// Browser is a rod Browser instance.
	Browser *rod.Browser
	// LoadTimeout controlls max page load time before context is canceled.
	LoadTimeout time.Duration
	// PageIdleTime sets the wait time after the page stops receiving requests.
	PageIdleTime time.Duration
}

Rod is responsible for browsser operations.

func (*Rod) ByteToPage

func (r *Rod) ByteToPage(bin []byte) (*rod.Page, error)

ByteToPage converts the binary to a rod Page instance.

func (*Rod) Close

func (r *Rod) Close()

Close closes the Browser connection.

func (*Rod) Connect

func (r *Rod) Connect(opts ...Option)

Connect starts the Browser connection.

func (*Rod) UrlToPage

func (r *Rod) UrlToPage(url string) *rod.Page

UrlToPage converts the URL to a rod Page instance.

func (*Rod) WaitLoad

func (r *Rod) WaitLoad(page *rod.Page)

WaitLoad sets a wait time according to the page loading.

Jump to

Keyboard shortcuts

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