api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Browser

type Browser interface {
	Close()
	Contexts() []BrowserContext
	IsConnected() bool
	NewContext(opts goja.Value) BrowserContext
	NewPage(opts goja.Value) Page
	UserAgent() string
	Version() string
}

Browser is the public interface of a CDP browser.

type BrowserContext

type BrowserContext interface {
	AddCookies(cookies goja.Value)
	AddInitScript(script goja.Value, arg goja.Value)
	Browser() Browser
	ClearCookies()
	ClearPermissions()
	Close()
	Cookies() []goja.Object
	ExposeBinding(name string, callback goja.Callable, opts goja.Value)
	ExposeFunction(name string, callback goja.Callable)
	GrantPermissions(permissions []string, opts goja.Value)
	NewCDPSession() CDPSession
	NewPage() Page
	Pages() []Page
	Route(url goja.Value, handler goja.Callable)
	SetDefaultNavigationTimeout(timeout int64)
	SetDefaultTimeout(timeout int64)
	SetExtraHTTPHeaders(headers map[string]string)
	SetGeolocation(geolocation goja.Value)
	SetHTTPCredentials(httpCredentials goja.Value)
	SetOffline(offline bool)
	StorageState(opts goja.Value)
	Unroute(url goja.Value, handler goja.Callable)
	WaitForEvent(event string, optsOrPredicate goja.Value) interface{}
}

BrowserContext is the public interface of a CDP browser context.

type BrowserType

type BrowserType interface {
	Connect(opts goja.Value)
	ExecutablePath() string
	Launch(opts goja.Value) Browser
	LaunchPersistentContext(userDataDir string, opts goja.Value) Browser
	Name() string
}

BrowserType is the public interface of a CDP browser client.

type CDPSession

type CDPSession interface {
	Detach()
	Send(method string, params goja.Value) goja.Value
}

CDPSession is the interface of a raw CDP session.

type ElementHandle

type ElementHandle interface {
	JSHandle

	BoundingBox() *Rect
	Check(opts goja.Value)
	Click(opts goja.Value)
	ContentFrame() Frame
	Dblclick(opts goja.Value)
	DispatchEvent(typ string, props goja.Value)
	Fill(value string, opts goja.Value)
	Focus()
	GetAttribute(name string) goja.Value
	Hover(opts goja.Value)
	InnerHTML() string
	InnerText() string
	InputValue(opts goja.Value) string
	IsChecked() bool
	IsDisabled() bool
	IsEditable() bool
	IsEnabled() bool
	IsHidden() bool
	IsVisible() bool
	OwnerFrame() Frame
	Press(key string, opts goja.Value)
	Query(selector string) ElementHandle
	QueryAll(selector string) []ElementHandle
	Screenshot(opts goja.Value) goja.ArrayBuffer
	ScrollIntoViewIfNeeded(opts goja.Value)
	SelectOption(values goja.Value, opts goja.Value) []string
	SelectText(opts goja.Value)
	SetInputFiles(files goja.Value, opts goja.Value)
	Tap(opts goja.Value)
	TextContent() string
	Type(text string, opts goja.Value)
	Uncheck(opts goja.Value)
	WaitForElementState(state string, opts goja.Value)
	WaitForSelector(selector string, opts goja.Value) ElementHandle
}

ElementHandle is the interface of an in-page DOM element.

type Frame

