page

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2018 License: MIT Imports: 7 Imported by: 109

Documentation

Overview

Package page implements the Page domain. Actions and events related to the inspected page belong to the page domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(conn *rpcc.Conn) *domainClient

NewClient returns a client for the Page domain with the connection set to conn.

Types

type AddScriptToEvaluateOnLoadArgs

type AddScriptToEvaluateOnLoadArgs struct {
	ScriptSource string `json:"scriptSource"` // No description.
}

AddScriptToEvaluateOnLoadArgs represents the arguments for AddScriptToEvaluateOnLoad in the Page domain.

func NewAddScriptToEvaluateOnLoadArgs

func NewAddScriptToEvaluateOnLoadArgs(scriptSource string) *AddScriptToEvaluateOnLoadArgs

NewAddScriptToEvaluateOnLoadArgs initializes AddScriptToEvaluateOnLoadArgs with the required arguments.

type AddScriptToEvaluateOnLoadReply

type AddScriptToEvaluateOnLoadReply struct {
	Identifier ScriptIdentifier `json:"identifier"` // Identifier of the added script.
}

AddScriptToEvaluateOnLoadReply represents the return values for AddScriptToEvaluateOnLoad in the Page domain.

type AddScriptToEvaluateOnNewDocumentArgs

type AddScriptToEvaluateOnNewDocumentArgs struct {
	Source string `json:"source"` // No description.
}

AddScriptToEvaluateOnNewDocumentArgs represents the arguments for AddScriptToEvaluateOnNewDocument in the Page domain.

func NewAddScriptToEvaluateOnNewDocumentArgs

func NewAddScriptToEvaluateOnNewDocumentArgs(source string) *AddScriptToEvaluateOnNewDocumentArgs

NewAddScriptToEvaluateOnNewDocumentArgs initializes AddScriptToEvaluateOnNewDocumentArgs with the required arguments.

type AddScriptToEvaluateOnNewDocumentReply

type AddScriptToEvaluateOnNewDocumentReply struct {
	Identifier ScriptIdentifier `json:"identifier"` // Identifier of the added script.
}

AddScriptToEvaluateOnNewDocumentReply represents the return values for AddScriptToEvaluateOnNewDocument in the Page domain.

type AppManifestError

type AppManifestError struct {
	Message  string `json:"message"`  // Error message.
	Critical int    `json:"critical"` // If criticial, this is a non-recoverable parse error.
	Line     int    `json:"line"`     // Error line.
	Column   int    `json:"column"`   // Error column.
}

AppManifestError Error while paring app manifest.

type CaptureScreenshotArgs

type CaptureScreenshotArgs struct {
	// Format Image compression format (defaults to png).
	//
	// Values: "jpeg", "png".
	Format  *string   `json:"format,omitempty"`
	Quality *int      `json:"quality,omitempty"` // Compression quality from range [0..100] (jpeg only).
	Clip    *Viewport `json:"clip,omitempty"`    // Capture the screenshot of a given region only.
	// FromSurface Capture the screenshot from the surface, rather than
	// the view. Defaults to true.
	//
	// Note: This property is experimental.
	FromSurface *bool `json:"fromSurface,omitempty"`
}

CaptureScreenshotArgs represents the arguments for CaptureScreenshot in the Page domain.

func NewCaptureScreenshotArgs

func NewCaptureScreenshotArgs() *CaptureScreenshotArgs

NewCaptureScreenshotArgs initializes CaptureScreenshotArgs with the required arguments.

func (*CaptureScreenshotArgs) SetClip added in v0.9.1

SetClip sets the Clip optional argument. Capture the screenshot of a given region only.

func (*CaptureScreenshotArgs) SetFormat

func (a *CaptureScreenshotArgs) SetFormat(format string) *CaptureScreenshotArgs

SetFormat sets the Format optional argument. Image compression format (defaults to png).

Values: "jpeg", "png".

func (*CaptureScreenshotArgs) SetFromSurface

func (a *CaptureScreenshotArgs) SetFromSurface(fromSurface bool) *CaptureScreenshotArgs

SetFromSurface sets the FromSurface optional argument. Capture the screenshot from the surface, rather than the view. Defaults to true.

Note: This property is experimental.

func (*CaptureScreenshotArgs) SetQuality

func (a *CaptureScreenshotArgs) SetQuality(quality int) *CaptureScreenshotArgs

SetQuality sets the Quality optional argument. Compression quality from range [0..100] (jpeg only).

type CaptureScreenshotReply

type CaptureScreenshotReply struct {
	Data []byte `json:"data"` // Base64-encoded image data.
}

CaptureScreenshotReply represents the return values for CaptureScreenshot in the Page domain.

type CreateIsolatedWorldArgs

type CreateIsolatedWorldArgs struct {
	FrameID             FrameID `json:"frameId"`                       // Id of the frame in which the isolated world should be created.
	WorldName           *string `json:"worldName,omitempty"`           // An optional name which is reported in the Execution Context.
	GrantUniveralAccess *bool   `json:"grantUniveralAccess,omitempty"` // Whether or not universal access should be granted to the isolated world. This is a powerful option, use with caution.
}

CreateIsolatedWorldArgs represents the arguments for CreateIsolatedWorld in the Page domain.

func NewCreateIsolatedWorldArgs

func NewCreateIsolatedWorldArgs(frameID FrameID) *CreateIsolatedWorldArgs

NewCreateIsolatedWorldArgs initializes CreateIsolatedWorldArgs with the required arguments.

func (*CreateIsolatedWorldArgs) SetGrantUniveralAccess

func (a *CreateIsolatedWorldArgs) SetGrantUniveralAccess(grantUniveralAccess bool) *CreateIsolatedWorldArgs

SetGrantUniveralAccess sets the GrantUniveralAccess optional argument. Whether or not universal access should be granted to the isolated world. This is a powerful option, use with caution.

