cdp

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PasswordChangeSzenarioName = "Passwd Change"
)

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) BreakWaitForUserInput added in v0.12.0

func (cdp *Engine) BreakWaitForUserInput()

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) Either added in v0.11.0

func (cdp *Engine) Either(name string, option ...szenario.EitherOption) <-chan any

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) int

Execute runs one or more szenarios it returns the number of szenarios with errors or never returns

func (*Engine) GetURL added in v0.12.3

func (cdp *Engine) GetURL() string

GetURL returns the current URL

func (*Engine) IsHeadless added in v0.11.0

func (cdp *Engine) IsHeadless() bool

IsHeadless 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) Log added in v0.13.0

func (cdp *Engine) Log() *slog.Logger

Log returns the logger

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) RunUser added in v0.12.0

func (cdp *Engine) RunUser(username string) error

Execute runs one or more szenarios

func (*Engine) ScreenShot

func (cdp *Engine) ScreenShot(name string)

ScreenShot saves a screenshot to the outFolder

func (*Engine) SetInputField added in v0.14.0

func (cdp *Engine) SetInputField(stepName string, sel interface{}, value string, opts ...func(*chromedp.Selector)) error

SetInputField sets a HTML input field and validates that it has been set

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) StepTimeout added in v0.10.8

func (cdp *Engine) StepTimeout(name string, timeout time.Duration, actions ...chromedp.Action) error

StepTimeout executes a Step with an timeout

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 Headless added in v0.11.0

func Headless(b bool) Option

Headless controls if the browser is started headless or not

func NoClose

func NoClose() Option

NoClose prevents the bowser form closing (used for debugging)

func StepBreakPoint added in v0.12.0

func StepBreakPoint(c chan any) Option

StepBreakPoint sets a channel used a break point after each step

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