type Frame interface {
	AddScriptTag(opts goja.Value)
	AddStyleTag(opts goja.Value)
	Check(selector string, opts goja.Value)
	ChildFrames() []Frame
	Click(selector string, opts goja.Value)
	Content() string
	Dblclick(selector string, opts goja.Value)
	DispatchEvent(selector string, typ string, eventInit goja.Value, opts goja.Value)
	Evaluate(pageFunc goja.Value, args ...goja.Value) interface{}
	EvaluateHandle(pageFunc goja.Value, args ...goja.Value) JSHandle
	Fill(selector string, value string, opts goja.Value)
	Focus(selector string, opts goja.Value)
	FrameElement() ElementHandle
	GetAttribute(selector string, name string, opts goja.Value) goja.Value
	Goto(url string, opts goja.Value) Response
	Hover(selector string, opts goja.Value)
	InnerHTML(selector string, opts goja.Value) string
	InnerText(selector string, opts goja.Value) string
	InputValue(selector string, opts goja.Value) string
	IsChecked(selector string, opts goja.Value) bool
	IsDetached() bool
	IsDisabled(selector string, opts goja.Value) bool
	IsEditable(selector string, opts goja.Value) bool
	IsEnabled(selector string, opts goja.Value) bool
	IsHidden(selector string, opts goja.Value) bool
	IsVisible(selector string, opts goja.Value) bool
	ID() string
	LoaderID() string
	Name() string
	Query(selector string) ElementHandle
	QueryAll(selector string) []ElementHandle
	Page() Page
	ParentFrame() Frame
	Press(selector string, key string, opts goja.Value)
	SelectOption(selector string, values goja.Value, opts goja.Value) []string
	SetContent(html string, opts goja.Value)
	SetInputFiles(selector string, files goja.Value, opts goja.Value)
	Tap(selector string, opts goja.Value)
	TextContent(selector string, opts goja.Value) string
	Title() string
	Type(selector string, text string, opts goja.Value)
	Uncheck(selector string, opts goja.Value)
	URL() string
	WaitForFunction(pageFunc goja.Value, opts goja.Value, args ...goja.Value) JSHandle
	WaitForLoadState(state string, opts goja.Value)
	WaitForNavigation(opts goja.Value) Response
	WaitForSelector(selector string, opts goja.Value) ElementHandle
	WaitForTimeout(timeout int64)
}

Frame is the interface of a CDP target frame

type HTTPHeader

type HTTPHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

HTTPHeader is a single HTTP header.

type HTTPMessageSize

type HTTPMessageSize struct {
	Headers int64 `json:"headers"`
	Body    int64 `json:"body"`
}

HTTPMessageSize are the sizes in bytes of the HTTP message header and body.

func (HTTPMessageSize) Total

func (s HTTPMessageSize) Total() int64

Total returns the total size in bytes of the HTTP message.

type JSHandle

type JSHandle interface {
	AsElement() ElementHandle
	Dispose()
	Evaluate(pageFunc goja.Value, args ...goja.Value) interface{}
	EvaluateHandle(pageFunc goja.Value, args ...goja.Value) JSHandle
	GetProperties() map[string]JSHandle
	GetProperty(propertyName string) JSHandle
	JSONValue() goja.Value
}

JSHandle is the interface of an in-page JS object.

type Keyboard

type Keyboard interface {
	Down(key string)
	InsertText(char string)
	Press(key string, opts goja.Value)
	Type(text string, opts goja.Value)
	Up(key string)
}

Keyboard is the interface of a keyboard input device

type Mouse

type Mouse interface {
	Click(x float64, y float64, opts goja.Value)
	DblClick(x float64, y float64, opts goja.Value)
	Down(x float64, y float64, opts goja.Value)
	Move(x float64, y float64, opts goja.Value)
	Up(x float64, y float64, opts goja.Value)
}

Mouse is the interface of a mouse input device

type Page

