Documentation ¶
Index ¶
- Variables
- func NewStreamReader(ctx context.Context, handle cdprotoio.StreamHandle) io.ReadCloser
- type Instance
- type LocalInstance
- type PDFOptions
- type RemoteInstance
- type Tab
- func (t *Tab) Close(logger log.Logger)
- func (t *Tab) Context() context.Context
- func (t *Tab) NavigateAndWaitFor(addr string, headers map[string]any, eventName string) error
- func (t *Tab) PrintToPDF(options PDFOptions, writer io.Writer) error
- func (t *Tab) Run(actions ...chromedp.Action) error
- func (t *Tab) RunWithTimeout(timeout time.Duration, actions ...chromedp.Action) error
- func (t *Tab) WithTimeout(timeout time.Duration)
Constants ¶
This section is empty.
Variables ¶
var WithAwaitPromise = func(p *runtime.EvaluateParams) *runtime.EvaluateParams { return p.WithAwaitPromise(true) }
Functions ¶
func NewStreamReader ¶
func NewStreamReader(ctx context.Context, handle cdprotoio.StreamHandle) io.ReadCloser
NewStreamReader creates a new stream reader.
Types ¶
type Instance ¶
type Instance interface { NewTab(logger log.Logger, conf *config.Config) *Tab Name() string Close(logger log.Logger) }
Instance is the interface remote and local chrome must implement.
type LocalInstance ¶
type LocalInstance struct {
// contains filtered or unexported fields
}
LocalInstance is a locally running browser instance.
func NewLocalBrowserInstance ¶
func NewLocalBrowserInstance(ctx context.Context, logger log.Logger, insecureSkipVerify bool) (*LocalInstance, error)
NewLocalBrowserInstance creates a new local browser instance.
func (*LocalInstance) Close ¶
func (i *LocalInstance) Close(logger log.Logger)
func (*LocalInstance) Name ¶
func (i *LocalInstance) Name() string
Name returns the kind of browser instance.
type PDFOptions ¶
PDFOptions contains the templated HTML Body, Header and Footer strings.
type RemoteInstance ¶
type RemoteInstance struct {
// contains filtered or unexported fields
}
RemoteInstance is a remotely running browser instance.
func NewRemoteBrowserInstance ¶
func NewRemoteBrowserInstance(ctx context.Context, _ log.Logger, remoteChromeURL string) (*RemoteInstance, error)
NewRemoteBrowserInstance creates a new remote browser instance.
func (*RemoteInstance) Close ¶
func (i *RemoteInstance) Close(_ log.Logger)
Close releases the resources of browser instance.
func (*RemoteInstance) Name ¶
func (i *RemoteInstance) Name() string
Name returns the kind of browser instance.
type Tab ¶
type Tab struct {
// contains filtered or unexported fields
}
Tab is container for a browser tab.
func (*Tab) NavigateAndWaitFor ¶
NavigateAndWaitFor navigates to the given address and waits for the given event to be fired on the page.
func (*Tab) PrintToPDF ¶
func (t *Tab) PrintToPDF(options PDFOptions, writer io.Writer) error
PrintToPDF returns chroms tasks that print the requested HTML into a PDF and returns the PDF stream handle.
func (*Tab) RunWithTimeout ¶ added in v1.6.3
RunWithTimeout executes the actions in the current tab.
func (*Tab) WithTimeout ¶ added in v1.6.3
WithTimeout set the timeout for the actions in the current tab.