Documentation ¶
Overview ¶
Package cdp provides type-safe bindings for the Chrome Debugging Protocol (CDP) and can be used with any debug target that implements it.
The cdp Client requires an rpcc connection (*rpcc.Conn):
ctx, cancel := context.WithCancel(context.TODO()) defer cancel() conn, err := rpcc.DialContext(ctx, "ws://127.0.0.1:9222/f39a3624-e972-4a77-8a5f-6f8c42ef5129") if err != nil { // Handle error. } defer conn.Close() c := cdp.NewClient(conn) // ...
The devtool package can be used for finding the websocket URL (see devtool documentation for more):
devt := devtool.New("http://127.0.0.1:9222") pg, err := devtool.Get(ctx, devtool.Page) if err != nil { // Handle error. } conn, err := rpcc.Dial(pg.WebSocketDebuggerURL) // ...
Domain methods ¶
Domain methods are used to perform actions or request data over the Chrome Debugging Protocol.
Methods can be invoked from the Client:
c := cdp.NewClient(conn) nav, err := c.Page.Navigate(ctx, page.NewNavigateArgs("https://www.google.com")) if err != nil { // Handle error. } // ...
Domain events ¶
Event clients are used to handle events sent over the protocol. A client will buffer all events, preserving order, after creation until it is closed, context done or connection closed. Under the hood, an event client is a rpcc.Stream.
Create an event client for the DOMContentEventFired event. Call Close when the client is no longer used to avoid leaking memory. The client will remain active for the duration of the context or until it is closed:
// DOMContentEventFired = DOMContentLoaded. domContentEventFired, err := c.Page.DOMContentEventFired(ctx) if err != nil { // Handle error. } defer domContentEventFired.Close() // ...
Enable (if available) must be called before events are transmitted over the Chrome Debugging Protocol:
err := c.Page.Enable(ctx) if err != nil { // Handle error. } // ...
Calling Enable can result in immediate event transmissions. If these events are important, an event client should be created before calling Enable.
Wait for an event by calling Recv:
ev, err := domContentEventFired.Recv() if err != nil { // Handle error. } // ...
The Ready channel can be used to check for pending events or coordinating between multiple event handlers:
go func() { select { case <-domContentEventFired.Ready(): _, err := domContentEventFired.Recv() // Does not block here. if err != nil { // Handle error. } case <-loadEventFired.Ready(): // Handle loadEventFired. } }() // ...
Ready must not be called concurrently while relying on the non-blocking behavior of Recv.
Event clients can be synchronized, relative to each other, when the order of events is important:
err := cdp.Sync(domContentEventFired, loadEventFired) if err != nil { // Handle error. }
Use the Ready channel to detect which synchronized event client is ready to Recv.
The session package can be used to control multiple targets (e.g. pages) with a single websocket connection.
c := cdp.NewClient(conn) // conn created via rpcc.Dial. m, err := session.NewManager(c) if err != nil { // Handle error. } defer m.Close() newPage, err := c.Target.CreateTarget(context.TODO(), target.NewCreateTargetArgs("about:blank")) if err != nil { // Handle error. } // newPageConn uses the underlying conn without establishing a new // websocket connection. newPageConn, err := m.Dial(context.TODO(), newPage.TargetID) if err != nil { // Handle error. } defer newPageConn.Close() newPageClient := cdp.NewClient(newPageConn) // ...
Example ¶
package main import ( "context" "fmt" "io/ioutil" "log" "time" "github.com/mafredri/cdp" "github.com/mafredri/cdp/devtool" "github.com/mafredri/cdp/protocol/dom" "github.com/mafredri/cdp/protocol/page" "github.com/mafredri/cdp/rpcc" ) func main() { err := run(5 * time.Second) if err != nil { log.Fatal(err) } } func run(timeout time.Duration) error { ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() // Use the DevTools HTTP/JSON API to manage targets (e.g. pages, webworkers). devt := devtool.New("http://127.0.0.1:9222") pt, err := devt.Get(ctx, devtool.Page) if err != nil { pt, err = devt.Create(ctx) if err != nil { return err } } // Initiate a new RPC connection to the Chrome Debugging Protocol target. conn, err := rpcc.DialContext(ctx, pt.WebSocketDebuggerURL) if err != nil { return err } defer conn.Close() // Leaving connections open will leak memory. c := cdp.NewClient(conn) // Open a DOMContentEventFired client to buffer this event. domContent, err := c.Page.DOMContentEventFired(ctx) if err != nil { return err } defer domContent.Close() // Enable events on the Page domain, it's often preferrable to create // event clients before enabling events so that we don't miss any. if err = c.Page.Enable(ctx); err != nil { return err } // Create the Navigate arguments with the optional Referrer field set. navArgs := page.NewNavigateArgs("https://www.google.com"). SetReferrer("https://duckduckgo.com") nav, err := c.Page.Navigate(ctx, navArgs) if err != nil { return err } // Wait until we have a DOMContentEventFired event. if _, err = domContent.Recv(); err != nil { return err } fmt.Printf("Page loaded with frame ID: %s\n", nav.FrameID) // Fetch the document root node. We can pass nil here // since this method only takes optional arguments. doc, err := c.DOM.GetDocument(ctx, nil) if err != nil { return err } // Get the outer HTML for the page. result, err := c.DOM.GetOuterHTML(ctx, &dom.GetOuterHTMLArgs{ NodeID: &doc.Root.NodeID, }) if err != nil { return err } fmt.Printf("HTML: %s\n", result.OuterHTML) // Capture a screenshot of the current page. screenshotName := "screenshot.jpg" screenshotArgs := page.NewCaptureScreenshotArgs(). SetFormat("jpeg"). SetQuality(80) screenshot, err := c.Page.CaptureScreenshot(ctx, screenshotArgs) if err != nil { return err } if err = ioutil.WriteFile(screenshotName, screenshot.Data, 0644); err != nil { return err } fmt.Printf("Saved screenshot: %s\n", screenshotName) return nil }
Output:
Example (Advanced) ¶
package main import ( "context" "encoding/json" "errors" "fmt" "time" "github.com/mafredri/cdp" "github.com/mafredri/cdp/devtool" "github.com/mafredri/cdp/protocol/dom" "github.com/mafredri/cdp/protocol/network" "github.com/mafredri/cdp/protocol/page" "github.com/mafredri/cdp/protocol/runtime" "github.com/mafredri/cdp/rpcc" "golang.org/x/sync/errgroup" ) // Cookie represents a browser cookie. type Cookie struct { URL string `json:"url"` Name string `json:"name"` Value string `json:"value"` } // DocumentInfo contains information about the document. type DocumentInfo struct { Title string `json:"title"` } var ( MyURL = "https://google.com" Cookies = []Cookie{ {MyURL, "myauth", "myvalue"}, {MyURL, "mysetting1", "myvalue1"}, {MyURL, "mysetting2", "myvalue2"}, {MyURL, "mysetting3", "myvalue3"}, } ) func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() devt := devtool.New("http://localhost:9222") pt, err := devt.Get(ctx, devtool.Page) if err != nil { return } // Connect to WebSocket URL (page) that speaks the Chrome Debugging Protocol. conn, err := rpcc.DialContext(ctx, pt.WebSocketDebuggerURL) if err != nil { fmt.Println(err) return } defer conn.Close() // Cleanup. // Create a new CDP Client that uses conn. c := cdp.NewClient(conn) // Give enough capacity to avoid blocking any event listeners abort := make(chan error, 2) // Watch the abort channel. go func() { select { case <-ctx.Done(): case err := <-abort: fmt.Printf("aborted: %s\n", err.Error()) cancel() } }() // Setup event handlers early because domain events can be sent as // soon as Enable is called on the domain. if err = abortOnErrors(ctx, c, abort); err != nil { fmt.Println(err) return } if err = runBatch( // Enable all the domain events that we're interested in. func() error { return c.DOM.Enable(ctx) }, func() error { return c.Network.Enable(ctx, nil) }, func() error { return c.Page.Enable(ctx) }, func() error { return c.Runtime.Enable(ctx) }, func() error { return setCookies(ctx, c.Network, Cookies...) }, ); err != nil { fmt.Println(err) return } domLoadTimeout := 5 * time.Second err = navigate(ctx, c.Page, MyURL, domLoadTimeout) if err != nil { fmt.Println(err) return } fmt.Printf("Navigated to: %s\n", MyURL) // Parse information from the document by evaluating JavaScript. expression := ` new Promise((resolve, reject) => { setTimeout(() => { const title = document.querySelector('title').innerText; resolve({title}); }, 500); }); ` evalArgs := runtime.NewEvaluateArgs(expression).SetAwaitPromise(true).SetReturnByValue(true) eval, err := c.Runtime.Evaluate(ctx, evalArgs) if err != nil { fmt.Println(err) return } var info DocumentInfo if err = json.Unmarshal(eval.Result.Value, &info); err != nil { fmt.Println(err) return } fmt.Printf("Document title: %q\n", info.Title) // Fetch the document root node. doc, err := c.DOM.GetDocument(ctx, nil) if err != nil { fmt.Println(err) return } // Fetch all <script> and <noscript> elements so we can delete them. scriptIDs, err := c.DOM.QuerySelectorAll(ctx, dom.NewQuerySelectorAllArgs(doc.Root.NodeID, "script, noscript")) if err != nil { fmt.Println(err) return } if err = removeNodes(ctx, c.DOM, scriptIDs.NodeIDs...); err != nil { fmt.Println(err) return } } func abortOnErrors(ctx context.Context, c *cdp.Client, abort chan<- error) error { exceptionThrown, err := c.Runtime.ExceptionThrown(ctx) if err != nil { return err } loadingFailed, err := c.Network.LoadingFailed(ctx) if err != nil { return err } go func() { defer exceptionThrown.Close() // Cleanup. defer loadingFailed.Close() for { select { // Check for exceptions so we can abort as soon // as one is encountered. case <-exceptionThrown.Ready(): ev, err := exceptionThrown.Recv() if err != nil { // This could be any one of: stream closed, // connection closed, context deadline or // unmarshal failed. abort <- err return } // Ruh-roh! Let the caller know something went wrong. abort <- ev.ExceptionDetails // Check for non-canceled resources that failed // to load. case <-loadingFailed.Ready(): ev, err := loadingFailed.Recv() if err != nil { abort <- err return } // For now, most optional fields are pointers // and must be checked for nil. canceled := ev.Canceled != nil && *ev.Canceled if !canceled { abort <- fmt.Errorf("request %s failed: %s", ev.RequestID, ev.ErrorText) } } } }() return nil } // setCookies sets all the provided cookies. func setCookies(ctx context.Context, net cdp.Network, cookies ...Cookie) error { var cmds []runBatchFunc for _, c := range cookies { args := network.NewSetCookieArgs(c.Name, c.Value).SetURL(c.URL) cmds = append(cmds, func() error { reply, err := net.SetCookie(ctx, args) if err != nil { return err } if !reply.Success { return errors.New("could not set cookie") } return nil }) } return runBatch(cmds...) } // navigate to the URL and wait for DOMContentEventFired. An error is // returned if timeout happens before DOMContentEventFired. func navigate(ctx context.Context, pageClient cdp.Page, url string, timeout time.Duration) error { var cancel context.CancelFunc ctx, cancel = context.WithTimeout(ctx, timeout) defer cancel() // Make sure Page events are enabled. err := pageClient.Enable(ctx) if err != nil { return err } // Open client for DOMContentEventFired to block until DOM has fully loaded. domContentEventFired, err := pageClient.DOMContentEventFired(ctx) if err != nil { return err } defer domContentEventFired.Close() _, err = pageClient.Navigate(ctx, page.NewNavigateArgs(url)) if err != nil { return err } _, err = domContentEventFired.Recv() return err } // removeNodes deletes all provided nodeIDs from the DOM. func removeNodes(ctx context.Context, domClient cdp.DOM, nodes ...dom.NodeID) error { var rmNodes []runBatchFunc for _, id := range nodes { arg := dom.NewRemoveNodeArgs(id) rmNodes = append(rmNodes, func() error { return domClient.RemoveNode(ctx, arg) }) } return runBatch(rmNodes...) } // runBatchFunc is the function signature for runBatch. type runBatchFunc func() error // runBatch runs all functions simultaneously and waits until // execution has completed or an error is encountered. func runBatch(fn ...runBatchFunc) error { eg := errgroup.Group{} for _, f := range fn { eg.Go(f) } return eg.Wait() }
Output:
Example (Logging) ¶
package main import ( "bytes" "context" "encoding/json" "fmt" "io" "github.com/mafredri/cdp" "github.com/mafredri/cdp/rpcc" ) // LogCodec captures the output from writing RPC requests and reading // responses on the connection. It implements rpcc.Codec via // WriteRequest and ReadResponse. type LogCodec struct{ conn io.ReadWriter } // WriteRequest marshals v into a buffer, writes its contents onto the // connection and logs it. func (c *LogCodec) WriteRequest(req *rpcc.Request) error { var buf bytes.Buffer if err := json.NewEncoder(&buf).Encode(req); err != nil { return err } fmt.Printf("SEND: %s", buf.Bytes()) _, err := c.conn.Write(buf.Bytes()) if err != nil { return err } return nil } // ReadResponse unmarshals from the connection into v whilst echoing // what is read into a buffer for logging. func (c *LogCodec) ReadResponse(resp *rpcc.Response) error { var buf bytes.Buffer if err := json.NewDecoder(io.TeeReader(c.conn, &buf)).Decode(resp); err != nil { return err } fmt.Printf("RECV: %s\n", buf.String()) return nil } func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() newLogCodec := func(conn io.ReadWriter) rpcc.Codec { return &LogCodec{conn: conn} } conn, err := rpcc.Dial("ws://"+TestSockSrv+"/example_logging", rpcc.WithCodec(newLogCodec)) if err != nil { fmt.Println(err) } defer conn.Close() c := cdp.NewClient(conn) if err = c.Network.Enable(ctx, nil); err != nil { fmt.Println(err) } }
Output: SEND: {"id":1,"method":"Network.enable"} RECV: {"id":1,"result":{}}
Index ¶
- func ErrorCause(err error) error
- func Sync(c ...eventClient) error
- type Accessibility
- type Animation
- type ApplicationCache
- type Audits
- type Browser
- type CSS
- type CacheStorage
- type Client
- type Consoledeprecated
- type DOM
- type DOMDebugger
- type DOMSnapshot
- type DOMStorage
- type Database
- type Debugger
- type DeviceOrientation
- type Emulation
- type HeadlessExperimental
- type HeapProfiler
- type IO
- type IndexedDB
- type Input
- type Inspector
- type LayerTree
- type Log
- type Memory
- type Network
- type Overlay
- type Page
- type Performance
- type Profiler
- type Runtime
- type Schemadeprecated
- type Security
- type ServiceWorker
- type Storage
- type SystemInfo
- type Target
- type Tethering
- type Tracing
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorCause ¶
ErrorCause returns the underlying cause for this error, if possible. If err does not implement causer.Cause(), then err is returned.
func Sync ¶ added in v0.12.0
func Sync(c ...eventClient) error
Sync takes two or more event clients and sets them into synchronous operation, relative to each other. This operation cannot be undone. If an error is returned this function is no-op and the event clients will continue in asynchronous operation.
All event clients must belong to the same connection and they must not be closed. Passing multiple clients of the same event type to Sync is not supported and will return an error.
An event client that is closed is removed and has no further affect on the clients that were synchronized.
When two event clients, A and B, are in sync they will receive events in the order of arrival. If an event for both A and B is triggered, in that order, it will not be possible to receive the event from B before the event from A has been received.
Types ¶
type Accessibility ¶
type Accessibility interface { // Command GetPartialAXTree // // Fetches the accessibility node and partial accessibility tree for // this DOM node, if it exists. // // Note: This command is experimental. GetPartialAXTree(context.Context, *accessibility.GetPartialAXTreeArgs) (*accessibility.GetPartialAXTreeReply, error) }
The Accessibility domain.
Note: This domain is experimental.
type Animation ¶
type Animation interface { // Command Disable // // Disables animation domain notifications. Disable(context.Context) error // Command Enable // // Enables animation domain notifications. Enable(context.Context) error // Command GetCurrentTime // // Returns the current time of the an animation. GetCurrentTime(context.Context, *animation.GetCurrentTimeArgs) (*animation.GetCurrentTimeReply, error) // Command GetPlaybackRate // // Gets the playback rate of the document timeline. GetPlaybackRate(context.Context) (*animation.GetPlaybackRateReply, error) // Command ReleaseAnimations // // Releases a set of animations to no longer be manipulated. ReleaseAnimations(context.Context, *animation.ReleaseAnimationsArgs) error // Command ResolveAnimation // // Gets the remote object of the Animation. ResolveAnimation(context.Context, *animation.ResolveAnimationArgs) (*animation.ResolveAnimationReply, error) // Command SeekAnimations // // Seek a set of animations to a particular time within each // animation. SeekAnimations(context.Context, *animation.SeekAnimationsArgs) error // Command SetPaused // // Sets the paused state of a set of animations. SetPaused(context.Context, *animation.SetPausedArgs) error // Command SetPlaybackRate // // Sets the playback rate of the document timeline. SetPlaybackRate(context.Context, *animation.SetPlaybackRateArgs) error // Command SetTiming // // Sets the timing of an animation node. SetTiming(context.Context, *animation.SetTimingArgs) error // Event AnimationCanceled // // Event for when an animation has been canceled. AnimationCanceled(context.Context) (animation.CanceledClient, error) // Event AnimationCreated // // Event for each animation that has been created. AnimationCreated(context.Context) (animation.CreatedClient, error) // Event AnimationStarted // // Event for animation that has been started. AnimationStarted(context.Context) (animation.StartedClient, error) }
The Animation domain.
Note: This domain is experimental.
type ApplicationCache ¶
type ApplicationCache interface { // Command Enable // // Enables application cache domain notifications. Enable(context.Context) error // Command GetApplicationCacheForFrame // // Returns relevant application cache data for the document in given // frame. GetApplicationCacheForFrame(context.Context, *applicationcache.GetApplicationCacheForFrameArgs) (*applicationcache.GetApplicationCacheForFrameReply, error) // Command GetFramesWithManifests // // Returns array of frame identifiers with manifest urls for each // frame containing a document associated with some application cache. GetFramesWithManifests(context.Context) (*applicationcache.GetFramesWithManifestsReply, error) // Command GetManifestForFrame // // Returns manifest URL for document in the given frame. GetManifestForFrame(context.Context, *applicationcache.GetManifestForFrameArgs) (*applicationcache.GetManifestForFrameReply, error) // Event ApplicationCacheStatusUpdated ApplicationCacheStatusUpdated(context.Context) (applicationcache.StatusUpdatedClient, error) // Event NetworkStateUpdated NetworkStateUpdated(context.Context) (applicationcache.NetworkStateUpdatedClient, error) }
The ApplicationCache domain.
Note: This domain is experimental.
type Audits ¶ added in v0.11.4
type Audits interface { // Command GetEncodedResponse // // Returns the response body and size if it were re-encoded with the // specified settings. Only applies to images. GetEncodedResponse(context.Context, *audits.GetEncodedResponseArgs) (*audits.GetEncodedResponseReply, error) }
The Audits domain. Audits domain allows investigation of page violations and possible improvements.
Note: This domain is experimental.
type Browser ¶
type Browser interface { // Command Close // // Close browser gracefully. Close(context.Context) error // Command GetVersion // // Returns version information. GetVersion(context.Context) (*browser.GetVersionReply, error) // Command GetBrowserCommandLine // // Returns the command line switches for the browser process if, and // only if --enable-automation is on the commandline. // // Note: This command is experimental. GetBrowserCommandLine(context.Context) (*browser.GetBrowserCommandLineReply, error) // Command GetHistograms // // Get Chrome histograms. // // Note: This command is experimental. GetHistograms(context.Context, *browser.GetHistogramsArgs) (*browser.GetHistogramsReply, error) // Command GetHistogram // // Get a Chrome histogram by name. // // Note: This command is experimental. GetHistogram(context.Context, *browser.GetHistogramArgs) (*browser.GetHistogramReply, error) // Command GetWindowBounds // // Get position and size of the browser window. // // Note: This command is experimental. GetWindowBounds(context.Context, *browser.GetWindowBoundsArgs) (*browser.GetWindowBoundsReply, error) // Command GetWindowForTarget // // Get the browser window that contains the devtools target. // // Note: This command is experimental. GetWindowForTarget(context.Context, *browser.GetWindowForTargetArgs) (*browser.GetWindowForTargetReply, error) // Command SetWindowBounds // // Set position and/or size of the browser window. // // Note: This command is experimental. SetWindowBounds(context.Context, *browser.SetWindowBoundsArgs) error }
The Browser domain. The Browser domain defines methods and events for browser managing.
type CSS ¶
type CSS interface { // Command AddRule // // Inserts a new rule with the given `ruleText` in a stylesheet with // given `styleSheetId`, at the position specified by `location`. AddRule(context.Context, *css.AddRuleArgs) (*css.AddRuleReply, error) // Command CollectClassNames // // Returns all class names from specified stylesheet. CollectClassNames(context.Context, *css.CollectClassNamesArgs) (*css.CollectClassNamesReply, error) // Command CreateStyleSheet // // Creates a new special "via-inspector" stylesheet in the frame with // given `frameId`. CreateStyleSheet(context.Context, *css.CreateStyleSheetArgs) (*css.CreateStyleSheetReply, error) // Command Disable // // Disables the CSS agent for the given page. Disable(context.Context) error // Command Enable // // Enables the CSS agent for the given page. Clients should not assume // that the CSS agent has been enabled until the result of this command // is received. Enable(context.Context) error // Command ForcePseudoState // // Ensures that the given node will have specified pseudo-classes // whenever its style is computed by the browser. ForcePseudoState(context.Context, *css.ForcePseudoStateArgs) error // Command GetBackgroundColors GetBackgroundColors(context.Context, *css.GetBackgroundColorsArgs) (*css.GetBackgroundColorsReply, error) // Command GetComputedStyleForNode // // Returns the computed style for a DOM node identified by `nodeId`. GetComputedStyleForNode(context.Context, *css.GetComputedStyleForNodeArgs) (*css.GetComputedStyleForNodeReply, error) // Command GetInlineStylesForNode // // Returns the styles defined inline (explicitly in the "style" // attribute and implicitly, using DOM attributes) for a DOM node // identified by `nodeId`. GetInlineStylesForNode(context.Context, *css.GetInlineStylesForNodeArgs) (*css.GetInlineStylesForNodeReply, error) // Command GetMatchedStylesForNode // // Returns requested styles for a DOM node identified by `nodeId`. GetMatchedStylesForNode(context.Context, *css.GetMatchedStylesForNodeArgs) (*css.GetMatchedStylesForNodeReply, error) // Command GetMediaQueries // // Returns all media queries parsed by the rendering engine. GetMediaQueries(context.Context) (*css.GetMediaQueriesReply, error) // Command GetPlatformFontsForNode // // Requests information about platform fonts which we used to render // child TextNodes in the given node. GetPlatformFontsForNode(context.Context, *css.GetPlatformFontsForNodeArgs) (*css.GetPlatformFontsForNodeReply, error) // Command GetStyleSheetText // // Returns the current textual content for a stylesheet. GetStyleSheetText(context.Context, *css.GetStyleSheetTextArgs) (*css.GetStyleSheetTextReply, error) // Command SetEffectivePropertyValueForNode // // Find a rule with the given active property for the given node and // set the new value for this property SetEffectivePropertyValueForNode(context.Context, *css.SetEffectivePropertyValueForNodeArgs) error // Command SetKeyframeKey // // Modifies the keyframe rule key text. SetKeyframeKey(context.Context, *css.SetKeyframeKeyArgs) (*css.SetKeyframeKeyReply, error) // Command SetMediaText // // Modifies the rule selector. SetMediaText(context.Context, *css.SetMediaTextArgs) (*css.SetMediaTextReply, error) // Command SetRuleSelector // // Modifies the rule selector. SetRuleSelector(context.Context, *css.SetRuleSelectorArgs) (*css.SetRuleSelectorReply, error) // Command SetStyleSheetText // // Sets the new stylesheet text. SetStyleSheetText(context.Context, *css.SetStyleSheetTextArgs) (*css.SetStyleSheetTextReply, error) // Command SetStyleTexts // // Applies specified style edits one after another in the given order. SetStyleTexts(context.Context, *css.SetStyleTextsArgs) (*css.SetStyleTextsReply, error) // Command StartRuleUsageTracking // // Enables the selector recording. StartRuleUsageTracking(context.Context) error // Command StopRuleUsageTracking // // Stop tracking rule usage and return the list of rules that were // used since last call to `takeCoverageDelta` (or since start of // coverage instrumentation) StopRuleUsageTracking(context.Context) (*css.StopRuleUsageTrackingReply, error) // Command TakeCoverageDelta // // Obtain list of rules that became used since last call to this // method (or since start of coverage instrumentation) TakeCoverageDelta(context.Context) (*css.TakeCoverageDeltaReply, error) // Event FontsUpdated // // Fires whenever a web font is updated. A non-empty font parameter // indicates a successfully loaded web font FontsUpdated(context.Context) (css.FontsUpdatedClient, error) // Event MediaQueryResultChanged // // Fires whenever a MediaQuery result changes (for example, after a // browser window has been resized.) The current implementation // considers only viewport-dependent media features. MediaQueryResultChanged(context.Context) (css.MediaQueryResultChangedClient, error) // Event StyleSheetAdded // // Fired whenever an active document stylesheet is added. StyleSheetAdded(context.Context) (css.StyleSheetAddedClient, error) // Event StyleSheetChanged // // Fired whenever a stylesheet is changed as a result of the client // operation. StyleSheetChanged(context.Context) (css.StyleSheetChangedClient, error) // Event StyleSheetRemoved // // Fired whenever an active document stylesheet is removed. StyleSheetRemoved(context.Context) (css.StyleSheetRemovedClient, error) }
The CSS domain. This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) have an associated `id` used in subsequent operations on the related object. Each object type has a specific `id` structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the `get*ForNode()` calls (which accept a DOM node id). A client can also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and subsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods.
Note: This domain is experimental.
type CacheStorage ¶
type CacheStorage interface { // Command DeleteCache // // Deletes a cache. DeleteCache(context.Context, *cachestorage.DeleteCacheArgs) error // Command DeleteEntry // // Deletes a cache entry. DeleteEntry(context.Context, *cachestorage.DeleteEntryArgs) error // Command RequestCacheNames // // Requests cache names. RequestCacheNames(context.Context, *cachestorage.RequestCacheNamesArgs) (*cachestorage.RequestCacheNamesReply, error) // Command RequestCachedResponse // // Fetches cache entry. RequestCachedResponse(context.Context, *cachestorage.RequestCachedResponseArgs) (*cachestorage.RequestCachedResponseReply, error) // Command RequestEntries // // Requests data from cache. RequestEntries(context.Context, *cachestorage.RequestEntriesArgs) (*cachestorage.RequestEntriesReply, error) }
The CacheStorage domain.
Note: This domain is experimental.
type Client ¶
type Client struct { Accessibility Accessibility Animation Animation ApplicationCache ApplicationCache Audits Audits Browser Browser CSS CSS CacheStorage CacheStorage Console Console DOM DOM DOMDebugger DOMDebugger DOMSnapshot DOMSnapshot DOMStorage DOMStorage Database Database Debugger Debugger DeviceOrientation DeviceOrientation Emulation Emulation HeadlessExperimental HeadlessExperimental HeapProfiler HeapProfiler IO IO IndexedDB IndexedDB Input Input Inspector Inspector LayerTree LayerTree Log Log Memory Memory Network Network Overlay Overlay Page Page Performance Performance Profiler Profiler Runtime Runtime Schema Schema Security Security ServiceWorker ServiceWorker Storage Storage SystemInfo SystemInfo Target Target Tethering Tethering Tracing Tracing }
Client represents a Chrome Debugging Protocol client that can be used to invoke methods or listen to events in every CDP domain. The Client consumes a rpcc connection, used to invoke the methods.
type Console
deprecated
type Console interface { // Command ClearMessages // // Does nothing. ClearMessages(context.Context) error // Command Disable // // Disables console domain, prevents further console messages from // being reported to the client. Disable(context.Context) error // Command Enable // // Enables console domain, sends the messages collected so far to the // client by means of the `messageAdded` notification. Enable(context.Context) error // Event MessageAdded // // Issued when new console message is added. MessageAdded(context.Context) (console.MessageAddedClient, error) }
The Console domain.
Deprecated: This domain is deprecated - use Runtime or Log instead.
type DOM ¶
type DOM interface { // Command CollectClassNamesFromSubtree // // Collects class names for the node with given id and all of it's // child nodes. // // Note: This command is experimental. CollectClassNamesFromSubtree(context.Context, *dom.CollectClassNamesFromSubtreeArgs) (*dom.CollectClassNamesFromSubtreeReply, error) // Command CopyTo // // Creates a deep copy of the specified node and places it into the // target container before the given anchor. // // Note: This command is experimental. CopyTo(context.Context, *dom.CopyToArgs) (*dom.CopyToReply, error) // Command DescribeNode // // Describes node given its id, does not require domain to be enabled. // Does not start tracking any objects, can be used for automation. DescribeNode(context.Context, *dom.DescribeNodeArgs) (*dom.DescribeNodeReply, error) // Command Disable // // Disables DOM agent for the given page. Disable(context.Context) error // Command DiscardSearchResults // // Discards search results from the session with the given id. // `getSearchResults` should no longer be called for that search. // // Note: This command is experimental. DiscardSearchResults(context.Context, *dom.DiscardSearchResultsArgs) error // Command Enable // // Enables DOM agent for the given page. Enable(context.Context) error // Command Focus // // Focuses the given element. Focus(context.Context, *dom.FocusArgs) error // Command GetAttributes // // Returns attributes for the specified node. GetAttributes(context.Context, *dom.GetAttributesArgs) (*dom.GetAttributesReply, error) // Command GetBoxModel // // Returns boxes for the given node. GetBoxModel(context.Context, *dom.GetBoxModelArgs) (*dom.GetBoxModelReply, error) // Command GetContentQuads // // Returns quads that describe node position on the page. This method // might return multiple quads for inline nodes. // // Note: This command is experimental. GetContentQuads(context.Context, *dom.GetContentQuadsArgs) (*dom.GetContentQuadsReply, error) // Command GetDocument // // Returns the root DOM node (and optionally the subtree) to the // caller. GetDocument(context.Context, *dom.GetDocumentArgs) (*dom.GetDocumentReply, error) // Command GetFlattenedDocument // // Returns the root DOM node (and optionally the subtree) to the // caller. GetFlattenedDocument(context.Context, *dom.GetFlattenedDocumentArgs) (*dom.GetFlattenedDocumentReply, error) // Command GetNodeForLocation // // Returns node id at given location. // // Note: This command is experimental. GetNodeForLocation(context.Context, *dom.GetNodeForLocationArgs) (*dom.GetNodeForLocationReply, error) // Command GetOuterHTML // // Returns node's HTML markup. GetOuterHTML(context.Context, *dom.GetOuterHTMLArgs) (*dom.GetOuterHTMLReply, error) // Command GetRelayoutBoundary // // Returns the id of the nearest ancestor that is a relayout boundary. // // Note: This command is experimental. GetRelayoutBoundary(context.Context, *dom.GetRelayoutBoundaryArgs) (*dom.GetRelayoutBoundaryReply, error) // Command GetSearchResults // // Returns search results from given `fromIndex` to given `toIndex` // from the search with the given identifier. // // Note: This command is experimental. GetSearchResults(context.Context, *dom.GetSearchResultsArgs) (*dom.GetSearchResultsReply, error) // Command MarkUndoableState // // Marks last undoable state. // // Note: This command is experimental. MarkUndoableState(context.Context) error // Command MoveTo // // Moves node into the new container, places it before the given // anchor. MoveTo(context.Context, *dom.MoveToArgs) (*dom.MoveToReply, error) // Command PerformSearch // // Searches for a given string in the DOM tree. Use `getSearchResults` // to access search results or `cancelSearch` to end this search // session. // // Note: This command is experimental. PerformSearch(context.Context, *dom.PerformSearchArgs) (*dom.PerformSearchReply, error) // Command PushNodeByPathToFrontend // // Requests that the node is sent to the caller given its path. // // FIXME, use XPath // // Note: This command is experimental. PushNodeByPathToFrontend(context.Context, *dom.PushNodeByPathToFrontendArgs) (*dom.PushNodeByPathToFrontendReply, error) // Command PushNodesByBackendIdsToFrontend // // Requests that a batch of nodes is sent to the caller given their // backend node ids. // // Note: This command is experimental. PushNodesByBackendIdsToFrontend(context.Context, *dom.PushNodesByBackendIdsToFrontendArgs) (*dom.PushNodesByBackendIdsToFrontendReply, error) // Command QuerySelector // // Executes `querySelector` on a given node. QuerySelector(context.Context, *dom.QuerySelectorArgs) (*dom.QuerySelectorReply, error) // Command QuerySelectorAll // // Executes `querySelectorAll` on a given node. QuerySelectorAll(context.Context, *dom.QuerySelectorAllArgs) (*dom.QuerySelectorAllReply, error) // Command Redo // // Re-does the last undone action. // // Note: This command is experimental. Redo(context.Context) error // Command RemoveAttribute // // Removes attribute with given name from an element with given id. RemoveAttribute(context.Context, *dom.RemoveAttributeArgs) error // Command RemoveNode // // Removes node with given id. RemoveNode(context.Context, *dom.RemoveNodeArgs) error // Command RequestChildNodes // // Requests that children of the node with given id are returned to // the caller in form of `setChildNodes` events where not only // immediate children are retrieved, but all children down to the // specified depth. RequestChildNodes(context.Context, *dom.RequestChildNodesArgs) error // Command RequestNode // // Requests that the node is sent to the caller given the JavaScript // node object reference. All nodes that form the path from the node to // the root are also sent to the client as a series of `setChildNodes` // notifications. RequestNode(context.Context, *dom.RequestNodeArgs) (*dom.RequestNodeReply, error) // Command ResolveNode // // Resolves the JavaScript node object for a given NodeId or // BackendNodeId. ResolveNode(context.Context, *dom.ResolveNodeArgs) (*dom.ResolveNodeReply, error) // Command SetAttributeValue // // Sets attribute for an element with given id. SetAttributeValue(context.Context, *dom.SetAttributeValueArgs) error // Command SetAttributesAsText // // Sets attributes on element with given id. This method is useful // when user edits some existing attribute value and types in several // attribute name/value pairs. SetAttributesAsText(context.Context, *dom.SetAttributesAsTextArgs) error // Command SetFileInputFiles // // Sets files for the given file input element. SetFileInputFiles(context.Context, *dom.SetFileInputFilesArgs) error // Command SetInspectedNode // // Enables console to refer to the node with given id via $x (see // Command Line API for more details $x functions). // // Note: This command is experimental. SetInspectedNode(context.Context, *dom.SetInspectedNodeArgs) error // Command SetNodeName // // Sets node name for a node with given id. SetNodeName(context.Context, *dom.SetNodeNameArgs) (*dom.SetNodeNameReply, error) // Command SetNodeValue // // Sets node value for a node with given id. SetNodeValue(context.Context, *dom.SetNodeValueArgs) error // Command SetOuterHTML // // Sets node HTML markup, returns new node id. SetOuterHTML(context.Context, *dom.SetOuterHTMLArgs) error // Command Undo // // Undoes the last performed action. // // Note: This command is experimental. Undo(context.Context) error // Command GetFrameOwner // // Returns iframe node that owns iframe with the given domain. // // Note: This command is experimental. GetFrameOwner(context.Context, *dom.GetFrameOwnerArgs) (*dom.GetFrameOwnerReply, error) // Event AttributeModified // // Fired when `Element`'s attribute is modified. AttributeModified(context.Context) (dom.AttributeModifiedClient, error) // Event AttributeRemoved // // Fired when `Element`'s attribute is removed. AttributeRemoved(context.Context) (dom.AttributeRemovedClient, error) // Event CharacterDataModified // // Mirrors `DOMCharacterDataModified` event. CharacterDataModified(context.Context) (dom.CharacterDataModifiedClient, error) // Event ChildNodeCountUpdated // // Fired when `Container`'s child node count has changed. ChildNodeCountUpdated(context.Context) (dom.ChildNodeCountUpdatedClient, error) // Event ChildNodeInserted // // Mirrors `DOMNodeInserted` event. ChildNodeInserted(context.Context) (dom.ChildNodeInsertedClient, error) // Event ChildNodeRemoved // // Mirrors `DOMNodeRemoved` event. ChildNodeRemoved(context.Context) (dom.ChildNodeRemovedClient, error) // Event DistributedNodesUpdated // // Called when distribution is changed. // // Note: This event is experimental. DistributedNodesUpdated(context.Context) (dom.DistributedNodesUpdatedClient, error) // Event DocumentUpdated // // Fired when `Document` has been totally updated. Node ids are no // longer valid. DocumentUpdated(context.Context) (dom.DocumentUpdatedClient, error) // Event InlineStyleInvalidated // // Fired when `Element`'s inline style is modified via a CSS property // modification. // // Note: This event is experimental. InlineStyleInvalidated(context.Context) (dom.InlineStyleInvalidatedClient, error) // Event PseudoElementAdded // // Called when a pseudo element is added to an element. // // Note: This event is experimental. PseudoElementAdded(context.Context) (dom.PseudoElementAddedClient, error) // Event PseudoElementRemoved // // Called when a pseudo element is removed from an element. // // Note: This event is experimental. PseudoElementRemoved(context.Context) (dom.PseudoElementRemovedClient, error) // Event SetChildNodes // // Fired when backend wants to provide client with the missing DOM // structure. This happens upon most of the calls requesting node ids. SetChildNodes(context.Context) (dom.SetChildNodesClient, error) // Event ShadowRootPopped // // Called when shadow root is popped from the element. // // Note: This event is experimental. ShadowRootPopped(context.Context) (dom.ShadowRootPoppedClient, error) // Event ShadowRootPushed // // Called when shadow root is pushed into the element. // // Note: This event is experimental. ShadowRootPushed(context.Context) (dom.ShadowRootPushedClient, error) }
The DOM domain. This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an `id`. This `id` can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client.
Note that `iframe` owner elements will return corresponding document elements as their child nodes.
type DOMDebugger ¶
type DOMDebugger interface { // Command GetEventListeners // // Returns event listeners of the given object. GetEventListeners(context.Context, *domdebugger.GetEventListenersArgs) (*domdebugger.GetEventListenersReply, error) // Command RemoveDOMBreakpoint // // Removes DOM breakpoint that was set using `setDOMBreakpoint`. RemoveDOMBreakpoint(context.Context, *domdebugger.RemoveDOMBreakpointArgs) error // Command RemoveEventListenerBreakpoint // // Removes breakpoint on particular DOM event. RemoveEventListenerBreakpoint(context.Context, *domdebugger.RemoveEventListenerBreakpointArgs) error // Command RemoveInstrumentationBreakpoint // // Removes breakpoint on particular native event. // // Note: This command is experimental. RemoveInstrumentationBreakpoint(context.Context, *domdebugger.RemoveInstrumentationBreakpointArgs) error // Command RemoveXHRBreakpoint // // Removes breakpoint from XMLHttpRequest. RemoveXHRBreakpoint(context.Context, *domdebugger.RemoveXHRBreakpointArgs) error // Command SetDOMBreakpoint // // Sets breakpoint on particular operation with DOM. SetDOMBreakpoint(context.Context, *domdebugger.SetDOMBreakpointArgs) error // Command SetEventListenerBreakpoint // // Sets breakpoint on particular DOM event. SetEventListenerBreakpoint(context.Context, *domdebugger.SetEventListenerBreakpointArgs) error // Command SetInstrumentationBreakpoint // // Sets breakpoint on particular native event. // // Note: This command is experimental. SetInstrumentationBreakpoint(context.Context, *domdebugger.SetInstrumentationBreakpointArgs) error // Command SetXHRBreakpoint // // Sets breakpoint on XMLHttpRequest. SetXHRBreakpoint(context.Context, *domdebugger.SetXHRBreakpointArgs) error }
The DOMDebugger domain. DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript execution will stop on these operations as if there was a regular breakpoint set.
type DOMSnapshot ¶
type DOMSnapshot interface { // Command Disable // // Disables DOM snapshot agent for the given page. Disable(context.Context) error // Command Enable // // Enables DOM snapshot agent for the given page. Enable(context.Context) error // Command GetSnapshot // // Deprecated: Returns a document snapshot, including the full DOM // tree of the root node (including iframes, template contents, and // imported documents) in a flattened array, as well as layout and // white-listed computed style information for the nodes. Shadow DOM in // the returned DOM tree is flattened. GetSnapshot(context.Context, *domsnapshot.GetSnapshotArgs) (*domsnapshot.GetSnapshotReply, error) // Command CaptureSnapshot // // Returns a document snapshot, including the full DOM tree of the // root node (including iframes, template contents, and imported // documents) in a flattened array, as well as layout and white-listed // computed style information for the nodes. Shadow DOM in the returned // DOM tree is flattened. CaptureSnapshot(context.Context, *domsnapshot.CaptureSnapshotArgs) (*domsnapshot.CaptureSnapshotReply, error) }
The DOMSnapshot domain. This domain facilitates obtaining document snapshots with DOM, layout, and style information.
Note: This domain is experimental.
type DOMStorage ¶
type DOMStorage interface { // Command Clear Clear(context.Context, *domstorage.ClearArgs) error // Command Disable // // Disables storage tracking, prevents storage events from being sent // to the client. Disable(context.Context) error // Command Enable // // Enables storage tracking, storage events will now be delivered to // the client. Enable(context.Context) error // Command GetDOMStorageItems GetDOMStorageItems(context.Context, *domstorage.GetDOMStorageItemsArgs) (*domstorage.GetDOMStorageItemsReply, error) // Command RemoveDOMStorageItem RemoveDOMStorageItem(context.Context, *domstorage.RemoveDOMStorageItemArgs) error // Command SetDOMStorageItem SetDOMStorageItem(context.Context, *domstorage.SetDOMStorageItemArgs) error // Event DOMStorageItemAdded DOMStorageItemAdded(context.Context) (domstorage.ItemAddedClient, error) // Event DOMStorageItemRemoved DOMStorageItemRemoved(context.Context) (domstorage.ItemRemovedClient, error) // Event DOMStorageItemUpdated DOMStorageItemUpdated(context.Context) (domstorage.ItemUpdatedClient, error) // Event DOMStorageItemsCleared DOMStorageItemsCleared(context.Context) (domstorage.ItemsClearedClient, error) }
The DOMStorage domain. Query and modify DOM storage.
Note: This domain is experimental.
type Database ¶
type Database interface { // Command Disable // // Disables database tracking, prevents database events from being // sent to the client. Disable(context.Context) error // Command Enable // // Enables database tracking, database events will now be delivered to // the client. Enable(context.Context) error // Command ExecuteSQL ExecuteSQL(context.Context, *database.ExecuteSQLArgs) (*database.ExecuteSQLReply, error) // Command GetDatabaseTableNames GetDatabaseTableNames(context.Context, *database.GetDatabaseTableNamesArgs) (*database.GetDatabaseTableNamesReply, error) // Event AddDatabase AddDatabase(context.Context) (database.AddDatabaseClient, error) }
The Database domain.
Note: This domain is experimental.
type Debugger ¶
type Debugger interface { // Command ContinueToLocation // // Continues execution until specific location is reached. ContinueToLocation(context.Context, *debugger.ContinueToLocationArgs) error // Command Disable // // Disables debugger for given page. Disable(context.Context) error // Command Enable // // Enables debugger for the given page. Clients should not assume that // the debugging has been enabled until the result for this command is // received. Enable(context.Context) (*debugger.EnableReply, error) // Command EvaluateOnCallFrame // // Evaluates expression on a given call frame. EvaluateOnCallFrame(context.Context, *debugger.EvaluateOnCallFrameArgs) (*debugger.EvaluateOnCallFrameReply, error) // Command GetPossibleBreakpoints // // Returns possible locations for breakpoint. scriptId in start and // end range locations should be the same. GetPossibleBreakpoints(context.Context, *debugger.GetPossibleBreakpointsArgs) (*debugger.GetPossibleBreakpointsReply, error) // Command GetScriptSource // // Returns source for the script with given id. GetScriptSource(context.Context, *debugger.GetScriptSourceArgs) (*debugger.GetScriptSourceReply, error) // Command GetStackTrace // // Returns stack trace with given `stackTraceId`. // // Note: This command is experimental. GetStackTrace(context.Context, *debugger.GetStackTraceArgs) (*debugger.GetStackTraceReply, error) // Command Pause // // Stops on the next JavaScript statement. Pause(context.Context) error // Command PauseOnAsyncCall // // Note: This command is experimental. PauseOnAsyncCall(context.Context, *debugger.PauseOnAsyncCallArgs) error // Command RemoveBreakpoint // // Removes JavaScript breakpoint. RemoveBreakpoint(context.Context, *debugger.RemoveBreakpointArgs) error // Command RestartFrame // // Restarts particular call frame from the beginning. RestartFrame(context.Context, *debugger.RestartFrameArgs) (*debugger.RestartFrameReply, error) // Command Resume // // Resumes JavaScript execution. Resume(context.Context) error // Command ScheduleStepIntoAsync // // This method is deprecated - use Debugger.stepInto with // breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into // next scheduled async task if any is scheduled before next pause. // Returns success when async task is actually scheduled, returns error // if no task were scheduled or another scheduleStepIntoAsync was // called. // // Note: This command is experimental. ScheduleStepIntoAsync(context.Context) error // Command SearchInContent // // Searches for given string in script content. SearchInContent(context.Context, *debugger.SearchInContentArgs) (*debugger.SearchInContentReply, error) // Command SetAsyncCallStackDepth // // Enables or disables async call stacks tracking. SetAsyncCallStackDepth(context.Context, *debugger.SetAsyncCallStackDepthArgs) error // Command SetBlackboxPatterns // // Replace previous blackbox patterns with passed ones. Forces backend // to skip stepping/pausing in scripts with url matching one of the // patterns. VM will try to leave blackboxed script by performing 'step // in' several times, finally resorting to 'step out' if unsuccessful. // // Note: This command is experimental. SetBlackboxPatterns(context.Context, *debugger.SetBlackboxPatternsArgs) error // Command SetBlackboxedRanges // // Makes backend skip steps in the script in blackboxed ranges. VM // will try leave blacklisted scripts by performing 'step in' several // times, finally resorting to 'step out' if unsuccessful. Positions // array contains positions where blackbox state is changed. First // interval isn't blackboxed. Array should be sorted. // // Note: This command is experimental. SetBlackboxedRanges(context.Context, *debugger.SetBlackboxedRangesArgs) error // Command SetBreakpoint // // Sets JavaScript breakpoint at a given location. SetBreakpoint(context.Context, *debugger.SetBreakpointArgs) (*debugger.SetBreakpointReply, error) // Command SetBreakpointByURL // // Sets JavaScript breakpoint at given location specified either by // URL or URL regex. Once this command is issued, all existing parsed // scripts will have breakpoints resolved and returned in `locations` // property. Further matching script parsing will result in subsequent // `breakpointResolved` events issued. This logical breakpoint will // survive page reloads. SetBreakpointByURL(context.Context, *debugger.SetBreakpointByURLArgs) (*debugger.SetBreakpointByURLReply, error) // Command SetBreakpointOnFunctionCall // // Sets JavaScript breakpoint before each call to the given function. // If another function was created from the same source as a given one, // calling it will also trigger the breakpoint. // // Note: This command is experimental. SetBreakpointOnFunctionCall(context.Context, *debugger.SetBreakpointOnFunctionCallArgs) (*debugger.SetBreakpointOnFunctionCallReply, error) // Command SetBreakpointsActive // // Activates / deactivates all breakpoints on the page. SetBreakpointsActive(context.Context, *debugger.SetBreakpointsActiveArgs) error // Command SetPauseOnExceptions // // Defines pause on exceptions state. Can be set to stop on all // exceptions, uncaught exceptions or no exceptions. Initial pause on // exceptions state is `none`. SetPauseOnExceptions(context.Context, *debugger.SetPauseOnExceptionsArgs) error // Command SetReturnValue // // Changes return value in top frame. Available only at return break // position. // // Note: This command is experimental. SetReturnValue(context.Context, *debugger.SetReturnValueArgs) error // Command SetScriptSource // // Edits JavaScript source live. SetScriptSource(context.Context, *debugger.SetScriptSourceArgs) (*debugger.SetScriptSourceReply, error) // Command SetSkipAllPauses // // Makes page not interrupt on any pauses (breakpoint, exception, dom // exception etc). SetSkipAllPauses(context.Context, *debugger.SetSkipAllPausesArgs) error // Command SetVariableValue // // Changes value of variable in a callframe. Object-based scopes are // not supported and must be mutated manually. SetVariableValue(context.Context, *debugger.SetVariableValueArgs) error // Command StepInto // // Steps into the function call. StepInto(context.Context, *debugger.StepIntoArgs) error // Command StepOut // // Steps out of the function call. StepOut(context.Context) error // Command StepOver // // Steps over the statement. StepOver(context.Context) error // Event BreakpointResolved // // Fired when breakpoint is resolved to an actual script and location. BreakpointResolved(context.Context) (debugger.BreakpointResolvedClient, error) // Event Paused // // Fired when the virtual machine stopped on breakpoint or exception // or any other stop criteria. Paused(context.Context) (debugger.PausedClient, error) // Event Resumed // // Fired when the virtual machine resumed execution. Resumed(context.Context) (debugger.ResumedClient, error) // Event ScriptFailedToParse // // Fired when virtual machine fails to parse the script. ScriptFailedToParse(context.Context) (debugger.ScriptFailedToParseClient, error) // Event ScriptParsed // // Fired when virtual machine parses script. This event is also fired // for all known and uncollected scripts upon enabling debugger. ScriptParsed(context.Context) (debugger.ScriptParsedClient, error) }
The Debugger domain. Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
type DeviceOrientation ¶
type DeviceOrientation interface { // Command ClearDeviceOrientationOverride // // Clears the overridden Device Orientation. ClearDeviceOrientationOverride(context.Context) error // Command SetDeviceOrientationOverride // // Overrides the Device Orientation. SetDeviceOrientationOverride(context.Context, *deviceorientation.SetDeviceOrientationOverrideArgs) error }
The DeviceOrientation domain.
Note: This domain is experimental.
type Emulation ¶
type Emulation interface { // Command CanEmulate // // Tells whether emulation is supported. CanEmulate(context.Context) (*emulation.CanEmulateReply, error) // Command ClearDeviceMetricsOverride // // Clears the overridden device metrics. ClearDeviceMetricsOverride(context.Context) error // Command ClearGeolocationOverride // // Clears the overridden Geolocation Position and Error. ClearGeolocationOverride(context.Context) error // Command ResetPageScaleFactor // // Requests that page scale factor is reset to initial values. // // Note: This command is experimental. ResetPageScaleFactor(context.Context) error // Command SetCPUThrottlingRate // // Enables CPU throttling to emulate slow CPUs. // // Note: This command is experimental. SetCPUThrottlingRate(context.Context, *emulation.SetCPUThrottlingRateArgs) error // Command SetDefaultBackgroundColorOverride // // Sets or clears an override of the default background color of the // frame. This override is used if the content does not specify one. SetDefaultBackgroundColorOverride(context.Context, *emulation.SetDefaultBackgroundColorOverrideArgs) error // Command SetDeviceMetricsOverride // // Overrides the values of device screen dimensions // (window.screen.width, window.screen.height, window.innerWidth, // window.innerHeight, and "device-width"/"device-height"-related CSS // media query results). SetDeviceMetricsOverride(context.Context, *emulation.SetDeviceMetricsOverrideArgs) error // Command SetScrollbarsHidden // // Note: This command is experimental. SetScrollbarsHidden(context.Context, *emulation.SetScrollbarsHiddenArgs) error // Command SetDocumentCookieDisabled // // Note: This command is experimental. SetDocumentCookieDisabled(context.Context, *emulation.SetDocumentCookieDisabledArgs) error // Command SetEmitTouchEventsForMouse // // Note: This command is experimental. SetEmitTouchEventsForMouse(context.Context, *emulation.SetEmitTouchEventsForMouseArgs) error // Command SetEmulatedMedia // // Emulates the given media for CSS media queries. SetEmulatedMedia(context.Context, *emulation.SetEmulatedMediaArgs) error // Command SetGeolocationOverride // // Overrides the Geolocation Position or Error. Omitting any of the // parameters emulates position unavailable. SetGeolocationOverride(context.Context, *emulation.SetGeolocationOverrideArgs) error // // Deprecated: Overrides value returned by the javascript navigator // object. // // Note: This command is experimental. SetNavigatorOverrides(context.Context, *emulation.SetNavigatorOverridesArgs) error // Command SetPageScaleFactor // // Sets a specified page scale factor. // // Note: This command is experimental. SetPageScaleFactor(context.Context, *emulation.SetPageScaleFactorArgs) error // Command SetScriptExecutionDisabled // // Switches script execution in the page. SetScriptExecutionDisabled(context.Context, *emulation.SetScriptExecutionDisabledArgs) error // Command SetTouchEmulationEnabled // // Enables touch on platforms which do not support them. SetTouchEmulationEnabled(context.Context, *emulation.SetTouchEmulationEnabledArgs) error // Command SetVirtualTimePolicy // // Turns on virtual time for all frames (replacing real-time with a // synthetic time source) and sets the current virtual time policy. // Note this supersedes any previous time budget. // // Note: This command is experimental. SetVirtualTimePolicy(context.Context, *emulation.SetVirtualTimePolicyArgs) (*emulation.SetVirtualTimePolicyReply, error) // Command SetVisibleSize // // Deprecated: Resizes the frame/viewport of the page. Note that this // does not affect the frame's container (e.g. browser window). Can be // used to produce screenshots of the specified size. Not supported on // Android. // // Note: This command is experimental. SetVisibleSize(context.Context, *emulation.SetVisibleSizeArgs) error // Command SetUserAgentOverride // // Allows overriding user agent with the given string. SetUserAgentOverride(context.Context, *emulation.SetUserAgentOverrideArgs) error // Event VirtualTimeAdvanced // // Notification sent after the virtual time has advanced. // // Note: This event is experimental. VirtualTimeAdvanced(context.Context) (emulation.VirtualTimeAdvancedClient, error) // Event VirtualTimeBudgetExpired // // Notification sent after the virtual time budget for the current // VirtualTimePolicy has run out. // // Note: This event is experimental. VirtualTimeBudgetExpired(context.Context) (emulation.VirtualTimeBudgetExpiredClient, error) // Event VirtualTimePaused // // Notification sent after the virtual time has paused. // // Note: This event is experimental. VirtualTimePaused(context.Context) (emulation.VirtualTimePausedClient, error) }
The Emulation domain. This domain emulates different environments for the page.
type HeadlessExperimental ¶ added in v0.14.1
type HeadlessExperimental interface { // Command BeginFrame // // Sends a BeginFrame to the target and returns when the frame was // completed. Optionally captures a screenshot from the resulting // frame. Requires that the target was created with enabled // BeginFrameControl. Designed for use with // --run-all-compositor-stages-before-draw, see also // https://goo.gl/3zHXhB for more background. BeginFrame(context.Context, *headlessexperimental.BeginFrameArgs) (*headlessexperimental.BeginFrameReply, error) // Command Disable // // Disables headless events for the target. Disable(context.Context) error // Command Enable // // Enables headless events for the target. Enable(context.Context) error // Event NeedsBeginFramesChanged // // Issued when the target starts or stops needing BeginFrames. NeedsBeginFramesChanged(context.Context) (headlessexperimental.NeedsBeginFramesChangedClient, error) }
The HeadlessExperimental domain. This domain provides experimental commands only supported in headless mode.
Note: This domain is experimental.
type HeapProfiler ¶
type HeapProfiler interface { // Command AddInspectedHeapObject // // Enables console to refer to the node with given id via $x (see // Command Line API for more details $x functions). AddInspectedHeapObject(context.Context, *heapprofiler.AddInspectedHeapObjectArgs) error // Command CollectGarbage CollectGarbage(context.Context) error // Command Disable Disable(context.Context) error // Command Enable Enable(context.Context) error // Command GetHeapObjectID GetHeapObjectID(context.Context, *heapprofiler.GetHeapObjectIDArgs) (*heapprofiler.GetHeapObjectIDReply, error) // Command GetObjectByHeapObjectID GetObjectByHeapObjectID(context.Context, *heapprofiler.GetObjectByHeapObjectIDArgs) (*heapprofiler.GetObjectByHeapObjectIDReply, error) // Command GetSamplingProfile GetSamplingProfile(context.Context) (*heapprofiler.GetSamplingProfileReply, error) // Command StartSampling StartSampling(context.Context, *heapprofiler.StartSamplingArgs) error // Command StartTrackingHeapObjects StartTrackingHeapObjects(context.Context, *heapprofiler.StartTrackingHeapObjectsArgs) error // Command StopSampling StopSampling(context.Context) (*heapprofiler.StopSamplingReply, error) // Command StopTrackingHeapObjects StopTrackingHeapObjects(context.Context, *heapprofiler.StopTrackingHeapObjectsArgs) error // Command TakeHeapSnapshot TakeHeapSnapshot(context.Context, *heapprofiler.TakeHeapSnapshotArgs) error // Event AddHeapSnapshotChunk AddHeapSnapshotChunk(context.Context) (heapprofiler.AddHeapSnapshotChunkClient, error) // Event HeapStatsUpdate // // If heap objects tracking has been started then backend may send // update for one or more fragments HeapStatsUpdate(context.Context) (heapprofiler.HeapStatsUpdateClient, error) // Event LastSeenObjectID // // If heap objects tracking has been started then backend regularly // sends a current value for last seen object id and corresponding // timestamp. If the were changes in the heap since last event then one // or more heapStatsUpdate events will be sent before a new // lastSeenObjectId event. LastSeenObjectID(context.Context) (heapprofiler.LastSeenObjectIDClient, error) // Event ReportHeapSnapshotProgress ReportHeapSnapshotProgress(context.Context) (heapprofiler.ReportHeapSnapshotProgressClient, error) // Event ResetProfiles ResetProfiles(context.Context) (heapprofiler.ResetProfilesClient, error) }
The HeapProfiler domain.
Note: This domain is experimental.
type IO ¶
type IO interface { // Command Close // // Close the stream, discard any temporary backing storage. Close(context.Context, *io.CloseArgs) error // Command Read // // Read a chunk of the stream Read(context.Context, *io.ReadArgs) (*io.ReadReply, error) // Command ResolveBlob // // Return UUID of Blob object specified by a remote object id. ResolveBlob(context.Context, *io.ResolveBlobArgs) (*io.ResolveBlobReply, error) }
The IO domain. Input/Output operations for streams produced by DevTools.
type IndexedDB ¶
type IndexedDB interface { // Command ClearObjectStore // // Clears all entries from an object store. ClearObjectStore(context.Context, *indexeddb.ClearObjectStoreArgs) error // Command DeleteDatabase // // Deletes a database. DeleteDatabase(context.Context, *indexeddb.DeleteDatabaseArgs) error // Command DeleteObjectStoreEntries // // Delete a range of entries from an object store DeleteObjectStoreEntries(context.Context, *indexeddb.DeleteObjectStoreEntriesArgs) error // Command Disable // // Disables events from backend. Disable(context.Context) error // Command Enable // // Enables events from backend. Enable(context.Context) error // Command RequestData // // Requests data from object store or index. RequestData(context.Context, *indexeddb.RequestDataArgs) (*indexeddb.RequestDataReply, error) // Command RequestDatabase // // Requests database with given name in given frame. RequestDatabase(context.Context, *indexeddb.RequestDatabaseArgs) (*indexeddb.RequestDatabaseReply, error) // Command RequestDatabaseNames // // Requests database names for given security origin. RequestDatabaseNames(context.Context, *indexeddb.RequestDatabaseNamesArgs) (*indexeddb.RequestDatabaseNamesReply, error) }
The IndexedDB domain.
Note: This domain is experimental.
type Input ¶
type Input interface { // Command DispatchKeyEvent // // Dispatches a key event to the page. DispatchKeyEvent(context.Context, *input.DispatchKeyEventArgs) error // Command InsertText // // This method emulates inserting text that doesn't come from a key // press, for example an emoji keyboard or an IME. // // Note: This command is experimental. InsertText(context.Context, *input.InsertTextArgs) error // Command DispatchMouseEvent // // Dispatches a mouse event to the page. DispatchMouseEvent(context.Context, *input.DispatchMouseEventArgs) error // Command DispatchTouchEvent // // Dispatches a touch event to the page. DispatchTouchEvent(context.Context, *input.DispatchTouchEventArgs) error // Command EmulateTouchFromMouseEvent // // Emulates touch event from the mouse event parameters. // // Note: This command is experimental. EmulateTouchFromMouseEvent(context.Context, *input.EmulateTouchFromMouseEventArgs) error // Command SetIgnoreInputEvents // // Ignores input events (useful while auditing page). SetIgnoreInputEvents(context.Context, *input.SetIgnoreInputEventsArgs) error // Command SynthesizePinchGesture // // Synthesizes a pinch gesture over a time period by issuing // appropriate touch events. // // Note: This command is experimental. SynthesizePinchGesture(context.Context, *input.SynthesizePinchGestureArgs) error // Command SynthesizeScrollGesture // // Synthesizes a scroll gesture over a time period by issuing // appropriate touch events. // // Note: This command is experimental. SynthesizeScrollGesture(context.Context, *input.SynthesizeScrollGestureArgs) error // Command SynthesizeTapGesture // // Synthesizes a tap gesture over a time period by issuing appropriate // touch events. // // Note: This command is experimental. SynthesizeTapGesture(context.Context, *input.SynthesizeTapGestureArgs) error }
The Input domain.
type Inspector ¶
type Inspector interface { // Command Disable // // Disables inspector domain notifications. Disable(context.Context) error // Command Enable // // Enables inspector domain notifications. Enable(context.Context) error // Event Detached // // Fired when remote debugging connection is about to be terminated. // Contains detach reason. Detached(context.Context) (inspector.DetachedClient, error) // Event TargetCrashed // // Fired when debugging target has crashed TargetCrashed(context.Context) (inspector.TargetCrashedClient, error) // Event TargetReloadedAfterCrash // // Fired when debugging target has reloaded after crash TargetReloadedAfterCrash(context.Context) (inspector.TargetReloadedAfterCrashClient, error) }
The Inspector domain.
Note: This domain is experimental.
type LayerTree ¶
type LayerTree interface { // Command CompositingReasons // // Provides the reasons why the given layer was composited. CompositingReasons(context.Context, *layertree.CompositingReasonsArgs) (*layertree.CompositingReasonsReply, error) // Command Disable // // Disables compositing tree inspection. Disable(context.Context) error // Command Enable // // Enables compositing tree inspection. Enable(context.Context) error // Command LoadSnapshot // // Returns the snapshot identifier. LoadSnapshot(context.Context, *layertree.LoadSnapshotArgs) (*layertree.LoadSnapshotReply, error) // Command MakeSnapshot // // Returns the layer snapshot identifier. MakeSnapshot(context.Context, *layertree.MakeSnapshotArgs) (*layertree.MakeSnapshotReply, error) // Command ProfileSnapshot ProfileSnapshot(context.Context, *layertree.ProfileSnapshotArgs) (*layertree.ProfileSnapshotReply, error) // Command ReleaseSnapshot // // Releases layer snapshot captured by the back-end. ReleaseSnapshot(context.Context, *layertree.ReleaseSnapshotArgs) error // Command ReplaySnapshot // // Replays the layer snapshot and returns the resulting bitmap. ReplaySnapshot(context.Context, *layertree.ReplaySnapshotArgs) (*layertree.ReplaySnapshotReply, error) // Command SnapshotCommandLog // // Replays the layer snapshot and returns canvas log. SnapshotCommandLog(context.Context, *layertree.SnapshotCommandLogArgs) (*layertree.SnapshotCommandLogReply, error) // Event LayerPainted LayerPainted(context.Context) (layertree.LayerPaintedClient, error) // Event LayerTreeDidChange LayerTreeDidChange(context.Context) (layertree.DidChangeClient, error) }
The LayerTree domain.
Note: This domain is experimental.
type Log ¶
type Log interface { // Command Clear // // Clears the log. Clear(context.Context) error // Command Disable // // Disables log domain, prevents further log entries from being // reported to the client. Disable(context.Context) error // Command Enable // // Enables log domain, sends the entries collected so far to the // client by means of the `entryAdded` notification. Enable(context.Context) error // Command StartViolationsReport // // start violation reporting. StartViolationsReport(context.Context, *log.StartViolationsReportArgs) error // Command StopViolationsReport // // Stop violation reporting. StopViolationsReport(context.Context) error // Event EntryAdded // // Issued when new message was logged. EntryAdded(context.Context) (log.EntryAddedClient, error) }
The Log domain. Provides access to log entries.
type Memory ¶
type Memory interface { // Command GetDOMCounters GetDOMCounters(context.Context) (*memory.GetDOMCountersReply, error) // Command PrepareForLeakDetection PrepareForLeakDetection(context.Context) error // Command SetPressureNotificationsSuppressed // // Enable/disable suppressing memory pressure notifications in all // processes. SetPressureNotificationsSuppressed(context.Context, *memory.SetPressureNotificationsSuppressedArgs) error // Command SimulatePressureNotification // // Simulate a memory pressure notification in all processes. SimulatePressureNotification(context.Context, *memory.SimulatePressureNotificationArgs) error // Command StartSampling // // Start collecting native memory profile. StartSampling(context.Context, *memory.StartSamplingArgs) error // Command StopSampling // // Stop collecting native memory profile. StopSampling(context.Context) error // Command GetAllTimeSamplingProfile // // Retrieve native memory allocations profile collected since renderer // process startup. GetAllTimeSamplingProfile(context.Context) (*memory.GetAllTimeSamplingProfileReply, error) // Command GetBrowserSamplingProfile // // Retrieve native memory allocations profile collected since browser // process startup. GetBrowserSamplingProfile(context.Context) (*memory.GetBrowserSamplingProfileReply, error) // Command GetSamplingProfile // // Retrieve native memory allocations profile collected since last // `startSampling` call. GetSamplingProfile(context.Context) (*memory.GetSamplingProfileReply, error) }
The Memory domain.
Note: This domain is experimental.
type Network ¶
type Network interface { // Command CanClearBrowserCache // // Deprecated: Tells whether clearing browser cache is supported. CanClearBrowserCache(context.Context) (*network.CanClearBrowserCacheReply, error) // Command CanClearBrowserCookies // // Deprecated: Tells whether clearing browser cookies is supported. CanClearBrowserCookies(context.Context) (*network.CanClearBrowserCookiesReply, error) // Command CanEmulateNetworkConditions // // Deprecated: Tells whether emulation of network conditions is // supported. CanEmulateNetworkConditions(context.Context) (*network.CanEmulateNetworkConditionsReply, error) // Command ClearBrowserCache // // Clears browser cache. ClearBrowserCache(context.Context) error // Command ClearBrowserCookies // // Clears browser cookies. ClearBrowserCookies(context.Context) error // Command ContinueInterceptedRequest // // Response to Network.requestIntercepted which either modifies the // request to continue with any modifications, or blocks it, or // completes it with the provided response bytes. If a network fetch // occurs as a result which encounters a redirect an additional // Network.requestIntercepted event will be sent with the same // InterceptionId. // // Note: This command is experimental. ContinueInterceptedRequest(context.Context, *network.ContinueInterceptedRequestArgs) error // Command DeleteCookies // // Deletes browser cookies with matching name and url or domain/path // pair. DeleteCookies(context.Context, *network.DeleteCookiesArgs) error // Command Disable // // Disables network tracking, prevents network events from being sent // to the client. Disable(context.Context) error // Command EmulateNetworkConditions // // Activates emulation of network conditions. EmulateNetworkConditions(context.Context, *network.EmulateNetworkConditionsArgs) error // Command Enable // // Enables network tracking, network events will now be delivered to // the client. Enable(context.Context, *network.EnableArgs) error // Command GetAllCookies // // Returns all browser cookies. Depending on the backend support, will // return detailed cookie information in the `cookies` field. GetAllCookies(context.Context) (*network.GetAllCookiesReply, error) // Command GetCertificate // // Returns the DER-encoded certificate. // // Note: This command is experimental. GetCertificate(context.Context, *network.GetCertificateArgs) (*network.GetCertificateReply, error) // Command GetCookies // // Returns all browser cookies for the current URL. Depending on the // backend support, will return detailed cookie information in the // `cookies` field. GetCookies(context.Context, *network.GetCookiesArgs) (*network.GetCookiesReply, error) // Command GetResponseBody // // Returns content served for the given request. GetResponseBody(context.Context, *network.GetResponseBodyArgs) (*network.GetResponseBodyReply, error) // Command GetRequestPostData // // Returns post data sent with the request. Returns an error when no // data was sent with the request. GetRequestPostData(context.Context, *network.GetRequestPostDataArgs) (*network.GetRequestPostDataReply, error) // Command GetResponseBodyForInterception // // Returns content served for the given currently intercepted request. // // Note: This command is experimental. GetResponseBodyForInterception(context.Context, *network.GetResponseBodyForInterceptionArgs) (*network.GetResponseBodyForInterceptionReply, error) // Command TakeResponseBodyForInterceptionAsStream // // Returns a handle to the stream representing the response body. Note // that after this command, the intercepted request can't be continued // as is -- you either need to cancel it or to provide the response // body. The stream only supports sequential read, IO.read will fail if // the position is specified. // // Note: This command is experimental. TakeResponseBodyForInterceptionAsStream(context.Context, *network.TakeResponseBodyForInterceptionAsStreamArgs) (*network.TakeResponseBodyForInterceptionAsStreamReply, error) // Command ReplayXHR // // This method sends a new XMLHttpRequest which is identical to the // original one. The following parameters should be identical: method, // url, async, request body, extra headers, withCredentials attribute, // user, password. // // Note: This command is experimental. ReplayXHR(context.Context, *network.ReplayXHRArgs) error // Command SearchInResponseBody // // Searches for given string in response content. // // Note: This command is experimental. SearchInResponseBody(context.Context, *network.SearchInResponseBodyArgs) (*network.SearchInResponseBodyReply, error) // Command SetBlockedURLs // // Blocks URLs from loading. // // Note: This command is experimental. SetBlockedURLs(context.Context, *network.SetBlockedURLsArgs) error // Command SetBypassServiceWorker // // Toggles ignoring of service worker for each request. // // Note: This command is experimental. SetBypassServiceWorker(context.Context, *network.SetBypassServiceWorkerArgs) error // Command SetCacheDisabled // // Toggles ignoring cache for each request. If `true`, cache will not // be used. SetCacheDisabled(context.Context, *network.SetCacheDisabledArgs) error // Command SetCookie // // Sets a cookie with the given cookie data; may overwrite equivalent // cookies if they exist. SetCookie(context.Context, *network.SetCookieArgs) (*network.SetCookieReply, error) // Command SetCookies // // Sets given cookies. SetCookies(context.Context, *network.SetCookiesArgs) error // Command SetDataSizeLimitsForTest // // For testing. // // Note: This command is experimental. SetDataSizeLimitsForTest(context.Context, *network.SetDataSizeLimitsForTestArgs) error // Command SetExtraHTTPHeaders // // Specifies whether to always send extra HTTP headers with the // requests from this page. SetExtraHTTPHeaders(context.Context, *network.SetExtraHTTPHeadersArgs) error // Command SetRequestInterception // // Sets the requests to intercept that match a the provided patterns // and optionally resource types. // // Note: This command is experimental. SetRequestInterception(context.Context, *network.SetRequestInterceptionArgs) error // Event DataReceived // // Fired when data chunk was received over the network. DataReceived(context.Context) (network.DataReceivedClient, error) // Event EventSourceMessageReceived // // Fired when EventSource message is received. EventSourceMessageReceived(context.Context) (network.EventSourceMessageReceivedClient, error) // Event LoadingFailed // // Fired when HTTP request has failed to load. LoadingFailed(context.Context) (network.LoadingFailedClient, error) // Event LoadingFinished // // Fired when HTTP request has finished loading. LoadingFinished(context.Context) (network.LoadingFinishedClient, error) // Event RequestIntercepted // // Details of an intercepted HTTP request, which must be either // allowed, blocked, modified or mocked. // // Note: This event is experimental. RequestIntercepted(context.Context) (network.RequestInterceptedClient, error) // Event RequestServedFromCache // // Fired if request ended up loading from cache. RequestServedFromCache(context.Context) (network.RequestServedFromCacheClient, error) // Event RequestWillBeSent // // Fired when page is about to send HTTP request. RequestWillBeSent(context.Context) (network.RequestWillBeSentClient, error) // Event ResourceChangedPriority // // Fired when resource loading priority is changed // // Note: This event is experimental. ResourceChangedPriority(context.Context) (network.ResourceChangedPriorityClient, error) // Event SignedExchangeReceived // // Fired when a signed exchange was received over the network // // Note: This event is experimental. SignedExchangeReceived(context.Context) (network.SignedExchangeReceivedClient, error) // Event ResponseReceived // // Fired when HTTP response is available. ResponseReceived(context.Context) (network.ResponseReceivedClient, error) // Event WebSocketClosed // // Fired when WebSocket is closed. WebSocketClosed(context.Context) (network.WebSocketClosedClient, error) // Event WebSocketCreated // // Fired upon WebSocket creation. WebSocketCreated(context.Context) (network.WebSocketCreatedClient, error) // Event WebSocketFrameError // // Fired when WebSocket frame error occurs. WebSocketFrameError(context.Context) (network.WebSocketFrameErrorClient, error) // Event WebSocketFrameReceived // // Fired when WebSocket frame is received. WebSocketFrameReceived(context.Context) (network.WebSocketFrameReceivedClient, error) // Event WebSocketFrameSent // // Fired when WebSocket frame is sent. WebSocketFrameSent(context.Context) (network.WebSocketFrameSentClient, error) // Event WebSocketHandshakeResponseReceived // // Fired when WebSocket handshake response becomes available. WebSocketHandshakeResponseReceived(context.Context) (network.WebSocketHandshakeResponseReceivedClient, error) // Event WebSocketWillSendHandshakeRequest // // Fired when WebSocket is about to initiate handshake. WebSocketWillSendHandshakeRequest(context.Context) (network.WebSocketWillSendHandshakeRequestClient, error) }
The Network domain. Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.
type Overlay ¶
type Overlay interface { // Command Disable // // Disables domain notifications. Disable(context.Context) error // Command Enable // // Enables domain notifications. Enable(context.Context) error // Command GetHighlightObjectForTest // // For testing. GetHighlightObjectForTest(context.Context, *overlay.GetHighlightObjectForTestArgs) (*overlay.GetHighlightObjectForTestReply, error) // Command HideHighlight // // Hides any highlight. HideHighlight(context.Context) error // Command HighlightFrame // // Highlights owner element of the frame with given id. HighlightFrame(context.Context, *overlay.HighlightFrameArgs) error // Command HighlightNode // // Highlights DOM node with given id or with the given JavaScript // object wrapper. Either nodeId or objectId must be specified. HighlightNode(context.Context, *overlay.HighlightNodeArgs) error // Command HighlightQuad // // Highlights given quad. Coordinates are absolute with respect to the // main frame viewport. HighlightQuad(context.Context, *overlay.HighlightQuadArgs) error // Command HighlightRect // // Highlights given rectangle. Coordinates are absolute with respect // to the main frame viewport. HighlightRect(context.Context, *overlay.HighlightRectArgs) error // Command SetInspectMode // // Enters the 'inspect' mode. In this mode, elements that user is // hovering over are highlighted. Backend then generates // 'inspectNodeRequested' event upon element selection. SetInspectMode(context.Context, *overlay.SetInspectModeArgs) error // Command SetPausedInDebuggerMessage SetPausedInDebuggerMessage(context.Context, *overlay.SetPausedInDebuggerMessageArgs) error // Command SetShowDebugBorders // // Requests that backend shows debug borders on layers SetShowDebugBorders(context.Context, *overlay.SetShowDebugBordersArgs) error // Command SetShowFPSCounter // // Requests that backend shows the FPS counter SetShowFPSCounter(context.Context, *overlay.SetShowFPSCounterArgs) error // Command SetShowPaintRects // // Requests that backend shows paint rectangles SetShowPaintRects(context.Context, *overlay.SetShowPaintRectsArgs) error // Command SetShowScrollBottleneckRects // // Requests that backend shows scroll bottleneck rects SetShowScrollBottleneckRects(context.Context, *overlay.SetShowScrollBottleneckRectsArgs) error // Command SetShowViewportSizeOnResize // // Paints viewport size upon main frame resize. SetShowViewportSizeOnResize(context.Context, *overlay.SetShowViewportSizeOnResizeArgs) error // Command SetSuspended SetSuspended(context.Context, *overlay.SetSuspendedArgs) error // Event InspectNodeRequested // // Fired when the node should be inspected. This happens after call to // `setInspectMode` or when user manually inspects an element. InspectNodeRequested(context.Context) (overlay.InspectNodeRequestedClient, error) // Event NodeHighlightRequested // // Fired when the node should be highlighted. This happens after call // to `setInspectMode`. NodeHighlightRequested(context.Context) (overlay.NodeHighlightRequestedClient, error) // Event ScreenshotRequested // // Fired when user asks to capture screenshot of some area on the // page. ScreenshotRequested(context.Context) (overlay.ScreenshotRequestedClient, error) }
The Overlay domain. This domain provides various functionality related to drawing atop the inspected page.
Note: This domain is experimental.
type Page ¶
type Page interface { // Command AddScriptToEvaluateOnLoad // // Deprecated: Please use addScriptToEvaluateOnNewDocument // instead. // // Note: This command is experimental. AddScriptToEvaluateOnLoad(context.Context, *page.AddScriptToEvaluateOnLoadArgs) (*page.AddScriptToEvaluateOnLoadReply, error) // Command AddScriptToEvaluateOnNewDocument // // Evaluates given script in every frame upon creation (before loading // frame's scripts). AddScriptToEvaluateOnNewDocument(context.Context, *page.AddScriptToEvaluateOnNewDocumentArgs) (*page.AddScriptToEvaluateOnNewDocumentReply, error) // Command BringToFront // // Brings page to front (activates tab). BringToFront(context.Context) error // Command CaptureScreenshot // // Capture page screenshot. CaptureScreenshot(context.Context, *page.CaptureScreenshotArgs) (*page.CaptureScreenshotReply, error) // Command CreateIsolatedWorld // // Creates an isolated world for the given frame. CreateIsolatedWorld(context.Context, *page.CreateIsolatedWorldArgs) (*page.CreateIsolatedWorldReply, error) // Command Disable // // Disables page domain notifications. Disable(context.Context) error // Command Enable // // Enables page domain notifications. Enable(context.Context) error // Command GetAppManifest GetAppManifest(context.Context) (*page.GetAppManifestReply, error) // Command GetFrameTree // // Returns present frame tree structure. GetFrameTree(context.Context) (*page.GetFrameTreeReply, error) // Command GetLayoutMetrics // // Returns metrics relating to the layouting of the page, such as // viewport bounds/scale. GetLayoutMetrics(context.Context) (*page.GetLayoutMetricsReply, error) // // Returns navigation history for the current page. GetNavigationHistory(context.Context) (*page.GetNavigationHistoryReply, error) // Command GetResourceContent // // Returns content of the given resource. // // Note: This command is experimental. GetResourceContent(context.Context, *page.GetResourceContentArgs) (*page.GetResourceContentReply, error) // Command GetResourceTree // // Returns present frame / resource tree structure. // // Note: This command is experimental. GetResourceTree(context.Context) (*page.GetResourceTreeReply, error) // Command HandleJavaScriptDialog // // Accepts or dismisses a JavaScript initiated dialog (alert, confirm, // prompt, or onbeforeunload). HandleJavaScriptDialog(context.Context, *page.HandleJavaScriptDialogArgs) error // // Navigates current page to the given URL. Navigate(context.Context, *page.NavigateArgs) (*page.NavigateReply, error) // // Navigates current page to the given history entry. NavigateToHistoryEntry(context.Context, *page.NavigateToHistoryEntryArgs) error // Command PrintToPDF // // Print page as PDF. PrintToPDF(context.Context, *page.PrintToPDFArgs) (*page.PrintToPDFReply, error) // Command Reload // // Reloads given page optionally ignoring the cache. Reload(context.Context, *page.ReloadArgs) error // Command RemoveScriptToEvaluateOnLoad // // Deprecated: Please use // removeScriptToEvaluateOnNewDocument instead. // // Note: This command is experimental. RemoveScriptToEvaluateOnLoad(context.Context, *page.RemoveScriptToEvaluateOnLoadArgs) error // Command RemoveScriptToEvaluateOnNewDocument // // Removes given script from the list. RemoveScriptToEvaluateOnNewDocument(context.Context, *page.RemoveScriptToEvaluateOnNewDocumentArgs) error // Command RequestAppBanner // // Note: This command is experimental. RequestAppBanner(context.Context) error // Command ScreencastFrameAck // // Acknowledges that a screencast frame has been received by the // frontend. // // Note: This command is experimental. ScreencastFrameAck(context.Context, *page.ScreencastFrameAckArgs) error // Command SearchInResource // // Searches for given string in resource content. // // Note: This command is experimental. SearchInResource(context.Context, *page.SearchInResourceArgs) (*page.SearchInResourceReply, error) // Command SetAdBlockingEnabled // // Enable Chrome's experimental ad filter on all sites. // // Note: This command is experimental. SetAdBlockingEnabled(context.Context, *page.SetAdBlockingEnabledArgs) error // Command SetBypassCSP // // Enable page Content Security Policy by-passing. // // Note: This command is experimental. SetBypassCSP(context.Context, *page.SetBypassCSPArgs) error // Command SetFontFamilies // // Set generic font families. // // Note: This command is experimental. SetFontFamilies(context.Context, *page.SetFontFamiliesArgs) error // Command SetFontSizes // // Set default font sizes. // // Note: This command is experimental. SetFontSizes(context.Context, *page.SetFontSizesArgs) error // Command SetDocumentContent // // Sets given markup as the document's HTML. SetDocumentContent(context.Context, *page.SetDocumentContentArgs) error // Command SetDownloadBehavior // // Set the behavior when downloading a file. // // Note: This command is experimental. SetDownloadBehavior(context.Context, *page.SetDownloadBehaviorArgs) error // Command SetLifecycleEventsEnabled // // Controls whether page will emit lifecycle events. // // Note: This command is experimental. SetLifecycleEventsEnabled(context.Context, *page.SetLifecycleEventsEnabledArgs) error // Command StartScreencast // // Starts sending each frame using the `screencastFrame` event. // // Note: This command is experimental. StartScreencast(context.Context, *page.StartScreencastArgs) error // Command StopLoading // // Force the page stop all navigations and pending resource fetches. StopLoading(context.Context) error // Command Crash // // Crashes renderer on the IO thread, generates minidumps. // // Note: This command is experimental. Crash(context.Context) error // Command Close // // Tries to close page, running its beforeunload hooks, if any. // // Note: This command is experimental. Close(context.Context) error // Command SetWebLifecycleState // // Tries to update the web lifecycle state of the page. It will // transition the page to the given state according to: // https://github.com/WICG/web-lifecycle/ // // Note: This command is experimental. SetWebLifecycleState(context.Context, *page.SetWebLifecycleStateArgs) error // Command StopScreencast // // Stops sending each frame in the `screencastFrame`. // // Note: This command is experimental. StopScreencast(context.Context) error // Command SetProduceCompilationCache // // Forces compilation cache to be generated for every subresource // script. // // Note: This command is experimental. SetProduceCompilationCache(context.Context, *page.SetProduceCompilationCacheArgs) error // Command AddCompilationCache // // Seeds compilation cache for given url. Compilation cache does not // survive cross-process navigation. // // Note: This command is experimental. AddCompilationCache(context.Context, *page.AddCompilationCacheArgs) error // Command ClearCompilationCache // // Clears seeded compilation cache. // // Note: This command is experimental. ClearCompilationCache(context.Context) error // Event DOMContentEventFired DOMContentEventFired(context.Context) (page.DOMContentEventFiredClient, error) // Event FrameAttached // // Fired when frame has been attached to its parent. FrameAttached(context.Context) (page.FrameAttachedClient, error) // // Fired when frame no longer has a scheduled navigation. // // Note: This event is experimental. FrameClearedScheduledNavigation(context.Context) (page.FrameClearedScheduledNavigationClient, error) // Event FrameDetached // // Fired when frame has been detached from its parent. FrameDetached(context.Context) (page.FrameDetachedClient, error) // // Fired once navigation of the frame has completed. Frame is now // associated with the new loader. FrameNavigated(context.Context) (page.FrameNavigatedClient, error) // Event FrameResized // // Note: This event is experimental. FrameResized(context.Context) (page.FrameResizedClient, error) // // Fired when frame schedules a potential navigation. // // Note: This event is experimental. FrameScheduledNavigation(context.Context) (page.FrameScheduledNavigationClient, error) // Event FrameStartedLoading // // Fired when frame has started loading. // // Note: This event is experimental. FrameStartedLoading(context.Context) (page.FrameStartedLoadingClient, error) // Event FrameStoppedLoading // // Fired when frame has stopped loading. // // Note: This event is experimental. FrameStoppedLoading(context.Context) (page.FrameStoppedLoadingClient, error) // Event InterstitialHidden // // Fired when interstitial page was hidden InterstitialHidden(context.Context) (page.InterstitialHiddenClient, error) // Event InterstitialShown // // Fired when interstitial page was shown InterstitialShown(context.Context) (page.InterstitialShownClient, error) // Event JavascriptDialogClosed // // Fired when a JavaScript initiated dialog (alert, confirm, prompt, // or onbeforeunload) has been closed. JavascriptDialogClosed(context.Context) (page.JavascriptDialogClosedClient, error) // Event JavascriptDialogOpening // // Fired when a JavaScript initiated dialog (alert, confirm, prompt, // or onbeforeunload) is about to open. JavascriptDialogOpening(context.Context) (page.JavascriptDialogOpeningClient, error) // Event LifecycleEvent // // Fired for top level page lifecycle events such as navigation, load, // paint, etc. LifecycleEvent(context.Context) (page.LifecycleEventClient, error) // Event LoadEventFired LoadEventFired(context.Context) (page.LoadEventFiredClient, error) // // Fired when same-document navigation happens, e.g. due to history // API usage or anchor navigation. // // Note: This event is experimental. NavigatedWithinDocument(context.Context) (page.NavigatedWithinDocumentClient, error) // Event ScreencastFrame // // Compressed image data requested by the `startScreencast`. // // Note: This event is experimental. ScreencastFrame(context.Context) (page.ScreencastFrameClient, error) // Event ScreencastVisibilityChanged // // Fired when the page with currently enabled screencast was shown or // hidden `. // // Note: This event is experimental. ScreencastVisibilityChanged(context.Context) (page.ScreencastVisibilityChangedClient, error) // Event WindowOpen // // Fired when a new window is going to be opened, via window.open(), // link click, form submission, etc. WindowOpen(context.Context) (page.WindowOpenClient, error) // Event CompilationCacheProduced // // Issued for every compilation cache generated. Is only available if // Page.setGenerateCompilationCache is enabled. // // Note: This event is experimental. CompilationCacheProduced(context.Context) (page.CompilationCacheProducedClient, error) }
The Page domain. Actions and events related to the inspected page belong to the page domain.
type Performance ¶ added in v0.11.1
type Performance interface { // Command Disable // // Disable collecting and reporting metrics. Disable(context.Context) error // Command Enable // // Enable collecting and reporting metrics. Enable(context.Context) error // Command GetMetrics // // Retrieve current values of run-time metrics. GetMetrics(context.Context) (*performance.GetMetricsReply, error) // Event Metrics // // Current values of the metrics. Metrics(context.Context) (performance.MetricsClient, error) }
The Performance domain.
type Profiler ¶
type Profiler interface { // Command Disable Disable(context.Context) error // Command Enable Enable(context.Context) error // Command GetBestEffortCoverage // // Collect coverage data for the current isolate. The coverage data // may be incomplete due to garbage collection. GetBestEffortCoverage(context.Context) (*profiler.GetBestEffortCoverageReply, error) // Command SetSamplingInterval // // Changes CPU profiler sampling interval. Must be called before CPU // profiles recording started. SetSamplingInterval(context.Context, *profiler.SetSamplingIntervalArgs) error // Command Start Start(context.Context) error // Command StartPreciseCoverage // // Enable precise code coverage. Coverage data for JavaScript executed // before enabling precise code coverage may be incomplete. Enabling // prevents running optimized code and resets execution counters. StartPreciseCoverage(context.Context, *profiler.StartPreciseCoverageArgs) error // Command StartTypeProfile // // Enable type profile. // // Note: This command is experimental. StartTypeProfile(context.Context) error // Command Stop Stop(context.Context) (*profiler.StopReply, error) // Command StopPreciseCoverage // // Disable precise code coverage. Disabling releases unnecessary // execution count records and allows executing optimized code. StopPreciseCoverage(context.Context) error // Command StopTypeProfile // // Disable type profile. Disabling releases type profile data // collected so far. // // Note: This command is experimental. StopTypeProfile(context.Context) error // Command TakePreciseCoverage // // Collect coverage data for the current isolate, and resets execution // counters. Precise code coverage needs to have started. TakePreciseCoverage(context.Context) (*profiler.TakePreciseCoverageReply, error) // Command TakeTypeProfile // // Collect type profile. // // Note: This command is experimental. TakeTypeProfile(context.Context) (*profiler.TakeTypeProfileReply, error) // Event ConsoleProfileFinished ConsoleProfileFinished(context.Context) (profiler.ConsoleProfileFinishedClient, error) // Event ConsoleProfileStarted // // Sent when new profile recording is started using console.profile() // call. ConsoleProfileStarted(context.Context) (profiler.ConsoleProfileStartedClient, error) }
The Profiler domain.
type Runtime ¶
type Runtime interface { // Command AwaitPromise // // Add handler to promise with given promise object id. AwaitPromise(context.Context, *runtime.AwaitPromiseArgs) (*runtime.AwaitPromiseReply, error) // Command CallFunctionOn // // Calls function with given declaration on the given object. Object // group of the result is inherited from the target object. CallFunctionOn(context.Context, *runtime.CallFunctionOnArgs) (*runtime.CallFunctionOnReply, error) // Command CompileScript // // Compiles expression. CompileScript(context.Context, *runtime.CompileScriptArgs) (*runtime.CompileScriptReply, error) // Command Disable // // Disables reporting of execution contexts creation. Disable(context.Context) error // Command DiscardConsoleEntries // // Discards collected exceptions and console API calls. DiscardConsoleEntries(context.Context) error // Command Enable // // Enables reporting of execution contexts creation by means of // `executionContextCreated` event. When the reporting gets enabled the // event will be sent immediately for each existing execution context. Enable(context.Context) error // Command Evaluate // // Evaluates expression on global object. Evaluate(context.Context, *runtime.EvaluateArgs) (*runtime.EvaluateReply, error) // Command GetIsolateID // // Returns the isolate id. // // Note: This command is experimental. GetIsolateID(context.Context) (*runtime.GetIsolateIDReply, error) // Command GetHeapUsage // // Returns the JavaScript heap usage. It is the total usage of the // corresponding isolate not scoped to a particular Runtime. // // Note: This command is experimental. GetHeapUsage(context.Context) (*runtime.GetHeapUsageReply, error) // Command GetProperties // // Returns properties of a given object. Object group of the result is // inherited from the target object. GetProperties(context.Context, *runtime.GetPropertiesArgs) (*runtime.GetPropertiesReply, error) // Command GlobalLexicalScopeNames // // Returns all let, const and class variables from global scope. GlobalLexicalScopeNames(context.Context, *runtime.GlobalLexicalScopeNamesArgs) (*runtime.GlobalLexicalScopeNamesReply, error) // Command QueryObjects QueryObjects(context.Context, *runtime.QueryObjectsArgs) (*runtime.QueryObjectsReply, error) // Command ReleaseObject // // Releases remote object with given id. ReleaseObject(context.Context, *runtime.ReleaseObjectArgs) error // Command ReleaseObjectGroup // // Releases all remote objects that belong to a given group. ReleaseObjectGroup(context.Context, *runtime.ReleaseObjectGroupArgs) error // Command RunIfWaitingForDebugger // // Tells inspected instance to run if it was waiting for debugger to // attach. RunIfWaitingForDebugger(context.Context) error // Command RunScript // // Runs script with given id in a given context. RunScript(context.Context, *runtime.RunScriptArgs) (*runtime.RunScriptReply, error) // Command SetCustomObjectFormatterEnabled // // Note: This command is experimental. SetCustomObjectFormatterEnabled(context.Context, *runtime.SetCustomObjectFormatterEnabledArgs) error // Command SetMaxCallStackSizeToCapture // // Note: This command is experimental. SetMaxCallStackSizeToCapture(context.Context, *runtime.SetMaxCallStackSizeToCaptureArgs) error // Command TerminateExecution // // Terminate current or next JavaScript execution. Will cancel the // termination when the outer-most script execution ends. // // Note: This command is experimental. TerminateExecution(context.Context) error // Command AddBinding // // If executionContextId is empty, adds binding with the given name on // the global objects of all inspected contexts, including those // created later, bindings survive reloads. If executionContextId is // specified, adds binding only on global object of given execution // context. Binding function takes exactly one argument, this argument // should be string, in case of any other input, function throws an // exception. Each binding function call produces Runtime.bindingCalled // notification. // // Note: This command is experimental. AddBinding(context.Context, *runtime.AddBindingArgs) error // Command RemoveBinding // // This method does not remove binding function from global object but // unsubscribes current runtime agent from Runtime.bindingCalled // notifications. // // Note: This command is experimental. RemoveBinding(context.Context, *runtime.RemoveBindingArgs) error // Event BindingCalled // // Notification is issued every time when binding is called. // // Note: This event is experimental. BindingCalled(context.Context) (runtime.BindingCalledClient, error) // Event ConsoleAPICalled // // Issued when console API was called. ConsoleAPICalled(context.Context) (runtime.ConsoleAPICalledClient, error) // Event ExceptionRevoked // // Issued when unhandled exception was revoked. ExceptionRevoked(context.Context) (runtime.ExceptionRevokedClient, error) // Event ExceptionThrown // // Issued when exception was thrown and unhandled. ExceptionThrown(context.Context) (runtime.ExceptionThrownClient, error) // Event ExecutionContextCreated // // Issued when new execution context is created. ExecutionContextCreated(context.Context) (runtime.ExecutionContextCreatedClient, error) // Event ExecutionContextDestroyed // // Issued when execution context is destroyed. ExecutionContextDestroyed(context.Context) (runtime.ExecutionContextDestroyedClient, error) // Event ExecutionContextsCleared // // Issued when all executionContexts were cleared in browser ExecutionContextsCleared(context.Context) (runtime.ExecutionContextsClearedClient, error) // Event InspectRequested // // Issued when object should be inspected (for example, as a result of // inspect() command line API call). InspectRequested(context.Context) (runtime.InspectRequestedClient, error) }
The Runtime domain. Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.
type Security ¶
type Security interface { // Command Disable // // Disables tracking security state changes. Disable(context.Context) error // Command Enable // // Enables tracking security state changes. Enable(context.Context) error // Command SetIgnoreCertificateErrors // // Enable/disable whether all certificate errors should be ignored. // // Note: This command is experimental. SetIgnoreCertificateErrors(context.Context, *security.SetIgnoreCertificateErrorsArgs) error // Command HandleCertificateError // // Deprecated: Handles a certificate error that fired a // certificateError event. HandleCertificateError(context.Context, *security.HandleCertificateErrorArgs) error // Command SetOverrideCertificateErrors // // Deprecated: Enable/disable overriding certificate errors. If // enabled, all certificate error events need to be handled by the // DevTools client and should be answered with `handleCertificateError` // commands. SetOverrideCertificateErrors(context.Context, *security.SetOverrideCertificateErrorsArgs) error // Event CertificateError // // Deprecated: There is a certificate error. If overriding certificate // errors is enabled, then it should be handled with the // `handleCertificateError` command. Note: this event does not fire if // the certificate error has been allowed internally. Only one client // per target should override certificate errors at the same time. CertificateError(context.Context) (security.CertificateErrorClient, error) // Event SecurityStateChanged // // The security state of the page changed. SecurityStateChanged(context.Context) (security.StateChangedClient, error) }
The Security domain. Security
type ServiceWorker ¶
type ServiceWorker interface { // Command DeliverPushMessage DeliverPushMessage(context.Context, *serviceworker.DeliverPushMessageArgs) error // Command Disable Disable(context.Context) error // Command DispatchSyncEvent DispatchSyncEvent(context.Context, *serviceworker.DispatchSyncEventArgs) error // Command Enable Enable(context.Context) error // Command InspectWorker InspectWorker(context.Context, *serviceworker.InspectWorkerArgs) error // Command SetForceUpdateOnPageLoad SetForceUpdateOnPageLoad(context.Context, *serviceworker.SetForceUpdateOnPageLoadArgs) error // Command SkipWaiting SkipWaiting(context.Context, *serviceworker.SkipWaitingArgs) error // Command StartWorker StartWorker(context.Context, *serviceworker.StartWorkerArgs) error // Command StopAllWorkers StopAllWorkers(context.Context) error // Command StopWorker StopWorker(context.Context, *serviceworker.StopWorkerArgs) error // Command Unregister Unregister(context.Context, *serviceworker.UnregisterArgs) error // Command UpdateRegistration UpdateRegistration(context.Context, *serviceworker.UpdateRegistrationArgs) error // Event WorkerErrorReported WorkerErrorReported(context.Context) (serviceworker.WorkerErrorReportedClient, error) // Event WorkerRegistrationUpdated WorkerRegistrationUpdated(context.Context) (serviceworker.WorkerRegistrationUpdatedClient, error) // Event WorkerVersionUpdated WorkerVersionUpdated(context.Context) (serviceworker.WorkerVersionUpdatedClient, error) }
The ServiceWorker domain.
Note: This domain is experimental.
type Storage ¶
type Storage interface { // Command ClearDataForOrigin // // Clears storage for origin. ClearDataForOrigin(context.Context, *storage.ClearDataForOriginArgs) error // Command GetUsageAndQuota // // Returns usage and quota in bytes. GetUsageAndQuota(context.Context, *storage.GetUsageAndQuotaArgs) (*storage.GetUsageAndQuotaReply, error) // Command TrackCacheStorageForOrigin // // Registers origin to be notified when an update occurs to its cache // storage list. TrackCacheStorageForOrigin(context.Context, *storage.TrackCacheStorageForOriginArgs) error // Command TrackIndexedDBForOrigin // // Registers origin to be notified when an update occurs to its // IndexedDB. TrackIndexedDBForOrigin(context.Context, *storage.TrackIndexedDBForOriginArgs) error // Command UntrackCacheStorageForOrigin // // Unregisters origin from receiving notifications for cache storage. UntrackCacheStorageForOrigin(context.Context, *storage.UntrackCacheStorageForOriginArgs) error // Command UntrackIndexedDBForOrigin // // Unregisters origin from receiving notifications for IndexedDB. UntrackIndexedDBForOrigin(context.Context, *storage.UntrackIndexedDBForOriginArgs) error // Event CacheStorageContentUpdated // // A cache's contents have been modified. CacheStorageContentUpdated(context.Context) (storage.CacheStorageContentUpdatedClient, error) // Event CacheStorageListUpdated // // A cache has been added/deleted. CacheStorageListUpdated(context.Context) (storage.CacheStorageListUpdatedClient, error) // Event IndexedDBContentUpdated // // The origin's IndexedDB object store has been modified. IndexedDBContentUpdated(context.Context) (storage.IndexedDBContentUpdatedClient, error) // Event IndexedDBListUpdated // // The origin's IndexedDB database list has been modified. IndexedDBListUpdated(context.Context) (storage.IndexedDBListUpdatedClient, error) }
The Storage domain.
Note: This domain is experimental.
type SystemInfo ¶
type SystemInfo interface { // Command GetInfo // // Returns information about the system. GetInfo(context.Context) (*systeminfo.GetInfoReply, error) }
The SystemInfo domain. The SystemInfo domain defines methods and events for querying low-level system information.
Note: This domain is experimental.
type Target ¶
type Target interface { // Command ActivateTarget // // Activates (focuses) the target. ActivateTarget(context.Context, *target.ActivateTargetArgs) error // Command AttachToTarget // // Attaches to the target with given id. AttachToTarget(context.Context, *target.AttachToTargetArgs) (*target.AttachToTargetReply, error) // Command AttachToBrowserTarget // // Attaches to the browser target, only uses flat sessionId mode. // // Note: This command is experimental. AttachToBrowserTarget(context.Context) (*target.AttachToBrowserTargetReply, error) // Command CloseTarget // // Closes the target. If the target is a page that gets closed too. CloseTarget(context.Context, *target.CloseTargetArgs) (*target.CloseTargetReply, error) // Command ExposeDevToolsProtocol // // Inject object to the target's main frame that provides a // communication channel with browser target. // // Injected object will be available as `window[bindingName]`. // // The object has the follwing API: - `binding.send(json)` - a method // to send messages over the remote debugging protocol - // `binding.onmessage = json => handleMessage(json)` - a callback that // will be called for the protocol notifications and command responses. // // Note: This command is experimental. ExposeDevToolsProtocol(context.Context, *target.ExposeDevToolsProtocolArgs) error // Command CreateBrowserContext // // Creates a new empty BrowserContext. Similar to an incognito profile // but you can have more than one. // // Note: This command is experimental. CreateBrowserContext(context.Context) (*target.CreateBrowserContextReply, error) // Command GetBrowserContexts // // Returns all browser contexts created with // `Target.createBrowserContext` method. // // Note: This command is experimental. GetBrowserContexts(context.Context) (*target.GetBrowserContextsReply, error) // Command CreateTarget // // Creates a new page. CreateTarget(context.Context, *target.CreateTargetArgs) (*target.CreateTargetReply, error) // Command DetachFromTarget // // Detaches session with given id. DetachFromTarget(context.Context, *target.DetachFromTargetArgs) error // Command DisposeBrowserContext // // Deletes a BrowserContext. All the belonging pages will be closed // without calling their beforeunload hooks. // // Note: This command is experimental. DisposeBrowserContext(context.Context, *target.DisposeBrowserContextArgs) error // Command GetTargetInfo // // Returns information about a target. // // Note: This command is experimental. GetTargetInfo(context.Context, *target.GetTargetInfoArgs) (*target.GetTargetInfoReply, error) // Command GetTargets // // Retrieves a list of available targets. GetTargets(context.Context) (*target.GetTargetsReply, error) // Command SendMessageToTarget // // Sends protocol message over session with given id. SendMessageToTarget(context.Context, *target.SendMessageToTargetArgs) error // Command SetAutoAttach // // Controls whether to automatically attach to new targets which are // considered to be related to this one. When turned on, attaches to // all existing related targets as well. When turned off, automatically // detaches from all currently attached targets. // // Note: This command is experimental. SetAutoAttach(context.Context, *target.SetAutoAttachArgs) error // Command SetDiscoverTargets // // Controls whether to discover available targets and notify via // `targetCreated/targetInfoChanged/targetDestroyed` events. SetDiscoverTargets(context.Context, *target.SetDiscoverTargetsArgs) error // Command SetRemoteLocations // // Enables target discovery for the specified locations, when // `setDiscoverTargets` was set to `true`. // // Note: This command is experimental. SetRemoteLocations(context.Context, *target.SetRemoteLocationsArgs) error // Event AttachedToTarget // // Issued when attached to target because of auto-attach or // `attachToTarget` command. // // Note: This event is experimental. AttachedToTarget(context.Context) (target.AttachedToTargetClient, error) // Event DetachedFromTarget // // Issued when detached from target for any reason (including // `detachFromTarget` command). Can be issued multiple times per target // if multiple sessions have been attached to it. // // Note: This event is experimental. DetachedFromTarget(context.Context) (target.DetachedFromTargetClient, error) // Event ReceivedMessageFromTarget // // Notifies about a new protocol message received from the session (as // reported in `attachedToTarget` event). ReceivedMessageFromTarget(context.Context) (target.ReceivedMessageFromTargetClient, error) // Event TargetCreated // // Issued when a possible inspection target is created. TargetCreated(context.Context) (target.CreatedClient, error) // Event TargetDestroyed // // Issued when a target is destroyed. TargetDestroyed(context.Context) (target.DestroyedClient, error) // Event TargetCrashed // // Issued when a target has crashed. TargetCrashed(context.Context) (target.CrashedClient, error) // Event TargetInfoChanged // // Issued when some information about a target has changed. This only // happens between `targetCreated` and `targetDestroyed`. TargetInfoChanged(context.Context) (target.InfoChangedClient, error) }
The Target domain. Supports additional targets discovery and allows to attach to them.
type Tethering ¶
type Tethering interface { // Command Bind // // Request browser port binding. Bind(context.Context, *tethering.BindArgs) error // Command Unbind // // Request browser port unbinding. Unbind(context.Context, *tethering.UnbindArgs) error // Event Accepted // // Informs that port was successfully bound and got a specified // connection id. Accepted(context.Context) (tethering.AcceptedClient, error) }
The Tethering domain. The Tethering domain defines methods and events for browser port binding.
Note: This domain is experimental.
type Tracing ¶
type Tracing interface { // Command End // // Stop trace events collection. End(context.Context) error // Command GetCategories // // Gets supported tracing categories. GetCategories(context.Context) (*tracing.GetCategoriesReply, error) // Command RecordClockSyncMarker // // Record a clock sync marker in the trace. RecordClockSyncMarker(context.Context, *tracing.RecordClockSyncMarkerArgs) error // Command RequestMemoryDump // // Request a global memory dump. RequestMemoryDump(context.Context) (*tracing.RequestMemoryDumpReply, error) // Command Start // // Start trace events collection. Start(context.Context, *tracing.StartArgs) error // Event BufferUsage BufferUsage(context.Context) (tracing.BufferUsageClient, error) // Event DataCollected // // Contains an bucket of collected trace events. When tracing is // stopped collected events will be send as a sequence of dataCollected // events followed by tracingComplete event. DataCollected(context.Context) (tracing.DataCollectedClient, error) // Event TracingComplete // // Signals that tracing is stopped and there is no trace buffers // pending flush, all data were delivered via dataCollected events. TracingComplete(context.Context) (tracing.CompleteClient, error) }
The Tracing domain.
Note: This domain is experimental.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
cdpgen
The cdpgen command generates the package cdp from the provided protocol definitions.
|
The cdpgen command generates the package cdp from the provided protocol definitions. |
cdpgen/lint
Package lint contains a linter for Go source code.
|
Package lint contains a linter for Go source code. |
cdpgen/proto
Package proto is used to parse the CDP protocol definitions (JSON).
|
Package proto is used to parse the CDP protocol definitions (JSON). |
Package devtool provides methods for interacting with a DevTools endpoint.
|
Package devtool provides methods for interacting with a DevTools endpoint. |
example
|
|
internal
|
|
Package protocol contains subpackages representing all domains for the Chrome Debugging Protocol.
|
Package protocol contains subpackages representing all domains for the Chrome Debugging Protocol. |
accessibility
Package accessibility implements the Accessibility domain.
|
Package accessibility implements the Accessibility domain. |
animation
Package animation implements the Animation domain.
|
Package animation implements the Animation domain. |
applicationcache
Package applicationcache implements the ApplicationCache domain.
|
Package applicationcache implements the ApplicationCache domain. |
audits
Package audits implements the Audits domain.
|
Package audits implements the Audits domain. |
browser
Package browser implements the Browser domain.
|
Package browser implements the Browser domain. |
cachestorage
Package cachestorage implements the CacheStorage domain.
|
Package cachestorage implements the CacheStorage domain. |
console
Package console implements the Console domain.
|
Package console implements the Console domain. |
css
Package css implements the CSS domain.
|
Package css implements the CSS domain. |
database
Package database implements the Database domain.
|
Package database implements the Database domain. |
debugger
Package debugger implements the Debugger domain.
|
Package debugger implements the Debugger domain. |
deviceorientation
Package deviceorientation implements the DeviceOrientation domain.
|
Package deviceorientation implements the DeviceOrientation domain. |
dom
Package dom implements the DOM domain.
|
Package dom implements the DOM domain. |
domdebugger
Package domdebugger implements the DOMDebugger domain.
|
Package domdebugger implements the DOMDebugger domain. |
domsnapshot
Package domsnapshot implements the DOMSnapshot domain.
|
Package domsnapshot implements the DOMSnapshot domain. |
domstorage
Package domstorage implements the DOMStorage domain.
|
Package domstorage implements the DOMStorage domain. |
emulation
Package emulation implements the Emulation domain.
|
Package emulation implements the Emulation domain. |
headlessexperimental
Package headlessexperimental implements the HeadlessExperimental domain.
|
Package headlessexperimental implements the HeadlessExperimental domain. |
heapprofiler
Package heapprofiler implements the HeapProfiler domain.
|
Package heapprofiler implements the HeapProfiler domain. |
indexeddb
Package indexeddb implements the IndexedDB domain.
|
Package indexeddb implements the IndexedDB domain. |
input
Package input implements the Input domain.
|
Package input implements the Input domain. |
inspector
Package inspector implements the Inspector domain.
|
Package inspector implements the Inspector domain. |
io
Package io implements the IO domain.
|
Package io implements the IO domain. |
layertree
Package layertree implements the LayerTree domain.
|
Package layertree implements the LayerTree domain. |
log
Package log implements the Log domain.
|
Package log implements the Log domain. |
memory
Package memory implements the Memory domain.
|
Package memory implements the Memory domain. |
network
Package network implements the Network domain.
|
Package network implements the Network domain. |
overlay
Package overlay implements the Overlay domain.
|
Package overlay implements the Overlay domain. |
page
Package page implements the Page domain.
|
Package page implements the Page domain. |
performance
Package performance implements the Performance domain.
|
Package performance implements the Performance domain. |
profiler
Package profiler implements the Profiler domain.
|
Package profiler implements the Profiler domain. |
runtime
Package runtime implements the Runtime domain.
|
Package runtime implements the Runtime domain. |
schema
Package schema implements the Schema domain.
|
Package schema implements the Schema domain. |
security
Package security implements the Security domain.
|
Package security implements the Security domain. |
serviceworker
Package serviceworker implements the ServiceWorker domain.
|
Package serviceworker implements the ServiceWorker domain. |
storage
Package storage implements the Storage domain.
|
Package storage implements the Storage domain. |
systeminfo
Package systeminfo implements the SystemInfo domain.
|
Package systeminfo implements the SystemInfo domain. |
target
Package target implements the Target domain.
|
Package target implements the Target domain. |
tethering
Package tethering implements the Tethering domain.
|
Package tethering implements the Tethering domain. |
tracing
Package tracing implements the Tracing domain.
|
Package tracing implements the Tracing domain. |
Package rpcc provides an RPC client connection with support for the JSON-RPC 2.0 specification, not including Batch requests.
|
Package rpcc provides an RPC client connection with support for the JSON-RPC 2.0 specification, not including Batch requests. |
Package session implements a session Manager for establishing session connections to targets (via the Target domain).
|
Package session implements a session Manager for establishing session connections to targets (via the Target domain). |