cdp

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine contains all information to run a chrome szenario

func New

func New(opts ...Option) (*Engine, context.CancelFunc)

New creates a new Engine

func (*Engine) AddErr

func (cdp *Engine) AddErr(err error)

AddErr adds a error to the event

func (*Engine) Bigger

func (cdp *Engine) Bigger(i int) szenario.CheckFunc

Bigger checks if the size of the body (in bytes) in bigger than i

func (*Engine) Body

func (cdp *Engine) Body(checks ...szenario.CheckFunc) chromedp.Action

Body is used to check the content of the page

func (*Engine) Contains

func (cdp *Engine) Contains(s string) szenario.CheckFunc

Contains looks for a string in the body

func (*Engine) Dump

func (cdp *Engine) Dump() szenario.CheckFunc

Dump prints the body and its size to log

func (*Engine) DumpHTML

func (cdp *Engine) DumpHTML(name string)

DumpHTML saves the HTML to the outFolder

func (*Engine) ErrorScreenshot

func (cdp *Engine) ErrorScreenshot(err error)

ErrorScreenshot is used to create a screenshot in case of an error

func (*Engine) Execute

func (cdp *Engine) Execute(szenarios ...szenario.Szenario)

Execute runs one or more szenarios

func (*Engine) Headless

func (cdp *Engine) Headless() bool

Headless indicates if the browser is headless (i.e. does not show on screen)

func (*Engine) IsPresent

func (cdp *Engine) IsPresent(sel interface{}, opts ...chromedp.QueryOption) bool

IsPresent checks if something is present

func (*Engine) Loop

func (cdp *Engine) Loop()

Loop runs the szenarios and never returns

func (*Engine) NotContains

func (cdp *Engine) NotContains(s string) szenario.CheckFunc

NotContains looks for a string in the body and errs if found

func (*Engine) Schedule

func (cdp *Engine) Schedule(szenarios ...szenario.Szenario)

Schedule one or more szenarios

func (*Engine) ScreenShot

func (cdp *Engine) ScreenShot(name string)

ScreenShot saves a screenshot to the outFolder

func (*Engine) SetStatus

func (cdp *Engine) SetStatus(key, val string)

SetStatus sets a status of the event

func (*Engine) SetTimeout

func (cdp *Engine) SetTimeout(d time.Duration)

SetTimeout updates the timeout and restarts the timer

func (*Engine) Step

func (cdp *Engine) Step(name string, actions ...chromedp.Action)

Step executes the actions given and records how long it takes

func (*Engine) Strings

func (cdp *Engine) Strings(html *string) szenario.CheckFunc

Strings gets the body as plaintext

func (*Engine) TimeOut

func (cdp *Engine) TimeOut(d time.Duration) context.CancelFunc

TimeOut registers a timeout after which the szenario is canceled

func (*Engine) WaitForEver

func (cdp *Engine) WaitForEver()

WaitForEver blocks until the timeout is reached

type Option

type Option func(*Engine)

Option configures the Engine

func NoClose

func NoClose() Option

NoClose prevents the bowser form closing (used for debugging)

func Repeat

func Repeat(r time.Duration) Option

Repeat sets the repeat intervall in munutes (default 0 - no looping)

func Show

func Show() Option

Show controls if the browser is started headless or not

func Timeout

func Timeout(t time.Duration) Option

Timeout sets the job timeout in seconds (default 60s)

Jump to

Keyboard shortcuts

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