type Page interface {
	AddInitScript(script goja.Value, arg goja.Value)
	AddScriptTag(opts goja.Value)
	AddStyleTag(opts goja.Value)
	BrintToFront()
	Check(selector string, opts goja.Value)
	Click(selector string, opts goja.Value)
	Close(opts goja.Value)
	Content() string
	Context() BrowserContext
	Dblclick(selector string, opts goja.Value)
	DispatchEvent(selector string, typ string, eventInit goja.Value, opts goja.Value)
	DragAndDrop(source string, target string, opts goja.Value)
	EmulateMedia(opts goja.Value)
	EmulateVisionDeficiency(typ string)
	Evaluate(pageFunc goja.Value, arg ...goja.Value) interface{}
	EvaluateHandle(pageFunc goja.Value, arg ...goja.Value) JSHandle
	ExposeBinding(name string, callback goja.Callable, opts goja.Value)
	ExposeFunction(name string, callback goja.Callable)
	Fill(selector string, value string, opts goja.Value)
	Focus(selector string, opts goja.Value)
	Frame(frameSelector goja.Value) Frame
	Frames() []Frame
	GetAttribute(selector string, name string, opts goja.Value) goja.Value
	GoBack(opts goja.Value) Response
	GoForward(opts goja.Value) Response
	Goto(url string, opts goja.Value) Response
	Hover(selector string, opts goja.Value)
	InnerHTML(selector string, opts goja.Value) string
	InnerText(selector string, opts goja.Value) string
	InputValue(selector string, opts goja.Value) string
	IsChecked(selector string, opts goja.Value) bool
	IsClosed() bool
	IsDisabled(selector string, opts goja.Value) bool
	IsEditable(selector string, opts goja.Value) bool
	IsEnabled(selector string, opts goja.Value) bool
	IsHidden(selector string, opts goja.Value) bool
	IsVisible(selector string, opts goja.Value) bool
	MainFrame() Frame
	Opener() Page
	Pause()
	Pdf(opts goja.Value) goja.ArrayBuffer
	Press(selector string, key string, opts goja.Value)
	Query(selector string) ElementHandle
	QueryAll(selector string) []ElementHandle
	Reload(opts goja.Value) Response
	Route(url goja.Value, handler goja.Callable)
	Screenshot(opts goja.Value) goja.ArrayBuffer
	SelectOption(selector string, values goja.Value, opts goja.Value) []string
	SetContent(html string, opts goja.Value)
	SetDefaultNavigationTimeout(timeout int64)
	SetDefaultTimeout(timeout int64)
	SetExtraHTTPHeaders(headers map[string]string)
	SetInputFiles(selector string, files goja.Value, opts goja.Value)
	SetViewportSize(viewportSize goja.Value)
	Tap(selector string, opts goja.Value)
	TextContent(selector string, opts goja.Value) string
	Title() string
	Type(selector string, text string, opts goja.Value)
	Uncheck(selector string, opts goja.Value)
	Unroute(url goja.Value, handler goja.Callable)
	URL() string
	Video() Video
	ViewportSize() map[string]float64
	WaitForEvent(event string, optsOrPredicate goja.Value) interface{}
	WaitForFunction(pageFunc goja.Value, arg goja.Value, opts goja.Value) JSHandle
	WaitForLoadState(state string, opts goja.Value)
	WaitForNavigation(opts goja.Value) Response
	WaitForRequest(urlOrPredicate, opts goja.Value) Request
	WaitForResponse(urlOrPredicate, opts goja.Value) Response
	WaitForSelector(selector string, opts goja.Value) ElementHandle
	WaitForTimeout(timeout int64)
	Workers() []Worker
}

Page is the interface of a single browser tab.

type Rect

type Rect struct {
	X      float64 `js:"x"`
	Y      float64 `js:"y"`
	Width  float64 `js:"width"`
	Height float64 `js:"height"`
}

type Request

type Request interface {
	AllHeaders() map[string]string
	Failure() goja.Value
	Frame() Frame
	HeaderValue(string) goja.Value
	Headers() map[string]string
	HeadersArray() []HTTPHeader
	IsNavigationRequest() bool
	Method() string
	PostData() string
	PostDataBuffer() goja.ArrayBuffer
	PostDataJSON() string
	RedirectedFrom() Request
	RedirectedTo() Request
	ResourceType() string
	Response() Response
	Size() HTTPMessageSize
	Timing() goja.Value
	URL() string
}

Request is the interface of an HTTP request

type Response

type Response interface {
	AllHeaders() map[string]string
	Body() goja.ArrayBuffer
	Finished() bool // TODO: should return nil|Error
	Frame() Frame
	HeaderValue(string) goja.Value
	HeaderValues(string) []string
	Headers() map[string]string
	HeadersArray() []HTTPHeader
	JSON() goja.Value
	Ok() bool
	Request() Request
	SecurityDetails() goja.Value
	ServerAddr() goja.Value
	Size() HTTPMessageSize
	Status() int64
	StatusText() string
	URL() string
}

Response is the interface of an HTTP response

type Route

type Route interface {
	Abort(errorCode string)
	Continue(opts goja.Value)
	Fulfill(opts goja.Value)
	Request() Request
}

Route is the interface of a route for managing request interception

type Touchscreen

type Touchscreen interface {
	Tap(x float64, y float64)
}

Touchscreen is the interface of a touchscreen.

type Video

type Video interface {
	Path() string
}

Video is the interface of a recorded video

type Worker

type Worker interface {
	Evaluate(pageFunc goja.Value, args ...goja.Value) interface{}
	EvaluateHandle(pageFunc goja.Value, args ...goja.Value) JSHandle
	URL() string
}

Worker is the interface of a web worker.

Jump to

Keyboard shortcuts

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