func (*CreateIsolatedWorldArgs) SetWorldName

func (a *CreateIsolatedWorldArgs) SetWorldName(worldName string) *CreateIsolatedWorldArgs

SetWorldName sets the WorldName optional argument. An optional name which is reported in the Execution Context.

type CreateIsolatedWorldReply

type CreateIsolatedWorldReply struct {
	ExecutionContextID runtime.ExecutionContextID `json:"executionContextId"` // Execution context of the isolated world.
}

CreateIsolatedWorldReply represents the return values for CreateIsolatedWorld in the Page domain.

type DOMContentEventFiredClient

type DOMContentEventFiredClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*DOMContentEventFiredReply, error)
	rpcc.Stream
}

DOMContentEventFiredClient is a client for DOMContentEventFired events.

type DOMContentEventFiredReply

type DOMContentEventFiredReply struct {
	Timestamp network.MonotonicTime `json:"timestamp"` // No description.
}

DOMContentEventFiredReply is the reply for DOMContentEventFired events.

type DialogType

type DialogType string

DialogType Javascript dialog type.

const (
	DialogTypeNotSet       DialogType = ""
	DialogTypeAlert        DialogType = "alert"
	DialogTypeConfirm      DialogType = "confirm"
	DialogTypePrompt       DialogType = "prompt"
	DialogTypeBeforeunload DialogType = "beforeunload"
)

DialogType as enums.

func (DialogType) String

func (e DialogType) String() string

func (DialogType) Valid

func (e DialogType) Valid() bool

type Frame

type Frame struct {
	ID             FrameID          `json:"id"`                 // Frame unique identifier.
	ParentID       *FrameID         `json:"parentId,omitempty"` // Parent frame identifier.
	LoaderID       network.LoaderID `json:"loaderId"`           // Identifier of the loader associated with this frame.
	Name           *string          `json:"name,omitempty"`     // Frame's name as specified in the tag.
	URL            string           `json:"url"`                // Frame document's URL.
	SecurityOrigin string           `json:"securityOrigin"`     // Frame document's security origin.
	MimeType       string           `json:"mimeType"`           // Frame document's mimeType as determined by the browser.
	// UnreachableURL If the frame failed to load, this contains the URL
	// that could not be loaded.
	//
	// Note: This property is experimental.
	UnreachableURL *string `json:"unreachableUrl,omitempty"`
}

Frame Information about the Frame on the page.

type FrameAttachedClient

type FrameAttachedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*FrameAttachedReply, error)
	rpcc.Stream
}

FrameAttachedClient is a client for FrameAttached events. Fired when frame has been attached to its parent.

type FrameAttachedReply

type FrameAttachedReply struct {
	FrameID       FrameID             `json:"frameId"`         // Id of the frame that has been attached.
	ParentFrameID FrameID             `json:"parentFrameId"`   // Parent frame identifier.
	Stack         *runtime.StackTrace `json:"stack,omitempty"` // JavaScript stack trace of when frame was attached, only set if frame initiated from script.
}

FrameAttachedReply is the reply for FrameAttached events.

type FrameClearedScheduledNavigationClient

type FrameClearedScheduledNavigationClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*FrameClearedScheduledNavigationReply, error)
	rpcc.Stream
}

FrameClearedScheduledNavigationClient is a client for FrameClearedScheduledNavigation events. Fired when frame no longer has a scheduled navigation.

type FrameClearedScheduledNavigationReply

type FrameClearedScheduledNavigationReply struct {
	FrameID FrameID `json:"frameId"` // Id of the frame that has cleared its scheduled navigation.
}

FrameClearedScheduledNavigationReply is the reply for FrameClearedScheduledNavigation events.

type FrameDetachedClient

type FrameDetachedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*FrameDetachedReply, error)
	rpcc.Stream
}

FrameDetachedClient is a client for FrameDetached events. Fired when frame has been detached from its parent.

type FrameDetachedReply

type FrameDetachedReply struct {
	FrameID FrameID `json:"frameId"` // Id of the frame that has been detached.
}

FrameDetachedReply is the reply for FrameDetached events.

type FrameID

type FrameID = internal.PageFrameID

FrameID Unique frame identifier.

Provided as an alias to prevent circular dependencies.

type FrameNavigatedClient

type FrameNavigatedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*FrameNavigatedReply, error)
	rpcc.Stream
}

FrameNavigatedClient is a client for FrameNavigated events. Fired once navigation of the frame has completed. Frame is now associated with the new loader.

type FrameNavigatedReply

type FrameNavigatedReply struct {
	Frame Frame `json:"frame"` // Frame object.
}

FrameNavigatedReply is the reply for FrameNavigated events.

type FrameResizedClient

type FrameResizedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*FrameResizedReply, error)
	rpcc.Stream
}

FrameResizedClient is a client for FrameResized events.

type FrameResizedReply

type FrameResizedReply struct {
}

FrameResizedReply is the reply for FrameResized events.

type FrameResource

type FrameResource struct {
	URL          string                 `json:"url"`                    // Resource URL.
	Type         ResourceType           `json:"type"`                   // Type of this resource.
	MimeType     string                 `json:"mimeType"`               // Resource mimeType as determined by the browser.
	LastModified network.TimeSinceEpoch `json:"lastModified,omitempty"` // last-modified timestamp as reported by server.
	ContentSize  *float64               `json:"contentSize,omitempty"`  // Resource content size.
	Failed       *bool                  `json:"failed,omitempty"`       // True if the resource failed to load.
	Canceled     *bool                  `json:"canceled,omitempty"`     // True if the resource was canceled during loading.
}

FrameResource Information about the Resource on the page.

Note: This type is experimental.

type FrameResourceTree

