cdp

package module
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2017 License: MIT Imports: 41 Imported by: 0

README

cdp

Build Status Coverage Status Go Report Card GoDoc

Package cdp provides type-safe bindings for the Chrome Debugging Protocol (CDP), written in the Go programming language. The bindings are generated (by cdpgen) from the latest tip-of-tree (tot) protocol definitions and are mainly intended for use with Google Chrome or Chromium, however, they can be used with any debug target (Node.js, Edge, Safari, etc.) that implement the protocol.

This package can be used for any kind of browser automation, scripting or debugging via the Chrome Debugging Protocol.

A big motivation for cdp is to expose the full functionality of the Chrome Debugging Protocol and provide it in a discoverable and self-documenting manner.

Providing high-level browser automation is a non-goal for this project. That being said, cdp hopes to improve the ergonomics of working with the protocol by providing primitives better suited for Go and automating repetitive tasks.

Features

  • Discoverable API for the Chrome Debugging Protocol (GoDoc, autocomplete friendly)
  • Contexts as a first-class citizen (for timeouts and cancellation)
  • Simple and synchronous event handling (no callbacks)
  • Concurrently safe
  • No silent or hidden errors
  • Do what the user expects
  • Match CDP types to Go types wherever possible
  • Separation of concerns (avoid mixing CDP and RPC)

Installation

$ go get -u github.com/mafredri/cdp

Documentation

See API documentation for package, API descriptions and examples. Examples can also be found in this repository, see the simple, advanced and logging examples.

Usage

The main packages are cdp and rpcc, the former provides the CDP bindings and the latter handles the RPC communication with the debugging target.

To connect to a debug target, a WebSocket debugger URL is needed. For example, if Chrome is running with --remote-debugging-port=9222 the debugger URL can be found at localhost:9222/json. The devtool package can also be used to query the DevTools JSON API (see example below).

Here is an example of using cdp:

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
}

For more information, consult the documentation.

Acknowledgements

The Go implementation of gRPC (grpc-go) has been a source of inspiration for some of the design descisions made in the cdp and rpcc packages. Some ideas have also been borrowed from the net/rpc package from the standard library.

Resources

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.

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

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorCause

func ErrorCause(err error) error

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 Enable
	//
	// Enables animation domain notifications.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables animation domain notifications.
	Disable(context.Context) error

	// Command GetPlaybackRate
	//
	// Gets the playback rate of the document timeline.
	GetPlaybackRate(context.Context) (*animation.GetPlaybackRateReply, error)

	// Command SetPlaybackRate
	//
	// Sets the playback rate of the document timeline.
	SetPlaybackRate(context.Context, *animation.SetPlaybackRateArgs) error

	// Command GetCurrentTime
	//
	// Returns the current time of the an animation.
	GetCurrentTime(context.Context, *animation.GetCurrentTimeArgs) (*animation.GetCurrentTimeReply, error)

	// Command SetPaused
	//
	// Sets the paused state of a set of animations.
	SetPaused(context.Context, *animation.SetPausedArgs) error

	// Command SetTiming
	//
	// Sets the timing of an animation node.
	SetTiming(context.Context, *animation.SetTimingArgs) error

	// Command SeekAnimations
	//
	// Seek a set of animations to a particular time within each animation.
	SeekAnimations(context.Context, *animation.SeekAnimationsArgs) 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)

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

	// Event AnimationCanceled
	//
	// Event for when an animation has been canceled.
	AnimationCanceled(context.Context) (animation.CanceledClient, error)
}

The Animation domain.

Note: This domain is experimental.

type ApplicationCache

