Help us shape the future of Go! Take the 2026 Go Developer Survey

cdp_helper

package module
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg map[string]any

type CdpHelper

type CdpHelper struct {
	// Allocator represents chromedp allocator with cancel func
	Allocator ContextWithCancel
	Browser   ContextWithCancel
	Current   *ContextWithCancel

	Timeout         time.Duration
	TextTimeout     time.Duration
	DownloadTimeout time.Duration
}

func NewBrowser

func NewBrowser() *CdpHelper

func NewRemoteBrowser

func NewRemoteBrowser(url string) *CdpHelper

func (*CdpHelper) Attributes

func (h *CdpHelper) Attributes(sel any, opts ...chromedp.QueryOption) (map[string]string, error)

func (*CdpHelper) AttributesAll

func (h *CdpHelper) AttributesAll(sel any, opts ...chromedp.QueryOption) ([]map[string]string, error)

func (*CdpHelper) ChildNodeText

func (h *CdpHelper) ChildNodeText(node *cdp.Node, cssSel string) (string, error)

func (*CdpHelper) Click

func (h *CdpHelper) Click(sel any, opts ...chromedp.QueryOption) error

func (*CdpHelper) Download

func (h *CdpHelper) Download(path string, isNewTarget bool) (*chan string, context.Context, error)

func (*CdpHelper) Navigate

func (h *CdpHelper) Navigate(url string) error

func (*CdpHelper) NewBlankTab

func (h *CdpHelper) NewBlankTab(targetId string) (*CdpHelper, error)

NewBlankTab returns a new CdpHelper instance, and CdpHelper.Current points to the new tab

func (*CdpHelper) NodeText

func (h *CdpHelper) NodeText(sel any, opts ...chromedp.QueryOption) (string, error)

func (*CdpHelper) Nodes

func (h *CdpHelper) Nodes(sel any, opts ...chromedp.QueryOption) ([]*cdp.Node, error)

func (*CdpHelper) Run

func (h *CdpHelper) Run(actions ...chromedp.Action) error

func (*CdpHelper) RunWithTimeout added in v0.9.1

func (h *CdpHelper) RunWithTimeout(t time.Duration, actions ...chromedp.Action) error

func (*CdpHelper) SendKeys

func (h *CdpHelper) SendKeys(sel any, v string, opts ...chromedp.QueryOption) error

func (*CdpHelper) SetAttributeValue

func (h *CdpHelper) SetAttributeValue(sel any, name string, value string, opts ...chromedp.QueryOption) error

func (*CdpHelper) SetAttributes

func (h *CdpHelper) SetAttributes(sel any, attributes map[string]string, opts ...chromedp.QueryOption) error

func (*CdpHelper) Sleep

func (h *CdpHelper) Sleep(d time.Duration) error

func (*CdpHelper) Tasks added in v0.9.3

func (h *CdpHelper) Tasks(actions ...chromedp.Action) error

func (*CdpHelper) WaitReady

func (h *CdpHelper) WaitReady(sel any, opts ...chromedp.QueryOption) error

func (*CdpHelper) WithTextTimeout

func (h *CdpHelper) WithTextTimeout(timeout time.Duration)

func (*CdpHelper) WithTimeout

func (h *CdpHelper) WithTimeout(timeout time.Duration)

type ContextWithCancel

type ContextWithCancel struct {
	Context context.Context
	Cancel  context.CancelFunc
}

type DefaultLogger

type DefaultLogger struct {
}

func (*DefaultLogger) Debugf

func (*DefaultLogger) Debugf(format string, args ...any)

func (*DefaultLogger) Errorf

func (*DefaultLogger) Errorf(format string, args ...any)

func (*DefaultLogger) Logf

func (*DefaultLogger) Logf(format string, args ...any)

type Job

type Job interface {
	Prev() ([]Arg, bool)
	Do(arg Arg) bool
	Post(args *[]Arg)
}

type Logger

type Logger interface {
	Errorf(string, ...any)
	Debugf(string, ...any)
	Logf(string, ...any)
}

type Scheduler

type Scheduler struct {
	PrevRetry         bool
	PrevRetryTimes    int
	PrevRetryInterval time.Duration
	ErrRetry          bool
	ErrRetryTimes     int
	Concurrent        bool
	WaitStep          int
	Done              chan any

	Timeout time.Duration
	// contains filtered or unexported fields
}

func NewScheduler

func NewScheduler() *Scheduler

Jump to

Keyboard shortcuts

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