type FrameResourceTree struct {
	Frame       Frame               `json:"frame"`                 // Frame information for this tree item.
	ChildFrames []FrameResourceTree `json:"childFrames,omitempty"` // Child frames.
	Resources   []FrameResource     `json:"resources"`             // Information about frame resources.
}

FrameResourceTree Information about the Frame hierarchy along with their cached resources.

Note: This type is experimental.

type FrameScheduledNavigationClient

type FrameScheduledNavigationClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*FrameScheduledNavigationReply, error)
	rpcc.Stream
}

FrameScheduledNavigationClient is a client for FrameScheduledNavigation events. Fired when frame schedules a potential navigation.

type FrameScheduledNavigationReply

type FrameScheduledNavigationReply struct {
	FrameID FrameID `json:"frameId"` // Id of the frame that has scheduled a navigation.
	Delay   float64 `json:"delay"`   // Delay (in seconds) until the navigation is scheduled to begin. The navigation is not guaranteed to start.
	// Reason The reason for the navigation.
	//
	// Values: "formSubmissionGet", "formSubmissionPost", "httpHeaderRefresh", "scriptInitiated", "metaTagRefresh", "pageBlockInterstitial", "reload".
	Reason string `json:"reason"`
	URL    string `json:"url"` // The destination URL for the scheduled navigation.
}

FrameScheduledNavigationReply is the reply for FrameScheduledNavigation events.

type FrameStartedLoadingClient

type FrameStartedLoadingClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*FrameStartedLoadingReply, error)
	rpcc.Stream
}

FrameStartedLoadingClient is a client for FrameStartedLoading events. Fired when frame has started loading.

type FrameStartedLoadingReply

type FrameStartedLoadingReply struct {
	FrameID FrameID `json:"frameId"` // Id of the frame that has started loading.
}

FrameStartedLoadingReply is the reply for FrameStartedLoading events.

type FrameStoppedLoadingClient

type FrameStoppedLoadingClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*FrameStoppedLoadingReply, error)
	rpcc.Stream
}

FrameStoppedLoadingClient is a client for FrameStoppedLoading events. Fired when frame has stopped loading.

type FrameStoppedLoadingReply

type FrameStoppedLoadingReply struct {
	FrameID FrameID `json:"frameId"` // Id of the frame that has stopped loading.
}

FrameStoppedLoadingReply is the reply for FrameStoppedLoading events.

type FrameTree added in v0.14.2

type FrameTree struct {
	Frame       Frame       `json:"frame"`                 // Frame information for this tree item.
	ChildFrames []FrameTree `json:"childFrames,omitempty"` // Child frames.
}

FrameTree Information about the Frame hierarchy.

type GetAppManifestReply

type GetAppManifestReply struct {
	URL    string             `json:"url"`            // Manifest location.
	Errors []AppManifestError `json:"errors"`         // No description.
	Data   *string            `json:"data,omitempty"` // Manifest content.
}

GetAppManifestReply represents the return values for GetAppManifest in the Page domain.

type GetFrameTreeReply added in v0.14.2

type GetFrameTreeReply struct {
	FrameTree FrameTree `json:"frameTree"` // Present frame tree structure.
}

GetFrameTreeReply represents the return values for GetFrameTree in the Page domain.

type GetLayoutMetricsReply

type GetLayoutMetricsReply struct {
	LayoutViewport LayoutViewport `json:"layoutViewport"` // Metrics relating to the layout viewport.
	VisualViewport VisualViewport `json:"visualViewport"` // Metrics relating to the visual viewport.
	ContentSize    dom.Rect       `json:"contentSize"`    // Size of scrollable area.
}

GetLayoutMetricsReply represents the return values for GetLayoutMetrics in the Page domain.

type GetNavigationHistoryReply

type GetNavigationHistoryReply struct {
	CurrentIndex int               `json:"currentIndex"` // Index of the current navigation history entry.
	Entries      []NavigationEntry `json:"entries"`      // Array of navigation history entries.
}

GetNavigationHistoryReply represents the return values for GetNavigationHistory in the Page domain.

type GetResourceContentArgs

type GetResourceContentArgs struct {
	FrameID FrameID `json:"frameId"` // Frame id to get resource for.
	URL     string  `json:"url"`     // URL of the resource to get content for.
}

GetResourceContentArgs represents the arguments for GetResourceContent in the Page domain.

func NewGetResourceContentArgs

func NewGetResourceContentArgs(frameID FrameID, url string) *GetResourceContentArgs

NewGetResourceContentArgs initializes GetResourceContentArgs with the required arguments.

type GetResourceContentReply

type GetResourceContentReply struct {
	Content       string `json:"content"`       // Resource content.
	Base64Encoded bool   `json:"base64Encoded"` // True, if content was served as base64.
}

GetResourceContentReply represents the return values for GetResourceContent in the Page domain.

type GetResourceTreeReply

type GetResourceTreeReply struct {
	FrameTree FrameResourceTree `json:"frameTree"` // Present frame / resource tree structure.
}

GetResourceTreeReply represents the return values for GetResourceTree in the Page domain.

type HandleJavaScriptDialogArgs

type HandleJavaScriptDialogArgs struct {
	Accept     bool    `json:"accept"`               // Whether to accept or dismiss the dialog.
	PromptText *string `json:"promptText,omitempty"` // The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.
}

HandleJavaScriptDialogArgs represents the arguments for HandleJavaScriptDialog in the Page domain.

func NewHandleJavaScriptDialogArgs

func NewHandleJavaScriptDialogArgs(accept bool) *HandleJavaScriptDialogArgs

NewHandleJavaScriptDialogArgs initializes HandleJavaScriptDialogArgs with the required arguments.

func (*HandleJavaScriptDialogArgs) SetPromptText

func (a *HandleJavaScriptDialogArgs) SetPromptText(promptText string) *HandleJavaScriptDialogArgs

SetPromptText sets the PromptText optional argument. The text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.

