Documentation ¶
Index ¶
- Constants
- type Bounds
- type Chrome
- func (c *Chrome) AddScriptToEvaluateOnNewDocument(script string) error
- func (c *Chrome) Back() error
- func (c *Chrome) Bind(name string, f bindingFunc) error
- func (c *Chrome) Bounds() (Bounds, error)
- func (c *Chrome) DisableContextMenu() error
- func (c *Chrome) DisableDefaultShortcuts() error
- func (c *Chrome) Eval(expr string) (json.RawMessage, error)
- func (c *Chrome) Forward() error
- func (c *Chrome) GetNavigationHistory() (*NavigationHistory, error)
- func (c *Chrome) Kill() error
- func (c *Chrome) Load(url string) error
- func (c *Chrome) PDF(width, height int) ([]byte, error)
- func (c *Chrome) PNG(x, y, width, height int, bg uint32, scale float32) ([]byte, error)
- func (c *Chrome) Reload(disableCache bool) error
- func (c *Chrome) Send(method string, params h) (json.RawMessage, error)
- func (c *Chrome) SetBounds(b Bounds) error
- type NavigationHistory
- type NavigationHistoryEntry
- type WindowState
Constants ¶
const DisableContextMenuScript = `
document.addEventListener('contextmenu', event => event.preventDefault());
`
DisableContextMenuScript is a browser-side script that disables Chrome's right-click context menu
const DisableShortcutsScript = `` /* 1674-byte string literal not displayed */
DisableShortcutsScript disables default shortcuts
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bounds ¶
type Bounds struct { Left int `json:"left"` Top int `json:"top"` Width int `json:"width"` Height int `json:"height"` WindowState WindowState `json:"windowState"` }
Bounds defines settable window properties.
type Chrome ¶
Chrome represents a chrome process
func NewChromeWithArgs ¶
NewChromeWithArgs starts chrome process with arguments
func (*Chrome) AddScriptToEvaluateOnNewDocument ¶
AddScriptToEvaluateOnNewDocument adds JavaScript code to be evaluated when new document is evaluted
func (*Chrome) DisableContextMenu ¶
DisableContextMenu disables Chrome's default context menu on right mouse click
func (*Chrome) DisableDefaultShortcuts ¶
DisableDefaultShortcuts disables default shortucts like Ctr-N to open a new tab
func (*Chrome) Eval ¶
func (c *Chrome) Eval(expr string) (json.RawMessage, error)
Eval evaluates JavaScript expression in the browser and returns response
func (*Chrome) GetNavigationHistory ¶
func (c *Chrome) GetNavigationHistory() (*NavigationHistory, error)
GetNavigationHistory returns browser navigation history
func (*Chrome) Reload ¶
Reload reloads current page https://pptr.dev/#?product=Puppeteer&show=api-pagereloadoptions
type NavigationHistory ¶
type NavigationHistory struct {}
NavigationHistory represents browser navigation history
type NavigationHistoryEntry ¶
type NavigationHistoryEntry struct {}
NavigationHistoryEntry represents a single entry in navigation history
type WindowState ¶
type WindowState string
WindowState defines the state of the Chrome window, possible values are "normal", "maximized", "minimized" and "fullscreen".
const ( // WindowStateNormal defines a normal state of the browser window WindowStateNormal WindowState = "normal" // WindowStateMaximized defines a maximized state of the browser window WindowStateMaximized WindowState = "maximized" // WindowStateMinimized defines a minimized state of the browser window WindowStateMinimized WindowState = "minimized" // WindowStateFullscreen defines a fullscreen state of the browser window WindowStateFullscreen WindowState = "fullscreen" )