chrome

package module
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int

func Int(number int) *int

Int returns a pointer to the given integer

func IntValue

func IntValue(number *int) int

IntValue returns the value of the integer pointer or 0 if the pointer is nil

func String

func String(str string) *string

String returns a pointer to the given string

func StringSlice

func StringSlice(slice []string) []*string

StringSlice returns slice of string pointers for given slice of string

func StringValue

func StringValue(str *string) string

StringValue returns the value of the string pointer passed in or "" if the pointer is nil

func StringValueSlice

func StringValueSlice(slice []*string) []string

StringValueSlice returns slice of string values for given slice of string pointer. "" is returned if any pointer in the slice is nil

Types

type Chrome

type Chrome interface {
	Launch(*LaunchOpts) (Tab, error)
	Wait()
	Terminate() error
	OpenTab(target.ID, time.Duration) Tab
	OpenNewTab(time.Duration) (Tab, error)
	OpenNewIncognitoTab(time.Duration) (Tab, error)
	CloseTab(Tab, time.Duration) error
}

func NewChrome added in v3.1.0

func NewChrome() Chrome

type ClientHook

type ClientHook func(c *cdp.Client) error

type ClientHooks

type ClientHooks []ClientHook

type LaunchOpts

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

func NewLaunchOpts

func NewLaunchOpts() *LaunchOpts

func (*LaunchOpts) SetArguments

func (l *LaunchOpts) SetArguments(arguments ...string)

func (*LaunchOpts) SetHeadless

func (l *LaunchOpts) SetHeadless(headless bool)

func (*LaunchOpts) SetPath

func (l *LaunchOpts) SetPath(path string)

func (*LaunchOpts) SetPort

func (l *LaunchOpts) SetPort(port int)

type ScreenshotOpts

type ScreenshotOpts struct {
	Width             int
	Height            int
	DeviceScaleFactor float64
	Mobile            bool
}

type Tab

type Tab interface {
	Navigate(url string, timeout time.Duration) (bool, error)
	GetHTML(timeout time.Duration) (string, error)
	CaptureScreenshot(opts ScreenshotOpts, timeout time.Duration) (string, error)
	Exec(javascript string, timeout time.Duration) (*runtime.EvaluateReply, error)
	GetClient() *cdp.Client
	GetTargetID() target.ID
	AttachHook(hook ClientHook)
}

Jump to

Keyboard shortcuts

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