type InterstitialHiddenClient

type InterstitialHiddenClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*InterstitialHiddenReply, error)
	rpcc.Stream
}

InterstitialHiddenClient is a client for InterstitialHidden events. Fired when interstitial page was hidden

type InterstitialHiddenReply

type InterstitialHiddenReply struct {
}

InterstitialHiddenReply is the reply for InterstitialHidden events.

type InterstitialShownClient

type InterstitialShownClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*InterstitialShownReply, error)
	rpcc.Stream
}

InterstitialShownClient is a client for InterstitialShown events. Fired when interstitial page was shown

type InterstitialShownReply

type InterstitialShownReply struct {
}

InterstitialShownReply is the reply for InterstitialShown events.

type JavascriptDialogClosedClient

type JavascriptDialogClosedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*JavascriptDialogClosedReply, error)
	rpcc.Stream
}

JavascriptDialogClosedClient is a client for JavascriptDialogClosed events. Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed.

type JavascriptDialogClosedReply

type JavascriptDialogClosedReply struct {
	Result    bool   `json:"result"`    // Whether dialog was confirmed.
	UserInput string `json:"userInput"` // User input in case of prompt.
}

JavascriptDialogClosedReply is the reply for JavascriptDialogClosed events.

type JavascriptDialogOpeningClient

type JavascriptDialogOpeningClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*JavascriptDialogOpeningReply, error)
	rpcc.Stream
}

JavascriptDialogOpeningClient is a client for JavascriptDialogOpening events. Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) is about to open.

type JavascriptDialogOpeningReply

type JavascriptDialogOpeningReply struct {
	URL           string     `json:"url"`                     // Frame url.
	Message       string     `json:"message"`                 // Message that will be displayed by the dialog.
	Type          DialogType `json:"type"`                    // Dialog type.
	DefaultPrompt *string    `json:"defaultPrompt,omitempty"` // Default dialog prompt.
}

JavascriptDialogOpeningReply is the reply for JavascriptDialogOpening events.

type LayoutViewport

type LayoutViewport struct {
	PageX        int `json:"pageX"`        // Horizontal offset relative to the document (CSS pixels).
	PageY        int `json:"pageY"`        // Vertical offset relative to the document (CSS pixels).
	ClientWidth  int `json:"clientWidth"`  // Width (CSS pixels), excludes scrollbar if present.
	ClientHeight int `json:"clientHeight"` // Height (CSS pixels), excludes scrollbar if present.
}

LayoutViewport Layout viewport position and dimensions.

type LifecycleEventClient added in v0.11.4

type LifecycleEventClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*LifecycleEventReply, error)
	rpcc.Stream
}

LifecycleEventClient is a client for LifecycleEvent events. Fired for top level page lifecycle events such as navigation, load, paint, etc.

type LifecycleEventReply added in v0.11.4

type LifecycleEventReply struct {
	FrameID   FrameID               `json:"frameId"`   // Id of the frame.
	LoaderID  network.LoaderID      `json:"loaderId"`  // Loader identifier. Empty string if the request is fetched from worker.
	Name      string                `json:"name"`      // No description.
	Timestamp network.MonotonicTime `json:"timestamp"` // No description.
}

LifecycleEventReply is the reply for LifecycleEvent events.

type LoadEventFiredClient

type LoadEventFiredClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*LoadEventFiredReply, error)
	rpcc.Stream
}

LoadEventFiredClient is a client for LoadEventFired events.

type LoadEventFiredReply

type LoadEventFiredReply struct {
	Timestamp network.MonotonicTime `json:"timestamp"` // No description.
}

LoadEventFiredReply is the reply for LoadEventFired events.

type NavigateArgs struct {
	URL            string         `json:"url"`                      // URL to navigate the page to.
	Referrer       *string        `json:"referrer,omitempty"`       // Referrer URL.
	TransitionType TransitionType `json:"transitionType,omitempty"` // Intended transition type.
	FrameID        *FrameID       `json:"frameId,omitempty"`        // Frame id to navigate, if not specified navigates the top frame.
}

NavigateArgs represents the arguments for Navigate in the Page domain.

func NewNavigateArgs

func NewNavigateArgs(url string) *NavigateArgs

NewNavigateArgs initializes NavigateArgs with the required arguments.

func (a *NavigateArgs) SetFrameID(frameID FrameID) *NavigateArgs

SetFrameID sets the FrameID optional argument. Frame id to navigate, if not specified navigates the top frame.

func (a *NavigateArgs) SetReferrer(referrer string) *NavigateArgs

SetReferrer sets the Referrer optional argument. Referrer URL.

func (a *NavigateArgs) SetTransitionType(transitionType TransitionType) *NavigateArgs

SetTransitionType sets the TransitionType optional argument. Intended transition type.

type NavigateReply struct {
	FrameID   FrameID           `json:"frameId"`             // Frame id that has navigated (or failed to navigate)
	LoaderID  *network.LoaderID `json:"loaderId,omitempty"`  // Loader identifier.
	ErrorText *string           `json:"errorText,omitempty"` // User friendly error message, present if and only if navigation has failed.
}

NavigateReply represents the return values for Navigate in the Page domain.

type NavigateToHistoryEntryArgs struct {
	EntryID int `json:"entryId"` // Unique id of the entry to navigate to.
}

NavigateToHistoryEntryArgs represents the arguments for NavigateToHistoryEntry in the Page domain.

func NewNavigateToHistoryEntryArgs

func NewNavigateToHistoryEntryArgs(entryID int) *NavigateToHistoryEntryArgs

NewNavigateToHistoryEntryArgs initializes NavigateToHistoryEntryArgs with the required arguments.