type ApplicationCache interface {
	// 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 Enable
	//
	// Enables application cache domain notifications.
	Enable(context.Context) error

	// Command GetManifestForFrame
	//
	// Returns manifest URL for document in the given frame.
	GetManifestForFrame(context.Context, *applicationcache.GetManifestForFrameArgs) (*applicationcache.GetManifestForFrameReply, error)

	// Command GetApplicationCacheForFrame
	//
	// Returns relevant application cache data for the document in given frame.
	GetApplicationCacheForFrame(context.Context, *applicationcache.GetApplicationCacheForFrameArgs) (*applicationcache.GetApplicationCacheForFrameReply, 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 GetWindowForTarget
	//
	// Get the browser window that contains the devtools target.
	//
	// Note: This command is experimental.
	GetWindowForTarget(context.Context, *browser.GetWindowForTargetArgs) (*browser.GetWindowForTargetReply, error)

	// Command GetVersion
	//
	// Returns version information.
	GetVersion(context.Context) (*browser.GetVersionReply, error)

	// Command SetWindowBounds
	//
	// Set position and/or size of the browser window.
	//
	// Note: This command is experimental.
	SetWindowBounds(context.Context, *browser.SetWindowBoundsArgs) error

	// Command GetWindowBounds
	//
	// Get position and size of the browser window.
	//
	// Note: This command is experimental.
	GetWindowBounds(context.Context, *browser.GetWindowBoundsArgs) (*browser.GetWindowBoundsReply, error)
}

The Browser domain. The Browser domain defines methods and events for browser managing.

type CSS

type CSS interface {
	// 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 Disable
	//
	// Disables the CSS agent for the given page.
	Disable(context.Context) error

	// Command GetMatchedStylesForNode
	//
	// Returns requested styles for a DOM node identified by nodeId.
	GetMatchedStylesForNode(context.Context, *css.GetMatchedStylesForNodeArgs) (*css.GetMatchedStylesForNodeReply, 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 GetComputedStyleForNode
	//
	// Returns the computed style for a DOM node identified by nodeId.
	GetComputedStyleForNode(context.Context, *css.GetComputedStyleForNodeArgs) (*css.GetComputedStyleForNodeReply, 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 and the URL for a stylesheet.
	GetStyleSheetText(context.Context, *css.GetStyleSheetTextArgs) (*css.GetStyleSheetTextReply, error)

	// Command CollectClassNames
	//
	// Returns all class names from specified stylesheet.
	CollectClassNames(context.Context, *css.CollectClassNamesArgs) (*css.CollectClassNamesReply, error)

	// Command SetStyleSheetText
	//
	// Sets the new stylesheet text.
	SetStyleSheetText(context.Context, *css.SetStyleSheetTextArgs) (*css.SetStyleSheetTextReply, error)

	// Command SetRuleSelector
	//
	// Modifies the rule selector.
	SetRuleSelector(context.Context, *css.SetRuleSelectorArgs) (*css.SetRuleSelectorReply, error)

	// Command SetKeyframeKey
	//
	// Modifies the keyframe rule key text.
	SetKeyframeKey(context.Context, *css.SetKeyframeKeyArgs) (*css.SetKeyframeKeyReply, error)

	// Command SetStyleTexts
	//
	// Applies specified style edits one after another in the given order.
	SetStyleTexts(context.Context, *css.SetStyleTextsArgs) (*css.SetStyleTextsReply, error)

	// Command SetMediaText
	//
	// Modifies the rule selector.
	SetMediaText(context.Context, *css.SetMediaTextArgs) (*css.SetMediaTextReply, 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 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 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 GetMediaQueries
	//
	// Returns all media queries parsed by the rendering engine.
	GetMediaQueries(context.Context) (*css.GetMediaQueriesReply, 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 GetBackgroundColors
	GetBackgroundColors(context.Context, *css.GetBackgroundColorsArgs) (*css.GetBackgroundColorsReply, error)

	// Command StartRuleUsageTracking
	//
	// Enables the selector recording.
	StartRuleUsageTracking(context.Context) 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)

	// Command StopRuleUsageTracking
	//
	// The list of rules with an indication of whether these were used
	StopRuleUsageTracking(context.Context) (*css.StopRuleUsageTrackingReply, 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 FontsUpdated
	//
	// Fires whenever a web font gets loaded.
	FontsUpdated(context.Context) (css.FontsUpdatedClient, error)

	// Event StyleSheetChanged
	//
	// Fired whenever a stylesheet is changed as a result of the client operation.
	StyleSheetChanged(context.Context) (css.StyleSheetChangedClient, error)

	// Event StyleSheetAdded
	//
	// Fired whenever an active document stylesheet is added.
	StyleSheetAdded(context.Context) (css.StyleSheetAddedClient, 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 RequestCacheNames
	//
	// Requests cache names.
	RequestCacheNames(context.Context, *cachestorage.RequestCacheNamesArgs) (*cachestorage.RequestCacheNamesReply, error)

	// Command RequestEntries
	//
	// Requests data from cache.
	RequestEntries(context.Context, *cachestorage.RequestEntriesArgs) (*cachestorage.RequestEntriesReply, error)

	// Command DeleteCache
	//
	// Deletes a cache.
	DeleteCache(context.Context, *cachestorage.DeleteCacheArgs) error

	// Command DeleteEntry
	//
	// Deletes a cache entry.
	DeleteEntry(context.Context, *cachestorage.DeleteEntryArgs) error

	// Command RequestCachedResponse
	//
	// Fetches cache entry.
	RequestCachedResponse(context.Context, *cachestorage.RequestCachedResponseArgs) (*cachestorage.RequestCachedResponseReply, 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.

func NewClient

func NewClient(conn *rpcc.Conn) *Client

NewClient returns a new Client that uses conn for communication with the debugging target.

type Console deprecated

type Console interface {
	// Command Enable
	//
	// Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables console domain, prevents further console messages from being reported to the client.
	Disable(context.Context) error

	// Command ClearMessages
	//
	// Does nothing.
	ClearMessages(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 Enable
	//
	// Enables DOM agent for the given page.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables DOM agent for the given page.
	Disable(context.Context) 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 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 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 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 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 RemoveNode
	//
	// Removes node with given id.
	RemoveNode(context.Context, *dom.RemoveNodeArgs) 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 RemoveAttribute
	//
	// Removes attribute with given name from an element with given id.
	RemoveAttribute(context.Context, *dom.RemoveAttributeArgs) error

	// Command GetOuterHTML
	//
	// Returns node's HTML markup.
	GetOuterHTML(context.Context, *dom.GetOuterHTMLArgs) (*dom.GetOuterHTMLReply, error)

	// Command SetOuterHTML
	//
	// Sets node HTML markup, returns new node id.
	SetOuterHTML(context.Context, *dom.SetOuterHTMLArgs) 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 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 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 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 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 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 ResolveNode
	//
	// Resolves the JavaScript node object for a given NodeId or BackendNodeId.
	ResolveNode(context.Context, *dom.ResolveNodeArgs) (*dom.ResolveNodeReply, error)

	// Command GetAttributes
	//
	// Returns attributes for the specified node.
	GetAttributes(context.Context, *dom.GetAttributesArgs) (*dom.GetAttributesReply, 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 MoveTo
	//
	// Moves node into the new container, places it before the given anchor.
	MoveTo(context.Context, *dom.MoveToArgs) (*dom.MoveToReply, error)

	// Command Undo
	//
	// Undoes the last performed action.
	//
	// Note: This command is experimental.
	Undo(context.Context) error

	// Command Redo
	//
	// Re-does the last undone action.
	//
	// Note: This command is experimental.
	Redo(context.Context) error

	// Command MarkUndoableState
	//
	// Marks last undoable state.
	//
	// Note: This command is experimental.
	MarkUndoableState(context.Context) error

	// Command Focus
	//
	// Focuses the given element.
	Focus(context.Context, *dom.FocusArgs) error

	// Command SetFileInputFiles
	//
	// Sets files for the given file input element.
	SetFileInputFiles(context.Context, *dom.SetFileInputFilesArgs) error

	// Command GetBoxModel
	//
	// Returns boxes for the given node.
	GetBoxModel(context.Context, *dom.GetBoxModelArgs) (*dom.GetBoxModelReply, error)

	// Command GetNodeForLocation
	//
	// Returns node id at given location.
	//
	// Note: This command is experimental.
	GetNodeForLocation(context.Context, *dom.GetNodeForLocationArgs) (*dom.GetNodeForLocationReply, 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 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)

	// Event DocumentUpdated
	//
	// Fired when Document has been totally updated. Node ids are no longer valid.
	DocumentUpdated(context.Context) (dom.DocumentUpdatedClient, 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 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 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 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 ShadowRootPushed
	//
	// Called when shadow root is pushed into the element.
	//
	// Note: This event is experimental.
	ShadowRootPushed(context.Context) (dom.ShadowRootPushedClient, error)

	// Event ShadowRootPopped
	//
	// Called when shadow root is popped from the element.
	//
	// Note: This event is experimental.
	ShadowRootPopped(context.Context) (dom.ShadowRootPoppedClient, 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 DistributedNodesUpdated
	//
	// Called when distribution is changed.
	//
	// Note: This event is experimental.
	DistributedNodesUpdated(context.Context) (dom.DistributedNodesUpdatedClient, 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 SetDOMBreakpoint
	//
	// Sets breakpoint on particular operation with DOM.
	SetDOMBreakpoint(context.Context, *domdebugger.SetDOMBreakpointArgs) error

	// Command RemoveDOMBreakpoint
	//
	// Removes DOM breakpoint that was set using setDOMBreakpoint.
	RemoveDOMBreakpoint(context.Context, *domdebugger.RemoveDOMBreakpointArgs) error

	// Command SetEventListenerBreakpoint
	//
	// Sets breakpoint on particular DOM event.
	SetEventListenerBreakpoint(context.Context, *domdebugger.SetEventListenerBreakpointArgs) error

	// Command RemoveEventListenerBreakpoint
	//
	// Removes breakpoint on particular DOM event.
	RemoveEventListenerBreakpoint(context.Context, *domdebugger.RemoveEventListenerBreakpointArgs) error

	// Command SetInstrumentationBreakpoint
	//
	// Sets breakpoint on particular native event.
	//
	// Note: This command is experimental.
	SetInstrumentationBreakpoint(context.Context, *domdebugger.SetInstrumentationBreakpointArgs) error

	// Command RemoveInstrumentationBreakpoint
	//
	// Removes breakpoint on particular native event.
	//
	// Note: This command is experimental.
	RemoveInstrumentationBreakpoint(context.Context, *domdebugger.RemoveInstrumentationBreakpointArgs) error

	// Command SetXHRBreakpoint
	//
	// Sets breakpoint on XMLHttpRequest.
	SetXHRBreakpoint(context.Context, *domdebugger.SetXHRBreakpointArgs) error

	// Command RemoveXHRBreakpoint
	//
	// Removes breakpoint from XMLHttpRequest.
	RemoveXHRBreakpoint(context.Context, *domdebugger.RemoveXHRBreakpointArgs) error

	// Command GetEventListeners
	//
	// Returns event listeners of the given object.
	GetEventListeners(context.Context, *domdebugger.GetEventListenersArgs) (*domdebugger.GetEventListenersReply, 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 GetSnapshot
	//
	// 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)
}

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 Enable
	//
	// Enables storage tracking, storage events will now be delivered to the client.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables storage tracking, prevents storage events from being sent to the client.
	Disable(context.Context) error

	// Command Clear
	Clear(context.Context, *domstorage.ClearArgs) error

	// Command GetDOMStorageItems
	GetDOMStorageItems(context.Context, *domstorage.GetDOMStorageItemsArgs) (*domstorage.GetDOMStorageItemsReply, error)

	// Command SetDOMStorageItem
	SetDOMStorageItem(context.Context, *domstorage.SetDOMStorageItemArgs) error

	// Command RemoveDOMStorageItem
	RemoveDOMStorageItem(context.Context, *domstorage.RemoveDOMStorageItemArgs) error

	// Event DOMStorageItemsCleared
	DOMStorageItemsCleared(context.Context) (domstorage.ItemsClearedClient, error)

	// Event DOMStorageItemRemoved
	DOMStorageItemRemoved(context.Context) (domstorage.ItemRemovedClient, error)

	// Event DOMStorageItemAdded
	DOMStorageItemAdded(context.Context) (domstorage.ItemAddedClient, error)

	// Event DOMStorageItemUpdated
	DOMStorageItemUpdated(context.Context) (domstorage.ItemUpdatedClient, error)
}

The DOMStorage domain. Query and modify DOM storage.

Note: This domain is experimental.

type Database

type Database interface {
	// Command Enable
	//
	// Enables database tracking, database events will now be delivered to the client.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables database tracking, prevents database events from being sent to the client.
	Disable(context.Context) error

	// Command GetDatabaseTableNames
	GetDatabaseTableNames(context.Context, *database.GetDatabaseTableNamesArgs) (*database.GetDatabaseTableNamesReply, error)

	// Command ExecuteSQL
	ExecuteSQL(context.Context, *database.ExecuteSQLArgs) (*database.ExecuteSQLReply, error)

	// Event AddDatabase
	AddDatabase(context.Context) (database.AddDatabaseClient, error)
}

The Database domain.

Note: This domain is experimental.

type Debugger

type Debugger interface {
	// 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) error

	// Command Disable
	//
	// Disables debugger for given page.
	Disable(context.Context) error

	// Command SetBreakpointsActive
	//
	// Activates / deactivates all breakpoints on the page.
	SetBreakpointsActive(context.Context, *debugger.SetBreakpointsActiveArgs) error

	// Command SetSkipAllPauses
	//
	// Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
	SetSkipAllPauses(context.Context, *debugger.SetSkipAllPausesArgs) 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 SetBreakpoint
	//
	// Sets JavaScript breakpoint at a given location.
	SetBreakpoint(context.Context, *debugger.SetBreakpointArgs) (*debugger.SetBreakpointReply, error)

	// Command RemoveBreakpoint
	//
	// Removes JavaScript breakpoint.
	RemoveBreakpoint(context.Context, *debugger.RemoveBreakpointArgs) error

	// Command GetPossibleBreakpoints
	//
	// Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
	//
	// Note: This command is experimental.
	GetPossibleBreakpoints(context.Context, *debugger.GetPossibleBreakpointsArgs) (*debugger.GetPossibleBreakpointsReply, error)

	// Command ContinueToLocation
	//
	// Continues execution until specific location is reached.
	ContinueToLocation(context.Context, *debugger.ContinueToLocationArgs) error

	// Command PauseOnAsyncTask
	//
	// Note: This command is experimental.
	PauseOnAsyncTask(context.Context, *debugger.PauseOnAsyncTaskArgs) error

	// Command StepOver
	//
	// Steps over the statement.
	StepOver(context.Context) 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 Pause
	//
	// Stops on the next JavaScript statement.
	Pause(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 Resume
	//
	// Resumes JavaScript execution.
	Resume(context.Context) error

	// Command SearchInContent
	//
	// Searches for given string in script content.
	//
	// Note: This command is experimental.
	SearchInContent(context.Context, *debugger.SearchInContentArgs) (*debugger.SearchInContentReply, error)

	// Command SetScriptSource
	//
	// Edits JavaScript source live.
	SetScriptSource(context.Context, *debugger.SetScriptSourceArgs) (*debugger.SetScriptSourceReply, error)

	// Command RestartFrame
	//
	// Restarts particular call frame from the beginning.
	RestartFrame(context.Context, *debugger.RestartFrameArgs) (*debugger.RestartFrameReply, error)

	// Command GetScriptSource
	//
	// Returns source for the script with given id.
	GetScriptSource(context.Context, *debugger.GetScriptSourceArgs) (*debugger.GetScriptSourceReply, 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 EvaluateOnCallFrame
	//
	// Evaluates expression on a given call frame.
	EvaluateOnCallFrame(context.Context, *debugger.EvaluateOnCallFrameArgs) (*debugger.EvaluateOnCallFrameReply, 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 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 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

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

	// Event ScriptFailedToParse
	//
	// Fired when virtual machine fails to parse the script.
	ScriptFailedToParse(context.Context) (debugger.ScriptFailedToParseClient, 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)
}

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 SetDeviceOrientationOverride
	//
	// Overrides the Device Orientation.
	SetDeviceOrientationOverride(context.Context, *deviceorientation.SetDeviceOrientationOverrideArgs) error

	// Command ClearDeviceOrientationOverride
	//
	// Clears the overridden Device Orientation.
	ClearDeviceOrientationOverride(context.Context) error
}

The DeviceOrientation domain.

Note: This domain is experimental.

type Emulation

type Emulation interface {
	// 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 ClearDeviceMetricsOverride
	//
	// Clears the overridden device metrics.
	ClearDeviceMetricsOverride(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 SetPageScaleFactor
	//
	// Sets a specified page scale factor.
	//
	// Note: This command is experimental.
	SetPageScaleFactor(context.Context, *emulation.SetPageScaleFactorArgs) 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 SetScriptExecutionDisabled
	//
	// Switches script execution in the page.
	SetScriptExecutionDisabled(context.Context, *emulation.SetScriptExecutionDisabledArgs) error

	// Command SetGeolocationOverride
	//
	// Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position unavailable.
	SetGeolocationOverride(context.Context, *emulation.SetGeolocationOverrideArgs) error

	// Command ClearGeolocationOverride
	//
	// Clears the overridden Geolocation Position and Error.
	ClearGeolocationOverride(context.Context) error

	// Command SetTouchEmulationEnabled
	//
	// Enables touch on platforms which do not support them.
	SetTouchEmulationEnabled(context.Context, *emulation.SetTouchEmulationEnabledArgs) 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 SetCPUThrottlingRate
	//
	// Enables CPU throttling to emulate slow CPUs.
	//
	// Note: This command is experimental.
	SetCPUThrottlingRate(context.Context, *emulation.SetCPUThrottlingRateArgs) error

	// Command CanEmulate
	//
	// Tells whether emulation is supported.
	CanEmulate(context.Context) (*emulation.CanEmulateReply, 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 SetNavigatorOverrides
	//
	// Overrides value returned by the javascript navigator object.
	//
	// Note: This command is experimental.
	SetNavigatorOverrides(context.Context, *emulation.SetNavigatorOverridesArgs) 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

	// 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 VirtualTimeAdvanced
	//
	// Notification sent after the virtual time has advanced.
	//
	// Note: This event is experimental.
	VirtualTimeAdvanced(context.Context) (emulation.VirtualTimeAdvancedClient, 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 Enable
	//
	// Enables headless events for the target.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables headless events for the target.
	Disable(context.Context) error

	// 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.
	BeginFrame(context.Context, *headlessexperimental.BeginFrameArgs) (*headlessexperimental.BeginFrameReply, error)

	// Event NeedsBeginFramesChanged
	//
	// Issued when the target starts or stops needing BeginFrames.
	NeedsBeginFramesChanged(context.Context) (headlessexperimental.NeedsBeginFramesChangedClient, error)

	// Event MainFrameReadyForScreenshots
	//
	// Issued when the main frame has first submitted a frame to the browser. May only be fired while a BeginFrame is in flight. Before this event, screenshotting requests may fail.
	MainFrameReadyForScreenshots(context.Context) (headlessexperimental.MainFrameReadyForScreenshotsClient, 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 Enable
	Enable(context.Context) error

	// Command Disable
	Disable(context.Context) error

	// Command StartTrackingHeapObjects
	StartTrackingHeapObjects(context.Context, *heapprofiler.StartTrackingHeapObjectsArgs) error

	// Command StopTrackingHeapObjects
	StopTrackingHeapObjects(context.Context, *heapprofiler.StopTrackingHeapObjectsArgs) error

	// Command TakeHeapSnapshot
	TakeHeapSnapshot(context.Context, *heapprofiler.TakeHeapSnapshotArgs) error

	// Command CollectGarbage
	CollectGarbage(context.Context) error

	// Command GetObjectByHeapObjectID
	GetObjectByHeapObjectID(context.Context, *heapprofiler.GetObjectByHeapObjectIDArgs) (*heapprofiler.GetObjectByHeapObjectIDReply, error)

	// 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 GetHeapObjectID
	GetHeapObjectID(context.Context, *heapprofiler.GetHeapObjectIDArgs) (*heapprofiler.GetHeapObjectIDReply, error)

	// Command StartSampling
	StartSampling(context.Context, *heapprofiler.StartSamplingArgs) error

	// Command StopSampling
	StopSampling(context.Context) (*heapprofiler.StopSamplingReply, error)

	// Command GetSamplingProfile
	GetSamplingProfile(context.Context) (*heapprofiler.GetSamplingProfileReply, error)

	// Event AddHeapSnapshotChunk
	AddHeapSnapshotChunk(context.Context) (heapprofiler.AddHeapSnapshotChunkClient, error)

	// Event ResetProfiles
	ResetProfiles(context.Context) (heapprofiler.ResetProfilesClient, error)

	// Event ReportHeapSnapshotProgress
	ReportHeapSnapshotProgress(context.Context) (heapprofiler.ReportHeapSnapshotProgressClient, 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 HeapStatsUpdate
	//
	// If heap objects tracking has been started then backend may send update for one or more fragments
	HeapStatsUpdate(context.Context) (heapprofiler.HeapStatsUpdateClient, error)
}

The HeapProfiler domain.

Note: This domain is experimental.

type IO

type IO interface {
	// Command Read
	//
	// Read a chunk of the stream
	Read(context.Context, *io.ReadArgs) (*io.ReadReply, error)

	// Command Close
	//
	// Close the stream, discard any temporary backing storage.
	Close(context.Context, *io.CloseArgs) 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 Enable
	//
	// Enables events from backend.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables events from backend.
	Disable(context.Context) error

	// Command RequestDatabaseNames
	//
	// Requests database names for given security origin.
	RequestDatabaseNames(context.Context, *indexeddb.RequestDatabaseNamesArgs) (*indexeddb.RequestDatabaseNamesReply, error)

	// Command RequestDatabase
	//
	// Requests database with given name in given frame.
	RequestDatabase(context.Context, *indexeddb.RequestDatabaseArgs) (*indexeddb.RequestDatabaseReply, error)

	// Command RequestData
	//
	// Requests data from object store or index.
	RequestData(context.Context, *indexeddb.RequestDataArgs) (*indexeddb.RequestDataReply, error)

	// 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
}

The IndexedDB domain.

Note: This domain is experimental.

type Input

type Input interface {
	// Command SetIgnoreInputEvents
	//
	// Ignores input events (useful while auditing page).
	SetIgnoreInputEvents(context.Context, *input.SetIgnoreInputEventsArgs) error

	// Command DispatchKeyEvent
	//
	// Dispatches a key event to the page.
	DispatchKeyEvent(context.Context, *input.DispatchKeyEventArgs) 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 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 Enable
	//
	// Enables inspector domain notifications.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables inspector domain notifications.
	Disable(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)
}

The Inspector domain.

Note: This domain is experimental.

type LayerTree

type LayerTree interface {
	// Command Enable
	//
	// Enables compositing tree inspection.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables compositing tree inspection.
	Disable(context.Context) error

	// Command CompositingReasons
	//
	// Provides the reasons why the given layer was composited.
	CompositingReasons(context.Context, *layertree.CompositingReasonsArgs) (*layertree.CompositingReasonsReply, error)

	// Command MakeSnapshot
	//
	// Returns the layer snapshot identifier.
	MakeSnapshot(context.Context, *layertree.MakeSnapshotArgs) (*layertree.MakeSnapshotReply, error)

	// Command LoadSnapshot
	//
	// Returns the snapshot identifier.
	LoadSnapshot(context.Context, *layertree.LoadSnapshotArgs) (*layertree.LoadSnapshotReply, error)

	// Command ReleaseSnapshot
	//
	// Releases layer snapshot captured by the back-end.
	ReleaseSnapshot(context.Context, *layertree.ReleaseSnapshotArgs) error

	// Command ProfileSnapshot
	ProfileSnapshot(context.Context, *layertree.ProfileSnapshotArgs) (*layertree.ProfileSnapshotReply, 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 LayerTreeDidChange
	LayerTreeDidChange(context.Context) (layertree.DidChangeClient, error)

	// Event LayerPainted
	LayerPainted(context.Context) (layertree.LayerPaintedClient, error)
}

The LayerTree domain.

Note: This domain is experimental.

type Log

type Log interface {
	// 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 Disable
	//
	// Disables log domain, prevents further log entries from being reported to the client.
	Disable(context.Context) error

	// Command Clear
	//
	// Clears the log.
	Clear(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
}

The Memory domain.

Note: This domain is experimental.

type Network

type Network interface {
	// Command Enable
	//
	// Enables network tracking, network events will now be delivered to the client.
	Enable(context.Context, *network.EnableArgs) error

	// Command Disable
	//
	// Disables network tracking, prevents network events from being sent to the client.
	Disable(context.Context) error

	// Command SetUserAgentOverride
	//
	// Allows overriding user agent with the given string.
	SetUserAgentOverride(context.Context, *network.SetUserAgentOverrideArgs) error

	// Command SearchInResponseBody
	//
	// Searches for given string in response content.
	//
	// Note: This command is experimental.
	SearchInResponseBody(context.Context, *network.SearchInResponseBodyArgs) (*network.SearchInResponseBodyReply, error)

	// Command SetExtraHTTPHeaders
	//
	// Specifies whether to always send extra HTTP headers with the requests from this page.
	SetExtraHTTPHeaders(context.Context, *network.SetExtraHTTPHeadersArgs) error

	// Command GetResponseBody
	//
	// Returns content served for the given request.
	GetResponseBody(context.Context, *network.GetResponseBodyArgs) (*network.GetResponseBodyReply, error)

	// Command SetBlockedURLs
	//
	// Blocks URLs from loading.
	//
	// Note: This command is experimental.
	SetBlockedURLs(context.Context, *network.SetBlockedURLsArgs) 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 CanClearBrowserCache
	//
	// Tells whether clearing browser cache is supported.
	CanClearBrowserCache(context.Context) (*network.CanClearBrowserCacheReply, error)

	// Command ClearBrowserCache
	//
	// Clears browser cache.
	ClearBrowserCache(context.Context) error

	// Command CanClearBrowserCookies
	//
	// Tells whether clearing browser cookies is supported.
	CanClearBrowserCookies(context.Context) (*network.CanClearBrowserCookiesReply, error)

	// Command ClearBrowserCookies
	//
	// Clears browser cookies.
	ClearBrowserCookies(context.Context) 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 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 DeleteCookies
	//
	// Deletes browser cookies with matching name and url or domain/path pair.
	DeleteCookies(context.Context, *network.DeleteCookiesArgs) 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 CanEmulateNetworkConditions
	//
	// Tells whether emulation of network conditions is supported.
	CanEmulateNetworkConditions(context.Context) (*network.CanEmulateNetworkConditionsReply, error)

	// Command EmulateNetworkConditions
	//
	// Activates emulation of network conditions.
	EmulateNetworkConditions(context.Context, *network.EmulateNetworkConditionsArgs) error

	// Command SetCacheDisabled
	//
	// Toggles ignoring cache for each request. If true, cache will not be used.
	SetCacheDisabled(context.Context, *network.SetCacheDisabledArgs) error

	// Command SetBypassServiceWorker
	//
	// Toggles ignoring of service worker for each request.
	//
	// Note: This command is experimental.
	SetBypassServiceWorker(context.Context, *network.SetBypassServiceWorkerArgs) error

	// Command SetDataSizeLimitsForTest
	//
	// For testing.
	//
	// Note: This command is experimental.
	SetDataSizeLimitsForTest(context.Context, *network.SetDataSizeLimitsForTestArgs) error

	// Command GetCertificate
	//
	// Returns the DER-encoded certificate.
	//
	// Note: This command is experimental.
	GetCertificate(context.Context, *network.GetCertificateArgs) (*network.GetCertificateReply, 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

	// 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 GetResponseBodyForInterception
	//
	// Returns content served for the given currently intercepted request.
	//
	// Note: This command is experimental.
	GetResponseBodyForInterception(context.Context, *network.GetResponseBodyForInterceptionArgs) (*network.GetResponseBodyForInterceptionReply, error)

	// Event ResourceChangedPriority
	//
	// Fired when resource loading priority is changed
	//
	// Note: This event is experimental.
	ResourceChangedPriority(context.Context) (network.ResourceChangedPriorityClient, error)

	// Event RequestWillBeSent
	//
	// Fired when page is about to send HTTP request.
	RequestWillBeSent(context.Context) (network.RequestWillBeSentClient, error)

	// Event RequestServedFromCache
	//
	// Fired if request ended up loading from cache.
	RequestServedFromCache(context.Context) (network.RequestServedFromCacheClient, error)

	// Event ResponseReceived
	//
	// Fired when HTTP response is available.
	ResponseReceived(context.Context) (network.ResponseReceivedClient, error)

	// Event DataReceived
	//
	// Fired when data chunk was received over the network.
	DataReceived(context.Context) (network.DataReceivedClient, error)

	// Event LoadingFinished
	//
	// Fired when HTTP request has finished loading.
	LoadingFinished(context.Context) (network.LoadingFinishedClient, error)

	// Event LoadingFailed
	//
	// Fired when HTTP request has failed to load.
	LoadingFailed(context.Context) (network.LoadingFailedClient, error)

	// Event WebSocketWillSendHandshakeRequest
	//
	// Fired when WebSocket is about to initiate handshake.
	WebSocketWillSendHandshakeRequest(context.Context) (network.WebSocketWillSendHandshakeRequestClient, error)

	// Event WebSocketHandshakeResponseReceived
	//
	// Fired when WebSocket handshake response becomes available.
	WebSocketHandshakeResponseReceived(context.Context) (network.WebSocketHandshakeResponseReceivedClient, error)

	// Event WebSocketCreated
	//
	// Fired upon WebSocket creation.
	WebSocketCreated(context.Context) (network.WebSocketCreatedClient, error)

	// Event WebSocketClosed
	//
	// Fired when WebSocket is closed.
	WebSocketClosed(context.Context) (network.WebSocketClosedClient, error)

	// Event WebSocketFrameReceived
	//
	// Fired when WebSocket frame is received.
	WebSocketFrameReceived(context.Context) (network.WebSocketFrameReceivedClient, error)

	// Event WebSocketFrameError
	//
	// Fired when WebSocket frame error occurs.
	WebSocketFrameError(context.Context) (network.WebSocketFrameErrorClient, error)

	// Event WebSocketFrameSent
	//
	// Fired when WebSocket frame is sent.
	WebSocketFrameSent(context.Context) (network.WebSocketFrameSentClient, error)

	// Event EventSourceMessageReceived
	//
	// Fired when EventSource message is received.
	EventSourceMessageReceived(context.Context) (network.EventSourceMessageReceivedClient, 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)
}

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 Enable
	//
	// Enables domain notifications.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables domain notifications.
	Disable(context.Context) error

	// Command SetShowPaintRects
	//
	// Requests that backend shows paint rectangles
	SetShowPaintRects(context.Context, *overlay.SetShowPaintRectsArgs) 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 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 SetPausedInDebuggerMessage
	SetPausedInDebuggerMessage(context.Context, *overlay.SetPausedInDebuggerMessageArgs) error

	// Command SetSuspended
	SetSuspended(context.Context, *overlay.SetSuspendedArgs) 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 HighlightRect
	//
	// Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport.
	HighlightRect(context.Context, *overlay.HighlightRectArgs) error

	// Command HighlightQuad
	//
	// Highlights given quad. Coordinates are absolute with respect to the main frame viewport.
	HighlightQuad(context.Context, *overlay.HighlightQuadArgs) 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 HighlightFrame
	//
	// Highlights owner element of the frame with given id.
	HighlightFrame(context.Context, *overlay.HighlightFrameArgs) error

	// Command HideHighlight
	//
	// Hides any highlight.
	HideHighlight(context.Context) error

	// Command GetHighlightObjectForTest
	//
	// For testing.
	GetHighlightObjectForTest(context.Context, *overlay.GetHighlightObjectForTestArgs) (*overlay.GetHighlightObjectForTestReply, error)

	// Event NodeHighlightRequested
	//
	// Fired when the node should be highlighted. This happens after call to setInspectMode.
	NodeHighlightRequested(context.Context) (overlay.NodeHighlightRequestedClient, 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 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 Enable
	//
	// Enables page domain notifications.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables page domain notifications.
	Disable(context.Context) error

	// Command AddScriptToEvaluateOnLoad
	//
	// Deprecated: Please use addScriptToEvaluateOnNewDocument instead.
	//
	// Note: This command is experimental.
	AddScriptToEvaluateOnLoad(context.Context, *page.AddScriptToEvaluateOnLoadArgs) (*page.AddScriptToEvaluateOnLoadReply, error)

	// Command RemoveScriptToEvaluateOnLoad
	//
	// Deprecated: Please use removeScriptToEvaluateOnNewDocument instead.
	//
	// Note: This command is experimental.
	RemoveScriptToEvaluateOnLoad(context.Context, *page.RemoveScriptToEvaluateOnLoadArgs) 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 RemoveScriptToEvaluateOnNewDocument
	//
	// Removes given script from the list.
	RemoveScriptToEvaluateOnNewDocument(context.Context, *page.RemoveScriptToEvaluateOnNewDocumentArgs) error

	// Command SetAutoAttachToCreatedPages
	//
	// Controls whether browser will open a new inspector window for connected pages.
	//
	// Note: This command is experimental.
	SetAutoAttachToCreatedPages(context.Context, *page.SetAutoAttachToCreatedPagesArgs) error

	// Command SetLifecycleEventsEnabled
	//
	// Controls whether page will emit lifecycle events.
	//
	// Note: This command is experimental.
	SetLifecycleEventsEnabled(context.Context, *page.SetLifecycleEventsEnabledArgs) error

	// Command Reload
	//
	// Reloads given page optionally ignoring the cache.
	Reload(context.Context, *page.ReloadArgs) error

	// Command SetAdBlockingEnabled
	//
	// Enable Chrome's experimental ad filter on all sites.
	//
	// Note: This command is experimental.
	SetAdBlockingEnabled(context.Context, *page.SetAdBlockingEnabledArgs) error

	// Command Navigate
	//
	// Navigates current page to the given URL.
	Navigate(context.Context, *page.NavigateArgs) (*page.NavigateReply, error)

	// Command StopLoading
	//
	// Force the page stop all navigations and pending resource fetches.
	StopLoading(context.Context) error

	// Command GetNavigationHistory
	//
	// Returns navigation history for the current page.
	GetNavigationHistory(context.Context) (*page.GetNavigationHistoryReply, error)

	// Command NavigateToHistoryEntry
	//
	// Navigates current page to the given history entry.
	NavigateToHistoryEntry(context.Context, *page.NavigateToHistoryEntryArgs) error

	// Command GetResourceTree
	//
	// Returns present frame / resource tree structure.
	//
	// Note: This command is experimental.
	GetResourceTree(context.Context) (*page.GetResourceTreeReply, error)

	// Command GetFrameTree
	//
	// Returns present frame tree structure.
	GetFrameTree(context.Context) (*page.GetFrameTreeReply, error)

	// Command GetResourceContent
	//
	// Returns content of the given resource.
	//
	// Note: This command is experimental.
	GetResourceContent(context.Context, *page.GetResourceContentArgs) (*page.GetResourceContentReply, error)

	// Command SearchInResource
	//
	// Searches for given string in resource content.
	//
	// Note: This command is experimental.
	SearchInResource(context.Context, *page.SearchInResourceArgs) (*page.SearchInResourceReply, error)

	// Command SetDocumentContent
	//
	// Sets given markup as the document's HTML.
	//
	// Note: This command is experimental.
	SetDocumentContent(context.Context, *page.SetDocumentContentArgs) error

	// Command CaptureScreenshot
	//
	// Capture page screenshot.
	CaptureScreenshot(context.Context, *page.CaptureScreenshotArgs) (*page.CaptureScreenshotReply, error)

	// Command PrintToPDF
	//
	// Print page as PDF.
	PrintToPDF(context.Context, *page.PrintToPDFArgs) (*page.PrintToPDFReply, error)

	// Command StartScreencast
	//
	// Starts sending each frame using the screencastFrame event.
	//
	// Note: This command is experimental.
	StartScreencast(context.Context, *page.StartScreencastArgs) error

	// Command StopScreencast
	//
	// Stops sending each frame in the screencastFrame.
	//
	// Note: This command is experimental.
	StopScreencast(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 HandleJavaScriptDialog
	//
	// Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).
	HandleJavaScriptDialog(context.Context, *page.HandleJavaScriptDialogArgs) error

	// Command GetAppManifest
	GetAppManifest(context.Context) (*page.GetAppManifestReply, error)

	// Command RequestAppBanner
	//
	// Note: This command is experimental.
	RequestAppBanner(context.Context) error

	// Command GetLayoutMetrics
	//
	// Returns metrics relating to the layouting of the page, such as viewport bounds/scale.
	GetLayoutMetrics(context.Context) (*page.GetLayoutMetricsReply, error)

	// Command CreateIsolatedWorld
	//
	// Creates an isolated world for the given frame.
	CreateIsolatedWorld(context.Context, *page.CreateIsolatedWorldArgs) (*page.CreateIsolatedWorldReply, error)

	// Command BringToFront
	//
	// Brings page to front (activates tab).
	BringToFront(context.Context) error

	// Command SetDownloadBehavior
	//
	// Set the behavior when downloading a file.
	//
	// Note: This command is experimental.
	SetDownloadBehavior(context.Context, *page.SetDownloadBehaviorArgs) error

	// Event DOMContentEventFired
	DOMContentEventFired(context.Context) (page.DOMContentEventFiredClient, error)

	// Event LoadEventFired
	LoadEventFired(context.Context) (page.LoadEventFiredClient, error)

	// Event LifecycleEvent
	//
	// Fired for top level page lifecycle events such as navigation, load, paint, etc.
	LifecycleEvent(context.Context) (page.LifecycleEventClient, error)

	// Event FrameAttached
	//
	// Fired when frame has been attached to its parent.
	FrameAttached(context.Context) (page.FrameAttachedClient, error)

	// Event FrameNavigated
	//
	// Fired once navigation of the frame has completed. Frame is now associated with the new loader.
	FrameNavigated(context.Context) (page.FrameNavigatedClient, error)

	// Event FrameDetached
	//
	// Fired when frame has been detached from its parent.
	FrameDetached(context.Context) (page.FrameDetachedClient, 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 FrameScheduledNavigation
	//
	// Fired when frame schedules a potential navigation.
	//
	// Note: This event is experimental.
	FrameScheduledNavigation(context.Context) (page.FrameScheduledNavigationClient, error)

	// Event FrameClearedScheduledNavigation
	//
	// Fired when frame no longer has a scheduled navigation.
	//
	// Note: This event is experimental.
	FrameClearedScheduledNavigation(context.Context) (page.FrameClearedScheduledNavigationClient, error)

	// Event FrameResized
	//
	// Note: This event is experimental.
	FrameResized(context.Context) (page.FrameResizedClient, 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 JavascriptDialogClosed
	//
	// Fired when a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload) has been closed.
	JavascriptDialogClosed(context.Context) (page.JavascriptDialogClosedClient, 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 InterstitialShown
	//
	// Fired when interstitial page was shown
	InterstitialShown(context.Context) (page.InterstitialShownClient, error)

	// Event InterstitialHidden
	//
	// Fired when interstitial page was hidden
	InterstitialHidden(context.Context) (page.InterstitialHiddenClient, 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)
}

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 Enable
	//
	// Enable collecting and reporting metrics.
	Enable(context.Context) error

	// Command Disable
	//
	// Disable collecting and reporting metrics.
	Disable(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 Enable
	Enable(context.Context) error

	// Command Disable
	Disable(context.Context) 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 Stop
	Stop(context.Context) (*profiler.StopReply, 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.
	//
	// Note: This command is experimental.
	StartPreciseCoverage(context.Context, *profiler.StartPreciseCoverageArgs) error

	// Command StopPreciseCoverage
	//
	// Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code.
	//
	// Note: This command is experimental.
	StopPreciseCoverage(context.Context) error

	// Command TakePreciseCoverage
	//
	// Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started.
	//
	// Note: This command is experimental.
	TakePreciseCoverage(context.Context) (*profiler.TakePreciseCoverageReply, error)

	// Command GetBestEffortCoverage
	//
	// Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.
	//
	// Note: This command is experimental.
	GetBestEffortCoverage(context.Context) (*profiler.GetBestEffortCoverageReply, error)

	// Command StartTypeProfile
	//
	// Enable type profile.
	//
	// Note: This command is experimental.
	StartTypeProfile(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 TakeTypeProfile
	//
	// Collect type profile.
	//
	// Note: This command is experimental.
	TakeTypeProfile(context.Context) (*profiler.TakeTypeProfileReply, error)

	// Event ConsoleProfileStarted
	//
	// Sent when new profile recording is started using console.profile() call.
	ConsoleProfileStarted(context.Context) (profiler.ConsoleProfileStartedClient, error)

	// Event ConsoleProfileFinished
	ConsoleProfileFinished(context.Context) (profiler.ConsoleProfileFinishedClient, error)
}

The Profiler domain.

type Runtime

type Runtime interface {
	// Command Evaluate
	//
	// Evaluates expression on global object.
	Evaluate(context.Context, *runtime.EvaluateArgs) (*runtime.EvaluateReply, error)

	// 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 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 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 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 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 SetCustomObjectFormatterEnabled
	//
	// Note: This command is experimental.
	SetCustomObjectFormatterEnabled(context.Context, *runtime.SetCustomObjectFormatterEnabledArgs) error

	// Command CompileScript
	//
	// Compiles expression.
	CompileScript(context.Context, *runtime.CompileScriptArgs) (*runtime.CompileScriptReply, error)

	// Command RunScript
	//
	// Runs script with given id in a given context.
	RunScript(context.Context, *runtime.RunScriptArgs) (*runtime.RunScriptReply, error)

	// Command QueryObjects
	//
	// Note: This command is experimental.
	QueryObjects(context.Context, *runtime.QueryObjectsArgs) (*runtime.QueryObjectsReply, error)

	// Command GlobalLexicalScopeNames
	//
	// Returns all let, const and class variables from global scope.
	//
	// Note: This command is experimental.
	GlobalLexicalScopeNames(context.Context, *runtime.GlobalLexicalScopeNamesArgs) (*runtime.GlobalLexicalScopeNamesReply, 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 ExceptionThrown
	//
	// Issued when exception was thrown and unhandled.
	ExceptionThrown(context.Context) (runtime.ExceptionThrownClient, error)

	// Event ExceptionRevoked
	//
	// Issued when unhandled exception was revoked.
	ExceptionRevoked(context.Context) (runtime.ExceptionRevokedClient, error)

	// Event ConsoleAPICalled
	//
	// Issued when console API was called.
	ConsoleAPICalled(context.Context) (runtime.ConsoleAPICalledClient, 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 Schema

type Schema interface {
	// Command GetDomains
	//
	// Returns supported domains.
	GetDomains(context.Context) (*schema.GetDomainsReply, error)
}

The Schema domain. Provides information about the protocol schema.

type Security

type Security interface {
	// Command Enable
	//
	// Enables tracking security state changes.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables tracking security state changes.
	Disable(context.Context) error

	// Command HandleCertificateError
	//
	// Handles a certificate error that fired a certificateError event.
	HandleCertificateError(context.Context, *security.HandleCertificateErrorArgs) error

	// Command SetOverrideCertificateErrors
	//
	// 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 SecurityStateChanged
	//
	// The security state of the page changed.
	SecurityStateChanged(context.Context) (security.StateChangedClient, error)

	// Event CertificateError
	//
	// 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.
	CertificateError(context.Context) (security.CertificateErrorClient, error)
}

The Security domain. Security

type ServiceWorker

type ServiceWorker interface {
	// Command Enable
	Enable(context.Context) error

	// Command Disable
	Disable(context.Context) error

	// Command Unregister
	Unregister(context.Context, *serviceworker.UnregisterArgs) error

	// Command UpdateRegistration
	UpdateRegistration(context.Context, *serviceworker.UpdateRegistrationArgs) error

	// Command StartWorker
	StartWorker(context.Context, *serviceworker.StartWorkerArgs) error

	// Command SkipWaiting
	SkipWaiting(context.Context, *serviceworker.SkipWaitingArgs) error

	// Command StopWorker
	StopWorker(context.Context, *serviceworker.StopWorkerArgs) error

	// Command StopAllWorkers
	StopAllWorkers(context.Context) error

	// Command InspectWorker
	InspectWorker(context.Context, *serviceworker.InspectWorkerArgs) error

	// Command SetForceUpdateOnPageLoad
	SetForceUpdateOnPageLoad(context.Context, *serviceworker.SetForceUpdateOnPageLoadArgs) error

	// Command DeliverPushMessage
	DeliverPushMessage(context.Context, *serviceworker.DeliverPushMessageArgs) error

	// Command DispatchSyncEvent
	DispatchSyncEvent(context.Context, *serviceworker.DispatchSyncEventArgs) error

	// Event WorkerRegistrationUpdated
	WorkerRegistrationUpdated(context.Context) (serviceworker.WorkerRegistrationUpdatedClient, error)

	// Event WorkerVersionUpdated
	WorkerVersionUpdated(context.Context) (serviceworker.WorkerVersionUpdatedClient, error)

	// Event WorkerErrorReported
	WorkerErrorReported(context.Context) (serviceworker.WorkerErrorReportedClient, 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 UntrackCacheStorageForOrigin
	//
	// Unregisters origin from receiving notifications for cache storage.
	UntrackCacheStorageForOrigin(context.Context, *storage.UntrackCacheStorageForOriginArgs) error

	// Command TrackIndexedDBForOrigin
	//
	// Registers origin to be notified when an update occurs to its IndexedDB.
	TrackIndexedDBForOrigin(context.Context, *storage.TrackIndexedDBForOriginArgs) error

	// Command UntrackIndexedDBForOrigin
	//
	// Unregisters origin from receiving notifications for IndexedDB.
	UntrackIndexedDBForOrigin(context.Context, *storage.UntrackIndexedDBForOriginArgs) error

	// Event CacheStorageListUpdated
	//
	// A cache has been added/deleted.
	CacheStorageListUpdated(context.Context) (storage.CacheStorageListUpdatedClient, error)

	// Event CacheStorageContentUpdated
	//
	// A cache's contents have been modified.
	CacheStorageContentUpdated(context.Context) (storage.CacheStorageContentUpdatedClient, error)

	// Event IndexedDBListUpdated
	//
	// The origin's IndexedDB database list has been modified.
	IndexedDBListUpdated(context.Context) (storage.IndexedDBListUpdatedClient, error)

	// Event IndexedDBContentUpdated
	//
	// The origin's IndexedDB object store has been modified.
	IndexedDBContentUpdated(context.Context) (storage.IndexedDBContentUpdatedClient, 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 SetDiscoverTargets
	//
	// Controls whether to discover available targets and notify via targetCreated/targetInfoChanged/targetDestroyed events.
	SetDiscoverTargets(context.Context, *target.SetDiscoverTargetsArgs) 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.
	SetAutoAttach(context.Context, *target.SetAutoAttachArgs) error

	// Command SetAttachToFrames
	//
	// Note: This command is experimental.
	SetAttachToFrames(context.Context, *target.SetAttachToFramesArgs) 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

	// Command SendMessageToTarget
	//
	// Sends protocol message over session with given id.
	SendMessageToTarget(context.Context, *target.SendMessageToTargetArgs) error

	// Command GetTargetInfo
	//
	// Returns information about a target.
	GetTargetInfo(context.Context, *target.GetTargetInfoArgs) (*target.GetTargetInfoReply, error)

	// Command ActivateTarget
	//
	// Activates (focuses) the target.
	ActivateTarget(context.Context, *target.ActivateTargetArgs) 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 AttachToTarget
	//
	// Attaches to the target with given id.
	AttachToTarget(context.Context, *target.AttachToTargetArgs) (*target.AttachToTargetReply, error)

	// Command DetachFromTarget
	//
	// Detaches session with given id.
	DetachFromTarget(context.Context, *target.DetachFromTargetArgs) 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 DisposeBrowserContext
	//
	// Deletes a BrowserContext, will fail of any open page uses it.
	//
	// Note: This command is experimental.
	DisposeBrowserContext(context.Context, *target.DisposeBrowserContextArgs) (*target.DisposeBrowserContextReply, error)

	// Command CreateTarget
	//
	// Creates a new page.
	CreateTarget(context.Context, *target.CreateTargetArgs) (*target.CreateTargetReply, error)

	// Command GetTargets
	//
	// Retrieves a list of available targets.
	GetTargets(context.Context) (*target.GetTargetsReply, error)

	// Event TargetCreated
	//
	// Issued when a possible inspection target is created.
	TargetCreated(context.Context) (target.CreatedClient, 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)

	// Event TargetDestroyed
	//
	// Issued when a target is destroyed.
	TargetDestroyed(context.Context) (target.DestroyedClient, error)

	// Event AttachedToTarget
	//
	// Issued when attached to target because of auto-attach or attachToTarget command.
	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.
	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)
}

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 Start
	//
	// Start trace events collection.
	Start(context.Context, *tracing.StartArgs) error

	// Command End
	//
	// Stop trace events collection.
	End(context.Context) error

	// Command GetCategories
	//
	// Gets supported tracing categories.
	GetCategories(context.Context) (*tracing.GetCategoriesReply, error)

	// Command RequestMemoryDump
	//
	// Request a global memory dump.
	RequestMemoryDump(context.Context) (*tracing.RequestMemoryDumpReply, error)

	// Command RecordClockSyncMarker
	//
	// Record a clock sync marker in the trace.
	RecordClockSyncMarker(context.Context, *tracing.RecordClockSyncMarkerArgs) 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)

	// Event BufferUsage
	BufferUsage(context.Context) (tracing.BufferUsageClient, 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
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.

Jump to

Keyboard shortcuts

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