proton

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

README

proton

GoDoc Go Report Card

Documentation

Index

Constants

View Source
const (
	Chrome flavor = 1
	Edge   flavor = 2
)

Variables

View Source
var DefaultBrowserArgs = []string{
	"--disable-background-networking",
	"--disable-background-timer-throttling",
	"--disable-backgrounding-occluded-windows",
	"--disable-breakpad",
	"--disable-client-side-phishing-detection",
	"--disable-default-apps",
	"--disable-dev-shm-usage",
	"--disable-infobars",
	"--disable-extensions",
	"--disable-features=site-per-process",
	"--disable-hang-monitor",
	"--disable-ipc-flooding-protection",
	"--disable-popup-blocking",
	"--disable-prompt-on-repost",
	"--disable-renderer-backgrounding",
	"--disable-sync",
	"--disable-translate",
	"--metrics-recording-only",
	"--no-first-run",
	"--safebrowsing-disable-auto-update",
	"--enable-automation",
	"--password-store=basic",
	"--use-mock-keychain",
	"--disable-dinosaur-easter-egg",
	"--disable-windows10-custom-titlebar",
	"--no-default-browser-check",
}

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 Browser

type Browser struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Browser) Bind

func (_this *Browser) Bind(name string, f interface{}) error

func (*Browser) Bounds

func (_this *Browser) Bounds() (Bounds, error)

func (*Browser) BrowserClearBrowserCache added in v1.0.2

func (_this *Browser) BrowserClearBrowserCache() error

BrowserClearBrowserCache Clears browser cache.

func (*Browser) BrowserClearBrowserCookies added in v1.0.2

func (_this *Browser) BrowserClearBrowserCookies() error

BrowserClearBrowserCookies Clears browser cookies.

func (*Browser) BrowserClose added in v1.0.2

func (_this *Browser) BrowserClose() error

BrowserClose Close browser gracefully.

func (*Browser) BrowserGetVersion added in v1.0.2

func (_this *Browser) BrowserGetVersion() (Version, error)

BrowserGetVersion Returns version information.

func (*Browser) Close

func (_this *Browser) Close() error

func (*Browser) Done

func (_this *Browser) Done() <-chan struct{}

func (*Browser) Eval

func (_this *Browser) Eval(js string) Value

func (*Browser) PageBringToFront added in v1.0.2

func (_this *Browser) PageBringToFront() error

PageBringToFront Brings page to front (activates tab).

func (*Browser) PageCaptureScreenshot added in v1.0.2

func (_this *Browser) PageCaptureScreenshot(Parameters PageCaptureScreenshotParameters) (string, error)

PageCaptureScreenshot Capture page screenshot

func (*Browser) PageNavigate added in v1.0.2

func (_this *Browser) PageNavigate(url string) error

PageNavigate Navigates current page to the given URL.

func (*Browser) PagePrintToPDF added in v1.0.2

func (_this *Browser) PagePrintToPDF(Parameters PrintToPDFParameters) (string, error)

PagePrintToPDF Print page as PDF.

func (*Browser) PageReload added in v1.0.2

func (_this *Browser) PageReload() error

PageReload Reloads given page optionally ignoring the cache.

func (*Browser) PageResetNavigationHistory added in v1.0.2

func (_this *Browser) PageResetNavigationHistory() error

PageResetNavigationHistory Resets navigation history for the current page.

func (*Browser) PageStopLoading added in v1.0.2

func (_this *Browser) PageStopLoading() error

PageStopLoading Force the page stop all navigations and pending resource fetches.

func (*Browser) Run

func (_this *Browser) Run(conf ...Config) error

func (*Browser) RuntimeEvaluate added in v1.0.3

func (_this *Browser) RuntimeEvaluate(Parameters RuntimeEvaluateParameters) (json.RawMessage, error)

RuntimeEvaluate Evaluates expression on global object.

func (*Browser) SetBounds

func (_this *Browser) SetBounds(b Bounds) error

type Config

type Config struct {
	Title              string
	Url                string
	Debug              bool
	UserDataDir        string
	UserDataDirKeep    bool
	Width              int
	Height             int
	WindowState        WindowState
	StartFullscreen    bool
	Kiosk              bool
	KioskPrinting      bool
	Incognito          bool
	RestoreLastSession bool
	SilentLaunch       bool
	Flavor             flavor
	Args               []string
	BrowserBinary      string
}

type PageCaptureScreenshotParameters added in v1.0.2

type PageCaptureScreenshotParameters struct {
	Format  *ScreenshotFormat `json:"format"`
	Quality *int              `json:"quality"`
	Clip    *Viewport         `json:"clip"`
}

type PageReloadParameters added in v1.0.2

type PageReloadParameters struct {
	IgnoreCache            *bool   `json:"ignoreCache"`
	ScriptToEvaluateOnLoad *string `json:"scriptToEvaluateOnLoad"`
}

type PrintToPDFParameters added in v1.0.2

type PrintToPDFParameters struct {
	Landscape               *bool   `json:"landscape"`
	DisplayHeaderFooter     *bool   `json:"displayHeaderFooter"`
	PrintBackground         *bool   `json:"printBackground"`
	Scale                   *int    `json:"scale"`
	PaperWidth              *int    `json:"paperWidth"`
	PaperHeight             *int    `json:"paperHeight"`
	MarginTop               *int    `json:"marginTop"`
	MarginBottom            *int    `json:"marginBottom"`
	MarginLeft              *int    `json:"marginLeft"`
	MarginRight             *int    `json:"marginRight"`
	PageRanges              *string `json:"pageRanges"`
	IgnoreInvalidPageRanges *bool   `json:"ignoreInvalidPageRanges"`

	HeaderTemplate    *string `json:"headerTemplate"`
	FooterTemplate    *string `json:"footerTemplate"`
	PreferCSSPageSize *bool   `json:"preferCSSPageSize"`
}

type RuntimeEvaluateParameters added in v1.0.3

type RuntimeEvaluateParameters struct {
	Expression            string  `json:"expression"`
	ObjectGroup           *string `json:"objectGroup"`
	IncludeCommandLineAPI *bool   `json:"includeCommandLineAPI"`
	Silent                *bool   `json:"silent"`
	ContextId             *int    `json:"contextId"`
	ReturnByValue         *bool   `json:"returnByValue"`
	GeneratePreview       *bool   `json:"generatePreview"`
	UserGesture           *bool   `json:"userGesture"`
	AwaitPromise          *bool   `json:"awaitPromise"`
	ThrowOnSideEffect     *bool   `json:"throwOnSideEffect"`
	Timeout               *int    `json:"timeout"`
	DisableBreaks         *bool   `json:"disableBreaks"`
}

type ScreenshotFormat

type ScreenshotFormat string
const (
	JPEG ScreenshotFormat = "jpeg"
	PNG  ScreenshotFormat = "png"
)

func (ScreenshotFormat) Pointer

func (_this ScreenshotFormat) Pointer() *ScreenshotFormat

type Value

type Value interface {
	Err() error
	To(interface{}) error
	Float() float32
	Int() int
	String() string
	Bool() bool
	Object() map[string]Value
	Array() []Value
	Bytes() []byte
}

Value is a generic type of a JSON value (primitive, object, array) and optionally an error value.

type Version

type Version struct {
	ProtocolVersion string `json:"protocolVersion"`
	Product         string `json:"product"`
	Revision        string `json:"revision"`
	UserAgent       string `json:"userAgent"`
	JsVersion       string `json:"jsVersion"`
}

type Viewport

type Viewport struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
	Scale  int `json:"scale"`
}

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

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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