type NavigationEntry struct {
	ID             int            `json:"id"`             // Unique id of the navigation history entry.
	URL            string         `json:"url"`            // URL of the navigation history entry.
	UserTypedURL   string         `json:"userTypedURL"`   // URL that the user typed in the url bar.
	Title          string         `json:"title"`          // Title of the navigation history entry.
	TransitionType TransitionType `json:"transitionType"` // Transition type.
}

NavigationEntry Navigation history entry.

type PrintToPDFArgs

type PrintToPDFArgs struct {
	Landscape               *bool    `json:"landscape,omitempty"`               // Paper orientation. Defaults to false.
	DisplayHeaderFooter     *bool    `json:"displayHeaderFooter,omitempty"`     // Display header and footer. Defaults to false.
	PrintBackground         *bool    `json:"printBackground,omitempty"`         // Print background graphics. Defaults to false.
	Scale                   *float64 `json:"scale,omitempty"`                   // Scale of the webpage rendering. Defaults to 1.
	PaperWidth              *float64 `json:"paperWidth,omitempty"`              // Paper width in inches. Defaults to 8.5 inches.
	PaperHeight             *float64 `json:"paperHeight,omitempty"`             // Paper height in inches. Defaults to 11 inches.
	MarginTop               *float64 `json:"marginTop,omitempty"`               // Top margin in inches. Defaults to 1cm (~0.4 inches).
	MarginBottom            *float64 `json:"marginBottom,omitempty"`            // Bottom margin in inches. Defaults to 1cm (~0.4 inches).
	MarginLeft              *float64 `json:"marginLeft,omitempty"`              // Left margin in inches. Defaults to 1cm (~0.4 inches).
	MarginRight             *float64 `json:"marginRight,omitempty"`             // Right margin in inches. Defaults to 1cm (~0.4 inches).
	PageRanges              *string  `json:"pageRanges,omitempty"`              // Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.
	IgnoreInvalidPageRanges *bool    `json:"ignoreInvalidPageRanges,omitempty"` // Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. Defaults to false.
	HeaderTemplate          *string  `json:"headerTemplate,omitempty"`          // HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: - date - formatted print date - title - document title - url - document location - pageNumber - current page number - totalPages - total pages in the document For example, <span class=title></span> would generate span containing the title.
	FooterTemplate          *string  `json:"footerTemplate,omitempty"`          // HTML template for the print footer. Should use the same format as the `headerTemplate`.
	PreferCSSPageSize       *bool    `json:"preferCSSPageSize,omitempty"`       // Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.
}

PrintToPDFArgs represents the arguments for PrintToPDF in the Page domain.

func NewPrintToPDFArgs

func NewPrintToPDFArgs() *PrintToPDFArgs

NewPrintToPDFArgs initializes PrintToPDFArgs with the required arguments.

func (*PrintToPDFArgs) SetDisplayHeaderFooter

func (a *PrintToPDFArgs) SetDisplayHeaderFooter(displayHeaderFooter bool) *PrintToPDFArgs

SetDisplayHeaderFooter sets the DisplayHeaderFooter optional argument. Display header and footer. Defaults to false.

func (*PrintToPDFArgs) SetFooterTemplate added in v0.15.4

func (a *PrintToPDFArgs) SetFooterTemplate(footerTemplate string) *PrintToPDFArgs

SetFooterTemplate sets the FooterTemplate optional argument. HTML template for the print footer. Should use the same format as the `headerTemplate`.

func (*PrintToPDFArgs) SetHeaderTemplate added in v0.15.4

func (a *PrintToPDFArgs) SetHeaderTemplate(headerTemplate string) *PrintToPDFArgs

SetHeaderTemplate sets the HeaderTemplate optional argument. HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: - date - formatted print date - title - document title - url - document location - pageNumber - current page number - totalPages - total pages in the document

For example, <span class=title></span> would generate span containing the title.

func (*PrintToPDFArgs) SetIgnoreInvalidPageRanges added in v0.9.1

func (a *PrintToPDFArgs) SetIgnoreInvalidPageRanges(ignoreInvalidPageRanges bool) *PrintToPDFArgs

SetIgnoreInvalidPageRanges sets the IgnoreInvalidPageRanges optional argument. Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. Defaults to false.

func (*PrintToPDFArgs) SetLandscape

func (a *PrintToPDFArgs) SetLandscape(landscape bool) *PrintToPDFArgs

SetLandscape sets the Landscape optional argument. Paper orientation. Defaults to false.

func (*PrintToPDFArgs) SetMarginBottom

func (a *PrintToPDFArgs) SetMarginBottom(marginBottom float64) *PrintToPDFArgs

SetMarginBottom sets the MarginBottom optional argument. Bottom margin in inches. Defaults to 1cm (~0.4 inches).

func (*PrintToPDFArgs) SetMarginLeft

func (a *PrintToPDFArgs) SetMarginLeft(marginLeft float64) *PrintToPDFArgs

SetMarginLeft sets the MarginLeft optional argument. Left margin in inches. Defaults to 1cm (~0.4 inches).

func (*PrintToPDFArgs) SetMarginRight

func (a *PrintToPDFArgs) SetMarginRight(marginRight float64) *PrintToPDFArgs

SetMarginRight sets the MarginRight optional argument. Right margin in inches. Defaults to 1cm (~0.4 inches).

func (*PrintToPDFArgs) SetMarginTop

func (a *PrintToPDFArgs) SetMarginTop(marginTop float64) *PrintToPDFArgs

SetMarginTop sets the MarginTop optional argument. Top margin in inches. Defaults to 1cm (~0.4 inches).

func (*PrintToPDFArgs) SetPageRanges

func (a *PrintToPDFArgs) SetPageRanges(pageRanges string) *PrintToPDFArgs

SetPageRanges sets the PageRanges optional argument. Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.

func (*PrintToPDFArgs) SetPaperHeight

func (a *PrintToPDFArgs) SetPaperHeight(paperHeight float64) *PrintToPDFArgs

