webdriver

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package webdriver provides a wrapper for the rod library to perform browser operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WebDriver

type WebDriver 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
}

WebDriver is a wrapper of the rod library.

func FromConfig

func FromConfig(config *WebDriverConfig) *WebDriver

func FromDefault

func FromDefault() *WebDriver

func (*WebDriver) Close

func (r *WebDriver) Close()

Close closes the Browser connection.

func (*WebDriver) Connect

func (r *WebDriver) Connect()

Connect starts the Browser connection.

func (*WebDriver) HTMLToPage

func (r *WebDriver) HTMLToPage(html []byte) (*rod.Page, error)

HTMLToPage converts the binary html to a rod Page instance.

func (*WebDriver) UrlToPage

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

UrlToPage converts the URL to a rod Page instance.

func (*WebDriver) WaitLoad

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

WaitLoad sets a wait time according to the page loading.

type WebDriverConfig

type WebDriverConfig struct {
	LoadTimeout  time.Duration
	PageIdleTime time.Duration
}

Jump to

Keyboard shortcuts

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