SetPaperHeight sets the PaperHeight optional argument. Paper height in inches. Defaults to 11 inches.

func (*PrintToPDFArgs) SetPaperWidth

func (a *PrintToPDFArgs) SetPaperWidth(paperWidth float64) *PrintToPDFArgs

SetPaperWidth sets the PaperWidth optional argument. Paper width in inches. Defaults to 8.5 inches.

func (*PrintToPDFArgs) SetPreferCSSPageSize added in v0.16.4

func (a *PrintToPDFArgs) SetPreferCSSPageSize(preferCSSPageSize bool) *PrintToPDFArgs

SetPreferCSSPageSize sets the PreferCSSPageSize optional argument. Whether or not to prefer page size as defined by css. Defaults to false, in which case the content will be scaled to fit the paper size.

func (*PrintToPDFArgs) SetPrintBackground

func (a *PrintToPDFArgs) SetPrintBackground(printBackground bool) *PrintToPDFArgs

SetPrintBackground sets the PrintBackground optional argument. Print background graphics. Defaults to false.

func (*PrintToPDFArgs) SetScale

func (a *PrintToPDFArgs) SetScale(scale float64) *PrintToPDFArgs

SetScale sets the Scale optional argument. Scale of the webpage rendering. Defaults to 1.

type PrintToPDFReply

type PrintToPDFReply struct {
	Data []byte `json:"data"` // Base64-encoded pdf data.
}

PrintToPDFReply represents the return values for PrintToPDF in the Page domain.

type ReloadArgs

type ReloadArgs struct {
	IgnoreCache            *bool   `json:"ignoreCache,omitempty"`            // If true, browser cache is ignored (as if the user pressed Shift+refresh).
	ScriptToEvaluateOnLoad *string `json:"scriptToEvaluateOnLoad,omitempty"` // If set, the script will be injected into all frames of the inspected page after reload. Argument will be ignored if reloading dataURL origin.
}

ReloadArgs represents the arguments for Reload in the Page domain.

func NewReloadArgs

func NewReloadArgs() *ReloadArgs

NewReloadArgs initializes ReloadArgs with the required arguments.

func (*ReloadArgs) SetIgnoreCache

func (a *ReloadArgs) SetIgnoreCache(ignoreCache bool) *ReloadArgs

SetIgnoreCache sets the IgnoreCache optional argument. If true, browser cache is ignored (as if the user pressed Shift+refresh).

func (*ReloadArgs) SetScriptToEvaluateOnLoad

func (a *ReloadArgs) SetScriptToEvaluateOnLoad(scriptToEvaluateOnLoad string) *ReloadArgs

SetScriptToEvaluateOnLoad sets the ScriptToEvaluateOnLoad optional argument. If set, the script will be injected into all frames of the inspected page after reload. Argument will be ignored if reloading dataURL origin.

type RemoveScriptToEvaluateOnLoadArgs

type RemoveScriptToEvaluateOnLoadArgs struct {
	Identifier ScriptIdentifier `json:"identifier"` // No description.
}

RemoveScriptToEvaluateOnLoadArgs represents the arguments for RemoveScriptToEvaluateOnLoad in the Page domain.

func NewRemoveScriptToEvaluateOnLoadArgs

func NewRemoveScriptToEvaluateOnLoadArgs(identifier ScriptIdentifier) *RemoveScriptToEvaluateOnLoadArgs

NewRemoveScriptToEvaluateOnLoadArgs initializes RemoveScriptToEvaluateOnLoadArgs with the required arguments.

type RemoveScriptToEvaluateOnNewDocumentArgs

type RemoveScriptToEvaluateOnNewDocumentArgs struct {
	Identifier ScriptIdentifier `json:"identifier"` // No description.
}

RemoveScriptToEvaluateOnNewDocumentArgs represents the arguments for RemoveScriptToEvaluateOnNewDocument in the Page domain.

func NewRemoveScriptToEvaluateOnNewDocumentArgs

func NewRemoveScriptToEvaluateOnNewDocumentArgs(identifier ScriptIdentifier) *RemoveScriptToEvaluateOnNewDocumentArgs

NewRemoveScriptToEvaluateOnNewDocumentArgs initializes RemoveScriptToEvaluateOnNewDocumentArgs with the required arguments.

type ResourceType

type ResourceType = internal.PageResourceType

ResourceType Resource type as it was perceived by the rendering engine.

Provided as an alias to prevent circular dependencies.

const (
	ResourceTypeNotSet      ResourceType = ""
	ResourceTypeDocument    ResourceType = "Document"
	ResourceTypeStylesheet  ResourceType = "Stylesheet"
	ResourceTypeImage       ResourceType = "Image"
	ResourceTypeMedia       ResourceType = "Media"
	ResourceTypeFont        ResourceType = "Font"
	ResourceTypeScript      ResourceType = "Script"
	ResourceTypeTextTrack   ResourceType = "TextTrack"
	ResourceTypeXHR         ResourceType = "XHR"
	ResourceTypeFetch       ResourceType = "Fetch"
	ResourceTypeEventSource ResourceType = "EventSource"
	ResourceTypeWebSocket   ResourceType = "WebSocket"
	ResourceTypeManifest    ResourceType = "Manifest"
	ResourceTypeOther       ResourceType = "Other"
)

ResourceType as enums.

type ScreencastFrameAckArgs

type ScreencastFrameAckArgs struct {
	SessionID int `json:"sessionId"` // Frame number.
}

ScreencastFrameAckArgs represents the arguments for ScreencastFrameAck in the Page domain.

func NewScreencastFrameAckArgs

func NewScreencastFrameAckArgs(sessionID int) *ScreencastFrameAckArgs

NewScreencastFrameAckArgs initializes ScreencastFrameAckArgs with the required arguments.

type ScreencastFrameClient

type ScreencastFrameClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ScreencastFrameReply, error)
	rpcc.Stream
}

ScreencastFrameClient is a client for ScreencastFrame events. Compressed image data requested by the `startScreencast`.

type ScreencastFrameMetadata

type ScreencastFrameMetadata struct {
	OffsetTop       float64                `json:"offsetTop"`           // Top offset in DIP.
	PageScaleFactor float64                `json:"pageScaleFactor"`     // Page scale factor.
	DeviceWidth     float64                `json:"deviceWidth"`         // Device screen width in DIP.
	DeviceHeight    float64                `json:"deviceHeight"`        // Device screen height in DIP.
	ScrollOffsetX   float64                `json:"scrollOffsetX"`       // Position of horizontal scroll in CSS pixels.
	ScrollOffsetY   float64                `json:"scrollOffsetY"`       // Position of vertical scroll in CSS pixels.
	Timestamp       network.TimeSinceEpoch `json:"timestamp,omitempty"` // Frame swap timestamp.
}

ScreencastFrameMetadata Screencast frame metadata.

Note: This type is experimental.

type ScreencastFrameReply

type ScreencastFrameReply struct {
	Data      []byte                  `json:"data"`      // Base64-encoded compressed image.
	Metadata  ScreencastFrameMetadata `json:"metadata"`  // Screencast frame metadata.
	SessionID int                     `json:"sessionId"` // Frame number.
}

ScreencastFrameReply is the reply for ScreencastFrame events.

type ScreencastVisibilityChangedClient

type ScreencastVisibilityChangedClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*ScreencastVisibilityChangedReply, error)
	rpcc.Stream
}

ScreencastVisibilityChangedClient is a client for ScreencastVisibilityChanged events. Fired when the page with currently enabled screencast was shown or hidden `.

type ScreencastVisibilityChangedReply

type ScreencastVisibilityChangedReply struct {
	Visible bool `json:"visible"` // True if the page is visible.
}

ScreencastVisibilityChangedReply is the reply for ScreencastVisibilityChanged events.

type ScriptIdentifier

type ScriptIdentifier string

ScriptIdentifier Unique script identifier.

type SearchInResourceArgs

type SearchInResourceArgs struct {
	FrameID       FrameID `json:"frameId"`                 // Frame id for resource to search in.
	URL           string  `json:"url"`                     // URL of the resource to search in.
	Query         string  `json:"query"`                   // String to search for.
	CaseSensitive *bool   `json:"caseSensitive,omitempty"` // If true, search is case sensitive.
	IsRegex       *bool   `json:"isRegex,omitempty"`       // If true, treats string parameter as regex.
}

SearchInResourceArgs represents the arguments for SearchInResource in the Page domain.

func NewSearchInResourceArgs

func NewSearchInResourceArgs(frameID FrameID, url string, query string) *SearchInResourceArgs

NewSearchInResourceArgs initializes SearchInResourceArgs with the required arguments.

func (*SearchInResourceArgs) SetCaseSensitive

func (a *SearchInResourceArgs) SetCaseSensitive(caseSensitive bool) *SearchInResourceArgs

SetCaseSensitive sets the CaseSensitive optional argument. If true, search is case sensitive.

func (*SearchInResourceArgs) SetIsRegex

func (a *SearchInResourceArgs) SetIsRegex(isRegex bool) *SearchInResourceArgs

SetIsRegex sets the IsRegex optional argument. If true, treats string parameter as regex.

type SearchInResourceReply

type SearchInResourceReply struct {
	Result []debugger.SearchMatch `json:"result"` // List of search matches.
}

SearchInResourceReply represents the return values for SearchInResource in the Page domain.

type SetAdBlockingEnabledArgs added in v0.9.1

type SetAdBlockingEnabledArgs struct {
	Enabled bool `json:"enabled"` // Whether to block ads.
}

SetAdBlockingEnabledArgs represents the arguments for SetAdBlockingEnabled in the Page domain.

func NewSetAdBlockingEnabledArgs added in v0.9.1

func NewSetAdBlockingEnabledArgs(enabled bool) *SetAdBlockingEnabledArgs

NewSetAdBlockingEnabledArgs initializes SetAdBlockingEnabledArgs with the required arguments.

type SetDocumentContentArgs

type SetDocumentContentArgs struct {
	FrameID FrameID `json:"frameId"` // Frame id to set HTML for.
	HTML    string  `json:"html"`    // HTML content to set.
}

SetDocumentContentArgs represents the arguments for SetDocumentContent in the Page domain.

func NewSetDocumentContentArgs

func NewSetDocumentContentArgs(frameID FrameID, html string) *SetDocumentContentArgs

NewSetDocumentContentArgs initializes SetDocumentContentArgs with the required arguments.

type SetDownloadBehaviorArgs added in v0.11.4

type SetDownloadBehaviorArgs struct {
	// Behavior Whether to allow all or deny all download requests, or use
	// default Chrome behavior if available (otherwise deny).
	//
	// Values: "deny", "allow", "default".
	Behavior     string  `json:"behavior"`
	DownloadPath *string `json:"downloadPath,omitempty"` // The default path to save downloaded files to. This is required if behavior is set to 'allow'
}

SetDownloadBehaviorArgs represents the arguments for SetDownloadBehavior in the Page domain.

func NewSetDownloadBehaviorArgs added in v0.11.4

func NewSetDownloadBehaviorArgs(behavior string) *SetDownloadBehaviorArgs

NewSetDownloadBehaviorArgs initializes SetDownloadBehaviorArgs with the required arguments.

func (*SetDownloadBehaviorArgs) SetDownloadPath added in v0.11.4

func (a *SetDownloadBehaviorArgs) SetDownloadPath(downloadPath string) *SetDownloadBehaviorArgs

SetDownloadPath sets the DownloadPath optional argument. The default path to save downloaded files to. This is required if behavior is set to 'allow'

type SetLifecycleEventsEnabledArgs added in v0.14.2

type SetLifecycleEventsEnabledArgs struct {
	Enabled bool `json:"enabled"` // If true, starts emitting lifecycle events.
}

SetLifecycleEventsEnabledArgs represents the arguments for SetLifecycleEventsEnabled in the Page domain.

func NewSetLifecycleEventsEnabledArgs added in v0.14.2

func NewSetLifecycleEventsEnabledArgs(enabled bool) *SetLifecycleEventsEnabledArgs

NewSetLifecycleEventsEnabledArgs initializes SetLifecycleEventsEnabledArgs with the required arguments.

type StartScreencastArgs

type StartScreencastArgs struct {
	// Format Image compression format.
	//
	// Values: "jpeg", "png".
	Format        *string `json:"format,omitempty"`
	Quality       *int    `json:"quality,omitempty"`       // Compression quality from range [0..100].
	MaxWidth      *int    `json:"maxWidth,omitempty"`      // Maximum screenshot width.
	MaxHeight     *int    `json:"maxHeight,omitempty"`     // Maximum screenshot height.
	EveryNthFrame *int    `json:"everyNthFrame,omitempty"` // Send every n-th frame.
}

StartScreencastArgs represents the arguments for StartScreencast in the Page domain.

func NewStartScreencastArgs

func NewStartScreencastArgs() *StartScreencastArgs

NewStartScreencastArgs initializes StartScreencastArgs with the required arguments.

func (*StartScreencastArgs) SetEveryNthFrame

func (a *StartScreencastArgs) SetEveryNthFrame(everyNthFrame int) *StartScreencastArgs

SetEveryNthFrame sets the EveryNthFrame optional argument. Send every n-th frame.

func (*StartScreencastArgs) SetFormat

func (a *StartScreencastArgs) SetFormat(format string) *StartScreencastArgs

SetFormat sets the Format optional argument. Image compression format.

Values: "jpeg", "png".

func (*StartScreencastArgs) SetMaxHeight

func (a *StartScreencastArgs) SetMaxHeight(maxHeight int) *StartScreencastArgs

SetMaxHeight sets the MaxHeight optional argument. Maximum screenshot height.

func (*StartScreencastArgs) SetMaxWidth

func (a *StartScreencastArgs) SetMaxWidth(maxWidth int) *StartScreencastArgs

SetMaxWidth sets the MaxWidth optional argument. Maximum screenshot width.

func (*StartScreencastArgs) SetQuality

func (a *StartScreencastArgs) SetQuality(quality int) *StartScreencastArgs

SetQuality sets the Quality optional argument. Compression quality from range [0..100].

type TransitionType

type TransitionType string

TransitionType Transition type.

const (
	TransitionTypeNotSet           TransitionType = ""
	TransitionTypeLink             TransitionType = "link"
	TransitionTypeTyped            TransitionType = "typed"
	TransitionTypeAutoBookmark     TransitionType = "auto_bookmark"
	TransitionTypeAutoSubframe     TransitionType = "auto_subframe"
	TransitionTypeManualSubframe   TransitionType = "manual_subframe"
	TransitionTypeGenerated        TransitionType = "generated"
	TransitionTypeAutoToplevel     TransitionType = "auto_toplevel"
	TransitionTypeFormSubmit       TransitionType = "form_submit"
	TransitionTypeReload           TransitionType = "reload"
	TransitionTypeKeyword          TransitionType = "keyword"
	TransitionTypeKeywordGenerated TransitionType = "keyword_generated"
	TransitionTypeOther            TransitionType = "other"
)

TransitionType as enums.

func (TransitionType) String

func (e TransitionType) String() string

func (TransitionType) Valid

func (e TransitionType) Valid() bool

type Viewport added in v0.9.1

type Viewport struct {
	X      float64 `json:"x"`      // X offset in CSS pixels.
	Y      float64 `json:"y"`      // Y offset in CSS pixels
	Width  float64 `json:"width"`  // Rectangle width in CSS pixels
	Height float64 `json:"height"` // Rectangle height in CSS pixels
	Scale  float64 `json:"scale"`  // Page scale factor.
}

Viewport Viewport for capturing screenshot.

type VisualViewport

type VisualViewport struct {
	OffsetX      float64 `json:"offsetX"`      // Horizontal offset relative to the layout viewport (CSS pixels).
	OffsetY      float64 `json:"offsetY"`      // Vertical offset relative to the layout viewport (CSS pixels).
	PageX        float64 `json:"pageX"`        // Horizontal offset relative to the document (CSS pixels).
	PageY        float64 `json:"pageY"`        // Vertical offset relative to the document (CSS pixels).
	ClientWidth  float64 `json:"clientWidth"`  // Width (CSS pixels), excludes scrollbar if present.
	ClientHeight float64 `json:"clientHeight"` // Height (CSS pixels), excludes scrollbar if present.
	Scale        float64 `json:"scale"`        // Scale relative to the ideal viewport (size at width=device-width).
}

VisualViewport Visual viewport position, dimensions, and scale.

type WindowOpenClient added in v0.14.1

type WindowOpenClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*WindowOpenReply, error)
	rpcc.Stream
}

WindowOpenClient is a client for WindowOpen events. Fired when a new window is going to be opened, via window.open(), link click, form submission, etc.

type WindowOpenReply added in v0.14.1

type WindowOpenReply struct {
	URL            string   `json:"url"`            // The URL for the new window.
	WindowName     string   `json:"windowName"`     // Window name.
	WindowFeatures []string `json:"windowFeatures"` // An array of enabled window features.
	UserGesture    bool     `json:"userGesture"`    // Whether or not it was triggered by user gesture.
}

WindowOpenReply is the reply for WindowOpen events.

Jump to

Keyboard shortcuts

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