cdp

package module
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 50 Imported by: 79

README

cdp

Build Status Coverage Status Go Report Card GoDoc

Package cdp provides type-safe bindings for the Chrome DevTools 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 DevTools Protocol, Safari, etc.) that implement the protocol.

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

A big motivation for cdp is to expose the full functionality of the Chrome DevTools 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 DevTools 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, logging and incognito 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 (
	"bufio"
	"context"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"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 DevTools 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, 0o644); err != nil {
		return err
	}

	fmt.Printf("Saved screenshot: %s\n", screenshotName)

	pdfName := "page.pdf"
	f, err := os.Create(pdfName)
	if err != nil {
		return err
	}

	pdfArgs := page.NewPrintToPDFArgs().
		SetTransferMode("ReturnAsStream") // Request stream.
	pdfData, err := c.Page.PrintToPDF(ctx, pdfArgs)
	if err != nil {
		return err
	}

	sr := c.NewIOStreamReader(ctx, *pdfData.Stream)
	r := bufio.NewReader(sr)

	// Write to file in ~r.Size() chunks.
	_, err = r.WriteTo(f)
	if err != nil {
		return err
	}

	err = f.Close()
	if err != nil {
		return err
	}

	fmt.Printf("Saved PDF: %s\n", pdfName)

	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 decisions 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 DevTools 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 DevTools 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 DevTools Protocol:

err := c.Page.Enable(ctx)
if err != nil {
	// Handle error.
}
// ...

Calling Enable can result in immediate event transmissions. If these events are important, an event client should be created before calling Enable.

Wait for an event by calling Recv:

ev, err := domContentEventFired.Recv()
if err != nil {
	// Handle error.
}
// ...

The Ready channel can be used to check for pending events or coordinating between multiple event handlers:

go func() {
	select {
	case <-domContentEventFired.Ready():
		_, err := domContentEventFired.Recv() // Does not block here.
		if err != nil {
			// Handle error.
		}
	case <-loadEventFired.Ready():
		// Handle loadEventFired.
	}
}()
// ...

Ready must not be called concurrently while relying on the non-blocking behavior of Recv.

Event clients can be synchronized, relative to each other, when the order of events is important:

err := cdp.Sync(domContentEventFired, loadEventFired)
if err != nil {
	// Handle error.
}

Use the Ready channel to detect which synchronized event client is ready to Recv.

The session package can be used to control multiple targets (e.g. pages) with a single websocket connection.

c := cdp.NewClient(conn) // conn created via rpcc.Dial.
m, err := session.NewManager(c)
if err != nil {
	// Handle error.
}
defer m.Close()

newPage, err := c.Target.CreateTarget(context.TODO(),
	target.NewCreateTargetArgs("about:blank"))
if err != nil {
	// Handle error.
}

// newPageConn uses the underlying conn without establishing a new
// websocket connection.
newPageConn, err := m.Dial(context.TODO(), newPage.TargetID)
if err != nil {
	// Handle error.
}
defer newPageConn.Close()

newPageClient := cdp.NewClient(newPageConn)
// ...
Example
package main

import (
	"bufio"
	"context"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"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 DevTools 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, 0o644); err != nil {
		return err
	}

	fmt.Printf("Saved screenshot: %s\n", screenshotName)

	pdfName := "page.pdf"
	f, err := os.Create(pdfName)
	if err != nil {
		return err
	}

	pdfArgs := page.NewPrintToPDFArgs().
		SetTransferMode("ReturnAsStream") // Request stream.
	pdfData, err := c.Page.PrintToPDF(ctx, pdfArgs)
	if err != nil {
		return err
	}

	sr := c.NewIOStreamReader(ctx, *pdfData.Stream)
	r := bufio.NewReader(sr)

	// Write to file in ~r.Size() chunks.
	_, err = r.WriteTo(f)
	if err != nil {
		return err
	}

	err = f.Close()
	if err != nil {
		return err
	}

	fmt.Printf("Saved PDF: %s\n", pdfName)

	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 DevTools 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, nil) },
		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 (Dial_using_alternative_websocket_implementation)
package main

import (
	"context"
	"fmt"
	"io"
	"log"

	"nhooyr.io/websocket"

	"github.com/mafredri/cdp"
	"github.com/mafredri/cdp/devtool"
	"github.com/mafredri/cdp/protocol/runtime"
	"github.com/mafredri/cdp/rpcc"
)

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	devt := devtool.New("http://localhost:9222")
	page, err := devt.CreateURL(ctx, "about:blank")
	if err != nil {
		log.Println(err)
	}

	// Dial using an alternative websocket implementation.
	//
	// Note that this disables functionality like:
	//
	// - Safety measure against writing fragmented websocket messages
	// - Setting compression level after dial
	dialer := rpcc.WithDialer(func(dialCtx context.Context, addr string) (io.ReadWriteCloser, error) {
		log.Println(addr)
		conn, _, err := websocket.Dial(dialCtx, addr, &websocket.DialOptions{
			CompressionMode: websocket.CompressionContextTakeover,
		})
		if err != nil {
			return nil, err
		}
		// Note that we cannot use dialCtx here since websocket.NetConn
		// binds to the lifetime of ctx.
		return websocket.NetConn(ctx, conn, websocket.MessageText), nil
	})
	conn, err := rpcc.Dial(page.WebSocketDebuggerURL, dialer)
	if err != nil {
		log.Println(err)
	}
	defer conn.Close()

	// Use the connection that uses nhooyr.io/websocket underneath.
	c := cdp.NewClient(conn)

	if err = c.Runtime.Enable(ctx); err != nil {
		log.Println(err)
	}
	eval, err := c.Runtime.Evaluate(ctx, runtime.NewEvaluateArgs(`document.location.href`).SetReturnByValue(true))
	if err == nil && eval.ExceptionDetails != nil {
		err = eval.ExceptionDetails
	}
	if err != nil {
		log.Println(err)
	}
	fmt.Println(eval.Result.String())

	err = devt.Close(ctx, page)
	if err != nil {
		log.Println(err)
	}
}
Output:

"about:blank"
Example (Incognito)
package main

import (
	"context"
	"encoding/json"
	"errors"
	"fmt"

	"github.com/mafredri/cdp"
	"github.com/mafredri/cdp/devtool"
	"github.com/mafredri/cdp/protocol/page"
	"github.com/mafredri/cdp/protocol/runtime"
	"github.com/mafredri/cdp/protocol/target"
	"github.com/mafredri/cdp/rpcc"
	"github.com/mafredri/cdp/session"
)

func main() {
	err := func() error {
		ctx, cancel := context.WithCancel(context.Background())
		defer cancel()

		// Fetch the websocket URL for the browser endpoint.
		bver, err := devtool.New("http://localhost:9222").Version(ctx)
		if err != nil {
			return err
		}
		bconn, err := rpcc.DialContext(ctx, bver.WebSocketDebuggerURL)
		if err != nil {
			return err
		}
		defer bconn.Close()

		// Initialize the browser CDP client.
		bc := cdp.NewClient(bconn)

		// Initialize session manager for connecting to targets.
		sess, err := session.NewManager(bc)
		if err != nil {
			return err
		}
		defer sess.Close()

		// Create the new browser context, similar to a new incognito
		// window.
		createCtx, err := bc.Target.CreateBrowserContext(ctx, target.NewCreateBrowserContextArgs())
		if err != nil {
			return err
		}

		// Create a new target belonging to the browser context, similar
		// to opening a new tab in an incognito window.
		createTargetArgs := target.NewCreateTargetArgs("about:blank").
			SetBrowserContextID(createCtx.BrowserContextID)
		createTarget, err := bc.Target.CreateTarget(ctx, createTargetArgs)
		if err != nil {
			return err
		}

		// Connect to target using the existing websocket connection.
		conn, err := sess.Dial(ctx, createTarget.TargetID)
		if err != nil {
			return err
		}
		defer conn.Close()

		// This cdp client controls the "incognito tab".
		c := cdp.NewClient(conn)

		err = c.Page.Enable(ctx)
		if err != nil {
			return err
		}

		url := "https://github.com/mafredri/cdp"
		nav, err := c.Page.Navigate(ctx, page.NewNavigateArgs(url))
		if err != nil {
			return err
		}

		if nav.ErrorText != nil {
			return errors.New("navigation failed: " + *nav.ErrorText)
		}

		// Check the window.location for validation.
		eval, err := c.Runtime.Evaluate(ctx, runtime.NewEvaluateArgs("window.location.toString();"))
		if err != nil {
			return err
		}
		if eval.ExceptionDetails != nil {
			return eval.ExceptionDetails
		}
		var winloc string
		err = json.Unmarshal(eval.Result.Value, &winloc)
		if err != nil {
			return err
		}

		fmt.Printf("Navigated to %s inside an incognito tab!\n", winloc)

		// Close the tab when we are done with it (this is a requirement
		// for closing the browser context).
		closeReply, err := bc.Target.CloseTarget(ctx, target.NewCloseTargetArgs(createTarget.TargetID))
		if err != nil {
			return err
		}
		if !closeReply.Success {
			return errors.New("could not close target: " + string(createTarget.TargetID))
		}

		// Dispose of browser context (a.k.a. incognito window), this
		// will fail if not all targets in this context are closed
		// beforehand.
		err = bc.Target.DisposeBrowserContext(ctx, target.NewDisposeBrowserContextArgs(createCtx.BrowserContextID))
		if err != nil {
			return err
		}

		return nil
	}()
	if err != nil {
		fmt.Println(err)
	}
}
Output:

Navigated to https://github.com/mafredri/cdp inside an incognito tab!
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 deprecated

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.

Deprecated: Use errors.Unwrap, errors.Is or errors.As instead.

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 Disable
	//
	// Disables the accessibility domain.
	Disable(context.Context) error

	// Command Enable
	//
	// Enables the accessibility domain which causes `AXNodeId`s to remain
	// consistent between method calls. This turns on accessibility for the
	// page, which can impact performance until accessibility is disabled.
	Enable(context.Context) error

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

	// Command GetFullAXTree
	//
	// Fetches the entire accessibility tree for the root Document
	//
	// Note: This command is experimental.
	GetFullAXTree(context.Context, *accessibility.GetFullAXTreeArgs) (*accessibility.GetFullAXTreeReply, error)

	// Command GetRootAXNode
	//
	// Fetches the root node. Requires `enable()` to have been called
	// previously.
	//
	// Note: This command is experimental.
	GetRootAXNode(context.Context, *accessibility.GetRootAXNodeArgs) (*accessibility.GetRootAXNodeReply, error)

	// Command GetAXNodeAndAncestors
	//
	// Fetches a node and all ancestors up to and including the root.
	// Requires `enable()` to have been called previously.
	//
	// Note: This command is experimental.
	GetAXNodeAndAncestors(context.Context, *accessibility.GetAXNodeAndAncestorsArgs) (*accessibility.GetAXNodeAndAncestorsReply, error)

	// Command GetChildAXNodes
	//
	// Fetches a particular accessibility node by AXNodeId. Requires
	// `enable()` to have been called previously.
	//
	// Note: This command is experimental.
	GetChildAXNodes(context.Context, *accessibility.GetChildAXNodesArgs) (*accessibility.GetChildAXNodesReply, error)

	// Command QueryAXTree
	//
	// Query a DOM node's accessibility subtree for accessible name and
	// role. This command computes the name and role for all nodes in the
	// subtree, including those that are ignored for accessibility, and
	// returns those that mactch the specified name and role. If no DOM
	// node is specified, or the DOM node does not exist, the command
	// returns an error. If neither `accessibleName` or `role` is
	// specified, it returns all the accessibility nodes in the subtree.
	//
	// Note: This command is experimental.
	QueryAXTree(context.Context, *accessibility.QueryAXTreeArgs) (*accessibility.QueryAXTreeReply, error)

	// Event LoadComplete
	//
	// The loadComplete event mirrors the load complete event sent by the
	// browser to assistive technology when the web page has finished
	// loading.
	//
	// Note: This event is experimental.
	LoadComplete(context.Context) (accessibility.LoadCompleteClient, error)

	// Event NodesUpdated
	//
	// The nodesUpdated event is sent every time a previously requested
	// node has changed the in tree.
	//
	// Note: This event is experimental.
	NodesUpdated(context.Context) (accessibility.NodesUpdatedClient, error)
}

The Accessibility domain.

Note: This domain is experimental.

type Animation

type Animation interface {
	// Command Disable
	//
	// Disables animation domain notifications.
	Disable(context.Context) error

	// Command Enable
	//
	// Enables animation domain notifications.
	Enable(context.Context) error

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

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

	// Command ReleaseAnimations
	//
	// Releases a set of animations to no longer be manipulated.
	ReleaseAnimations(context.Context, *animation.ReleaseAnimationsArgs) error

	// Command ResolveAnimation
	//
	// Gets the remote object of the Animation.
	ResolveAnimation(context.Context, *animation.ResolveAnimationArgs) (*animation.ResolveAnimationReply, error)

	// Command SeekAnimations
	//
	// Seek a set of animations to a particular time within each
	// animation.
	SeekAnimations(context.Context, *animation.SeekAnimationsArgs) error

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

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

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

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

	// Event AnimationCreated
	//
	// Event for each animation that has been created.
	AnimationCreated(context.Context) (animation.CreatedClient, error)

	// Event AnimationStarted
	//
	// Event for animation that has been started.
	AnimationStarted(context.Context) (animation.StartedClient, error)
}

The Animation domain.

Note: This domain is experimental.

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

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

	// Command Enable
	//
	// Enables issues domain, sends the issues collected so far to the
	// client by means of the `issueAdded` event.
	Enable(context.Context) error

	// Command CheckContrast
	//
	// Runs the contrast check for the target page. Found issues are
	// reported using Audits.issueAdded event.
	CheckContrast(context.Context, *audits.CheckContrastArgs) error

	// Event IssueAdded
	IssueAdded(context.Context) (audits.IssueAddedClient, error)
}

The Audits domain. Audits domain allows investigation of page violations and possible improvements.

Note: This domain is experimental.

type BackgroundService added in v0.22.0

type BackgroundService interface {
	// Command StartObserving
	//
	// Enables event updates for the service.
	StartObserving(context.Context, *backgroundservice.StartObservingArgs) error

	// Command StopObserving
	//
	// Disables event updates for the service.
	StopObserving(context.Context, *backgroundservice.StopObservingArgs) error

	// Command SetRecording
	//
	// Set the recording state for the service.
	SetRecording(context.Context, *backgroundservice.SetRecordingArgs) error

	// Command ClearEvents
	//
	// Clears all stored data for the service.
	ClearEvents(context.Context, *backgroundservice.ClearEventsArgs) error

	// Event RecordingStateChanged
	//
	// Called when the recording state for the service has been updated.
	RecordingStateChanged(context.Context) (backgroundservice.RecordingStateChangedClient, error)

	// Event BackgroundServiceEventReceived
	//
	// Called with all existing backgroundServiceEvents when enabled, and
	// all new events afterwards if enabled and recording.
	BackgroundServiceEventReceived(context.Context) (backgroundservice.EventReceivedClient, error)
}

The BackgroundService domain. Defines events for background web platform features.

Note: This domain is experimental.

type Browser

type Browser interface {
	// Command SetPermission
	//
	// Set permission settings for given origin.
	//
	// Note: This command is experimental.
	SetPermission(context.Context, *browser.SetPermissionArgs) error

	// Command GrantPermissions
	//
	// Grant specific permissions to the given origin and reject all
	// others.
	//
	// Note: This command is experimental.
	GrantPermissions(context.Context, *browser.GrantPermissionsArgs) error

	// Command ResetPermissions
	//
	// Reset all permission management for all origins.
	//
	// Note: This command is experimental.
	ResetPermissions(context.Context, *browser.ResetPermissionsArgs) error

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

	// Command CancelDownload
	//
	// Cancel a download if in progress
	//
	// Note: This command is experimental.
	CancelDownload(context.Context, *browser.CancelDownloadArgs) error

	// Command Close
	//
	// Close browser gracefully.
	Close(context.Context) error

	// Command Crash
	//
	// Crashes browser on the main thread.
	//
	// Note: This command is experimental.
	Crash(context.Context) error

	// Command CrashGPUProcess
	//
	// Crashes GPU process.
	//
	// Note: This command is experimental.
	CrashGPUProcess(context.Context) error

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

	// Command GetBrowserCommandLine
	//
	// Returns the command line switches for the browser process if, and
	// only if --enable-automation is on the commandline.
	//
	// Note: This command is experimental.
	GetBrowserCommandLine(context.Context) (*browser.GetBrowserCommandLineReply, error)

	// Command GetHistograms
	//
	// Get Chrome histograms.
	//
	// Note: This command is experimental.
	GetHistograms(context.Context, *browser.GetHistogramsArgs) (*browser.GetHistogramsReply, error)

	// Command GetHistogram
	//
	// Get a Chrome histogram by name.
	//
	// Note: This command is experimental.
	GetHistogram(context.Context, *browser.GetHistogramArgs) (*browser.GetHistogramReply, error)

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

	// Command GetWindowForTarget
	//
	// Get the browser window that contains the devtools target.
	//
	// Note: This command is experimental.
	GetWindowForTarget(context.Context, *browser.GetWindowForTargetArgs) (*browser.GetWindowForTargetReply, error)

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

	// Command SetDockTile
	//
	// Set dock tile details, platform-specific.
	//
	// Note: This command is experimental.
	SetDockTile(context.Context, *browser.SetDockTileArgs) error

	// Command ExecuteBrowserCommand
	//
	// Invoke custom browser commands used by telemetry.
	//
	// Note: This command is experimental.
	ExecuteBrowserCommand(context.Context, *browser.ExecuteBrowserCommandArgs) error

	// Event DownloadWillBegin
	//
	// Fired when page is about to start a download.
	//
	// Note: This event is experimental.
	DownloadWillBegin(context.Context) (browser.DownloadWillBeginClient, error)

	// Event DownloadProgress
	//
	// Fired when download makes progress. Last call has |done| == true.
	//
	// Note: This event is experimental.
	DownloadProgress(context.Context) (browser.DownloadProgressClient, error)
}

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

type CSS

type CSS interface {
	// Command AddRule
	//
	// Inserts a new rule with the given `ruleText` in a stylesheet with
	// given `styleSheetId`, at the position specified by `location`.
	AddRule(context.Context, *css.AddRuleArgs) (*css.AddRuleReply, error)

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

	// Command CreateStyleSheet
	//
	// Creates a new special "via-inspector" stylesheet in the frame with
	// given `frameId`.
	CreateStyleSheet(context.Context, *css.CreateStyleSheetArgs) (*css.CreateStyleSheetReply, error)

	// Command Disable
	//
	// Disables the CSS agent for the given page.
	Disable(context.Context) error

	// Command Enable
	//
	// Enables the CSS agent for the given page. Clients should not assume
	// that the CSS agent has been enabled until the result of this command
	// is received.
	Enable(context.Context) error

	// Command ForcePseudoState
	//
	// Ensures that the given node will have specified pseudo-classes
	// whenever its style is computed by the browser.
	ForcePseudoState(context.Context, *css.ForcePseudoStateArgs) error

	// Command GetBackgroundColors
	GetBackgroundColors(context.Context, *css.GetBackgroundColorsArgs) (*css.GetBackgroundColorsReply, error)

	// Command GetComputedStyleForNode
	//
	// Returns the computed style for a DOM node identified by `nodeId`.
	GetComputedStyleForNode(context.Context, *css.GetComputedStyleForNodeArgs) (*css.GetComputedStyleForNodeReply, error)

	// Command GetInlineStylesForNode
	//
	// Returns the styles defined inline (explicitly in the "style"
	// attribute and implicitly, using DOM attributes) for a DOM node
	// identified by `nodeId`.
	GetInlineStylesForNode(context.Context, *css.GetInlineStylesForNodeArgs) (*css.GetInlineStylesForNodeReply, error)

	// Command GetMatchedStylesForNode
	//
	// Returns requested styles for a DOM node identified by `nodeId`.
	GetMatchedStylesForNode(context.Context, *css.GetMatchedStylesForNodeArgs) (*css.GetMatchedStylesForNodeReply, error)

	// Command GetMediaQueries
	//
	// Returns all media queries parsed by the rendering engine.
	GetMediaQueries(context.Context) (*css.GetMediaQueriesReply, error)

	// Command GetPlatformFontsForNode
	//
	// Requests information about platform fonts which we used to render
	// child TextNodes in the given node.
	GetPlatformFontsForNode(context.Context, *css.GetPlatformFontsForNodeArgs) (*css.GetPlatformFontsForNodeReply, error)

	// Command GetStyleSheetText
	//
	// Returns the current textual content for a stylesheet.
	GetStyleSheetText(context.Context, *css.GetStyleSheetTextArgs) (*css.GetStyleSheetTextReply, error)

	// Command GetLayersForNode
	//
	// Returns all layers parsed by the rendering engine for the tree
	// scope of a node. Given a DOM element identified by nodeId,
	// getLayersForNode returns the root layer for the nearest ancestor
	// document or shadow root. The layer root contains the full layer tree
	// for the tree scope and their ordering.
	//
	// Note: This command is experimental.
	GetLayersForNode(context.Context, *css.GetLayersForNodeArgs) (*css.GetLayersForNodeReply, error)

	// Command TrackComputedStyleUpdates
	//
	// Starts tracking the given computed styles for updates. The
	// specified array of properties replaces the one previously specified.
	// Pass empty array to disable tracking. Use takeComputedStyleUpdates
	// to retrieve the list of nodes that had properties modified. The
	// changes to computed style properties are only tracked for nodes
	// pushed to the front-end by the DOM agent. If no changes to the
	// tracked properties occur after the node has been pushed to the
	// front-end, no updates will be issued for the node.
	//
	// Note: This command is experimental.
	TrackComputedStyleUpdates(context.Context, *css.TrackComputedStyleUpdatesArgs) error

	// Command TakeComputedStyleUpdates
	//
	// Polls the next batch of computed style updates.
	//
	// Note: This command is experimental.
	TakeComputedStyleUpdates(context.Context) (*css.TakeComputedStyleUpdatesReply, error)

	// Command SetEffectivePropertyValueForNode
	//
	// Find a rule with the given active property for the given node and
	// set the new value for this property
	SetEffectivePropertyValueForNode(context.Context, *css.SetEffectivePropertyValueForNodeArgs) error

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

	// Command SetMediaText
	//
	// Modifies the rule selector.
	SetMediaText(context.Context, *css.SetMediaTextArgs) (*css.SetMediaTextReply, error)

	// Command SetContainerQueryText
	//
	// Modifies the expression of a container query.
	//
	// Note: This command is experimental.
	SetContainerQueryText(context.Context, *css.SetContainerQueryTextArgs) (*css.SetContainerQueryTextReply, error)

	// Command SetSupportsText
	//
	// Modifies the expression of a supports at-rule.
	//
	// Note: This command is experimental.
	SetSupportsText(context.Context, *css.SetSupportsTextArgs) (*css.SetSupportsTextReply, error)

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

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

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

	// Command StartRuleUsageTracking
	//
	// Enables the selector recording.
	StartRuleUsageTracking(context.Context) error

	// Command StopRuleUsageTracking
	//
	// Stop tracking rule usage and return the list of rules that were
	// used since last call to `takeCoverageDelta` (or since start of
	// coverage instrumentation)
	StopRuleUsageTracking(context.Context) (*css.StopRuleUsageTrackingReply, error)

	// Command TakeCoverageDelta
	//
	// Obtain list of rules that became used since last call to this
	// method (or since start of coverage instrumentation)
	TakeCoverageDelta(context.Context) (*css.TakeCoverageDeltaReply, error)

	// Command SetLocalFontsEnabled
	//
	// Enables/disables rendering of local CSS fonts (enabled by default).
	//
	// Note: This command is experimental.
	SetLocalFontsEnabled(context.Context, *css.SetLocalFontsEnabledArgs) error

	// Event FontsUpdated
	//
	// Fires whenever a web font is updated. A non-empty font parameter
	// indicates a successfully loaded web font
	FontsUpdated(context.Context) (css.FontsUpdatedClient, error)

	// Event MediaQueryResultChanged
	//
	// Fires whenever a MediaQuery result changes (for example, after a
	// browser window has been resized.) The current implementation
	// considers only viewport-dependent media features.
	MediaQueryResultChanged(context.Context) (css.MediaQueryResultChangedClient, error)

	// Event StyleSheetAdded
	//
	// Fired whenever an active document stylesheet is added.
	StyleSheetAdded(context.Context) (css.StyleSheetAddedClient, error)

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

	// Event StyleSheetRemoved
	//
	// Fired whenever an active document stylesheet is removed.
	StyleSheetRemoved(context.Context) (css.StyleSheetRemovedClient, error)
}

The CSS domain. This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) have an associated `id` used in subsequent operations on the related object. Each object type has a specific `id` structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the `get*ForNode()` calls (which accept a DOM node id). A client can also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and subsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods.

Note: This domain is experimental.

type CacheStorage

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

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

	// Command RequestCacheNames
	//
	// Requests cache names.
	RequestCacheNames(context.Context, *cachestorage.RequestCacheNamesArgs) (*cachestorage.RequestCacheNamesReply, error)

	// Command RequestCachedResponse
	//
	// Fetches cache entry.
	RequestCachedResponse(context.Context, *cachestorage.RequestCachedResponseArgs) (*cachestorage.RequestCachedResponseReply, error)

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

The CacheStorage domain.

Note: This domain is experimental.

type Cast added in v0.21.0

type Cast interface {
	// Command Enable
	//
	// Starts observing for sinks that can be used for tab mirroring, and
	// if set, sinks compatible with |presentationUrl| as well. When sinks
	// are found, a |sinksUpdated| event is fired. Also starts observing
	// for issue messages. When an issue is added or removed, an
	// |issueUpdated| event is fired.
	Enable(context.Context, *cast.EnableArgs) error

	// Command Disable
	//
	// Stops observing for sinks and issues.
	Disable(context.Context) error

	// Command SetSinkToUse
	//
	// Sets a sink to be used when the web page requests the browser to
	// choose a sink via Presentation API, Remote Playback API, or Cast
	// SDK.
	SetSinkToUse(context.Context, *cast.SetSinkToUseArgs) error

	// Command StartDesktopMirroring
	//
	// Starts mirroring the desktop to the sink.
	StartDesktopMirroring(context.Context, *cast.StartDesktopMirroringArgs) error

	// Command StartTabMirroring
	//
	// Starts mirroring the tab to the sink.
	StartTabMirroring(context.Context, *cast.StartTabMirroringArgs) error

	// Command StopCasting
	//
	// Stops the active Cast session on the sink.
	StopCasting(context.Context, *cast.StopCastingArgs) error

	// Event SinksUpdated
	//
	// This is fired whenever the list of available sinks changes. A sink
	// is a device or a software surface that you can cast to.
	SinksUpdated(context.Context) (cast.SinksUpdatedClient, error)

	// Event IssueUpdated
	//
	// This is fired whenever the outstanding issue/error message changes.
	// |issueMessage| is empty if there is no issue.
	IssueUpdated(context.Context) (cast.IssueUpdatedClient, error)
}

The Cast domain. A domain for interacting with Cast, Presentation API, and Remote Playback API functionalities.

Note: This domain is experimental.

type Client

type Client struct {
	Accessibility        Accessibility
	Animation            Animation
	Audits               Audits
	BackgroundService    BackgroundService
	Browser              Browser
	CSS                  CSS
	CacheStorage         CacheStorage
	Cast                 Cast
	Console              Console
	DOM                  DOM
	DOMDebugger          DOMDebugger
	DOMSnapshot          DOMSnapshot
	DOMStorage           DOMStorage
	Database             Database
	Debugger             Debugger
	DeviceOrientation    DeviceOrientation
	Emulation            Emulation
	EventBreakpoints     EventBreakpoints
	Fetch                Fetch
	HeadlessExperimental HeadlessExperimental
	HeapProfiler         HeapProfiler
	IO                   IO
	IndexedDB            IndexedDB
	Input                Input
	Inspector            Inspector
	LayerTree            LayerTree
	Log                  Log
	Media                Media
	Memory               Memory
	Network              Network
	Overlay              Overlay
	Page                 Page
	Performance          Performance
	PerformanceTimeline  PerformanceTimeline
	Profiler             Profiler
	Runtime              Runtime
	Schema               Schema
	Security             Security
	ServiceWorker        ServiceWorker
	Storage              Storage
	SystemInfo           SystemInfo
	Target               Target
	Tethering            Tethering
	Tracing              Tracing
	WebAudio             WebAudio
	WebAuthn             WebAuthn
}

Client represents a Chrome DevTools 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.

func (*Client) NewIOStreamReader added in v0.28.0

func (c *Client) NewIOStreamReader(ctx context.Context, handle io.StreamHandle) *io.StreamReader

NewIOStreamReader returns a reader for io.Stream that implements io.Reader from the standard library.

type Console deprecated

type Console interface {
	// Command ClearMessages
	//
	// Does nothing.
	ClearMessages(context.Context) error

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

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

	// Event MessageAdded
	//
	// Issued when new console message is added.
	MessageAdded(context.Context) (console.MessageAddedClient, error)
}

The Console domain.

Deprecated: This domain is deprecated - use Runtime or Log instead.

type DOM

type DOM interface {
	// Command CollectClassNamesFromSubtree
	//
	// Collects class names for the node with given id and all of it's
	// child nodes.
	//
	// Note: This command is experimental.
	CollectClassNamesFromSubtree(context.Context, *dom.CollectClassNamesFromSubtreeArgs) (*dom.CollectClassNamesFromSubtreeReply, error)

	// Command CopyTo
	//
	// Creates a deep copy of the specified node and places it into the
	// target container before the given anchor.
	//
	// Note: This command is experimental.
	CopyTo(context.Context, *dom.CopyToArgs) (*dom.CopyToReply, error)

	// Command DescribeNode
	//
	// Describes node given its id, does not require domain to be enabled.
	// Does not start tracking any objects, can be used for automation.
	DescribeNode(context.Context, *dom.DescribeNodeArgs) (*dom.DescribeNodeReply, error)

	// Command ScrollIntoViewIfNeeded
	//
	// Scrolls the specified rect of the given node into view if not
	// already visible. Note: exactly one between nodeId, backendNodeId and
	// objectId should be passed to identify the node.
	//
	// Note: This command is experimental.
	ScrollIntoViewIfNeeded(context.Context, *dom.ScrollIntoViewIfNeededArgs) error

	// Command Disable
	//
	// Disables DOM agent for the given page.
	Disable(context.Context) error

	// Command DiscardSearchResults
	//
	// Discards search results from the session with the given id.
	// `getSearchResults` should no longer be called for that search.
	//
	// Note: This command is experimental.
	DiscardSearchResults(context.Context, *dom.DiscardSearchResultsArgs) error

	// Command Enable
	//
	// Enables DOM agent for the given page.
	Enable(context.Context, *dom.EnableArgs) error

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

	// Command GetAttributes
	//
	// Returns attributes for the specified node.
	GetAttributes(context.Context, *dom.GetAttributesArgs) (*dom.GetAttributesReply, error)

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

	// Command GetContentQuads
	//
	// Returns quads that describe node position on the page. This method
	// might return multiple quads for inline nodes.
	//
	// Note: This command is experimental.
	GetContentQuads(context.Context, *dom.GetContentQuadsArgs) (*dom.GetContentQuadsReply, error)

	// Command GetDocument
	//
	// Returns the root DOM node (and optionally the subtree) to the
	// caller.
	GetDocument(context.Context, *dom.GetDocumentArgs) (*dom.GetDocumentReply, error)

	// Command GetFlattenedDocument
	//
	// Deprecated: Returns the root DOM node (and optionally the subtree)
	// to the caller. as it is not designed to work well with
	// the rest of the DOM agent. Use DOMSnapshot.captureSnapshot instead.
	GetFlattenedDocument(context.Context, *dom.GetFlattenedDocumentArgs) (*dom.GetFlattenedDocumentReply, error)

	// Command GetNodesForSubtreeByStyle
	//
	// Finds nodes with a given computed style in a subtree.
	//
	// Note: This command is experimental.
	GetNodesForSubtreeByStyle(context.Context, *dom.GetNodesForSubtreeByStyleArgs) (*dom.GetNodesForSubtreeByStyleReply, error)

	// Command GetNodeForLocation
	//
	// Returns node id at given location. Depending on whether DOM domain
	// is enabled, nodeId is either returned or not.
	GetNodeForLocation(context.Context, *dom.GetNodeForLocationArgs) (*dom.GetNodeForLocationReply, error)

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

	// Command GetRelayoutBoundary
	//
	// Returns the id of the nearest ancestor that is a relayout boundary.
	//
	// Note: This command is experimental.
	GetRelayoutBoundary(context.Context, *dom.GetRelayoutBoundaryArgs) (*dom.GetRelayoutBoundaryReply, error)

	// Command GetSearchResults
	//
	// Returns search results from given `fromIndex` to given `toIndex`
	// from the search with the given identifier.
	//
	// Note: This command is experimental.
	GetSearchResults(context.Context, *dom.GetSearchResultsArgs) (*dom.GetSearchResultsReply, error)

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

	// Command MoveTo
	//
	// Moves node into the new container, places it before the given
	// anchor.
	MoveTo(context.Context, *dom.MoveToArgs) (*dom.MoveToReply, error)

	// Command PerformSearch
	//
	// Searches for a given string in the DOM tree. Use `getSearchResults`
	// to access search results or `cancelSearch` to end this search
	// session.
	//
	// Note: This command is experimental.
	PerformSearch(context.Context, *dom.PerformSearchArgs) (*dom.PerformSearchReply, error)

	// Command PushNodeByPathToFrontend
	//
	// Requests that the node is sent to the caller given its path. //
	// FIXME, use XPath
	//
	// Note: This command is experimental.
	PushNodeByPathToFrontend(context.Context, *dom.PushNodeByPathToFrontendArgs) (*dom.PushNodeByPathToFrontendReply, error)

	// Command PushNodesByBackendIDsToFrontend
	//
	// Requests that a batch of nodes is sent to the caller given their
	// backend node ids.
	//
	// Note: This command is experimental.
	PushNodesByBackendIDsToFrontend(context.Context, *dom.PushNodesByBackendIDsToFrontendArgs) (*dom.PushNodesByBackendIDsToFrontendReply, error)

	// Command QuerySelector
	//
	// Executes `querySelector` on a given node.
	QuerySelector(context.Context, *dom.QuerySelectorArgs) (*dom.QuerySelectorReply, error)

	// Command QuerySelectorAll
	//
	// Executes `querySelectorAll` on a given node.
	QuerySelectorAll(context.Context, *dom.QuerySelectorAllArgs) (*dom.QuerySelectorAllReply, error)

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

	// Command RemoveAttribute
	//
	// Removes attribute with given name from an element with given id.
	RemoveAttribute(context.Context, *dom.RemoveAttributeArgs) error

	// Command RemoveNode
	//
	// Removes node with given id.
	RemoveNode(context.Context, *dom.RemoveNodeArgs) error

	// Command RequestChildNodes
	//
	// Requests that children of the node with given id are returned to
	// the caller in form of `setChildNodes` events where not only
	// immediate children are retrieved, but all children down to the
	// specified depth.
	RequestChildNodes(context.Context, *dom.RequestChildNodesArgs) error

	// Command RequestNode
	//
	// Requests that the node is sent to the caller given the JavaScript
	// node object reference. All nodes that form the path from the node to
	// the root are also sent to the client as a series of `setChildNodes`
	// notifications.
	RequestNode(context.Context, *dom.RequestNodeArgs) (*dom.RequestNodeReply, error)

	// Command ResolveNode
	//
	// Resolves the JavaScript node object for a given NodeId or
	// BackendNodeId.
	ResolveNode(context.Context, *dom.ResolveNodeArgs) (*dom.ResolveNodeReply, error)

	// Command SetAttributeValue
	//
	// Sets attribute for an element with given id.
	SetAttributeValue(context.Context, *dom.SetAttributeValueArgs) error

	// Command SetAttributesAsText
	//
	// Sets attributes on element with given id. This method is useful
	// when user edits some existing attribute value and types in several
	// attribute name/value pairs.
	SetAttributesAsText(context.Context, *dom.SetAttributesAsTextArgs) error

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

	// Command SetNodeStackTracesEnabled
	//
	// Sets if stack traces should be captured for Nodes. See
	// `Node.getNodeStackTraces`. Default is disabled.
	//
	// Note: This command is experimental.
	SetNodeStackTracesEnabled(context.Context, *dom.SetNodeStackTracesEnabledArgs) error

	// Command GetNodeStackTraces
	//
	// Gets stack traces associated with a Node. As of now, only provides
	// stack trace for Node creation.
	//
	// Note: This command is experimental.
	GetNodeStackTraces(context.Context, *dom.GetNodeStackTracesArgs) (*dom.GetNodeStackTracesReply, error)

	// Command GetFileInfo
	//
	// Returns file information for the given File wrapper.
	//
	// Note: This command is experimental.
	GetFileInfo(context.Context, *dom.GetFileInfoArgs) (*dom.GetFileInfoReply, error)

	// Command SetInspectedNode
	//
	// Enables console to refer to the node with given id via $x (see
	// Command Line API for more details $x functions).
	//
	// Note: This command is experimental.
	SetInspectedNode(context.Context, *dom.SetInspectedNodeArgs) error

	// Command SetNodeName
	//
	// Sets node name for a node with given id.
	SetNodeName(context.Context, *dom.SetNodeNameArgs) (*dom.SetNodeNameReply, error)

	// Command SetNodeValue
	//
	// Sets node value for a node with given id.
	SetNodeValue(context.Context, *dom.SetNodeValueArgs) error

	// Command SetOuterHTML
	//
	// Sets node HTML markup, returns new node id.
	SetOuterHTML(context.Context, *dom.SetOuterHTMLArgs) error

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

	// Command GetFrameOwner
	//
	// Returns iframe node that owns iframe with the given domain.
	//
	// Note: This command is experimental.
	GetFrameOwner(context.Context, *dom.GetFrameOwnerArgs) (*dom.GetFrameOwnerReply, error)

	// Command GetContainerForNode
	//
	// Returns the container of the given node based on container query
	// conditions. If containerName is given, it will find the nearest
	// container with a matching name; otherwise it will find the nearest
	// container regardless of its container name.
	//
	// Note: This command is experimental.
	GetContainerForNode(context.Context, *dom.GetContainerForNodeArgs) (*dom.GetContainerForNodeReply, error)

	// Command GetQueryingDescendantsForContainer
	//
	// Returns the descendants of a container query container that have
	// container queries against this container.
	//
	// Note: This command is experimental.
	GetQueryingDescendantsForContainer(context.Context, *dom.GetQueryingDescendantsForContainerArgs) (*dom.GetQueryingDescendantsForContainerReply, error)

	// Event AttributeModified
	//
	// Fired when `Element`'s attribute is modified.
	AttributeModified(context.Context) (dom.AttributeModifiedClient, error)

	// Event AttributeRemoved
	//
	// Fired when `Element`'s attribute is removed.
	AttributeRemoved(context.Context) (dom.AttributeRemovedClient, error)

	// Event CharacterDataModified
	//
	// Mirrors `DOMCharacterDataModified` event.
	CharacterDataModified(context.Context) (dom.CharacterDataModifiedClient, error)

	// Event ChildNodeCountUpdated
	//
	// Fired when `Container`'s child node count has changed.
	ChildNodeCountUpdated(context.Context) (dom.ChildNodeCountUpdatedClient, error)

	// Event ChildNodeInserted
	//
	// Mirrors `DOMNodeInserted` event.
	ChildNodeInserted(context.Context) (dom.ChildNodeInsertedClient, error)

	// Event ChildNodeRemoved
	//
	// Mirrors `DOMNodeRemoved` event.
	ChildNodeRemoved(context.Context) (dom.ChildNodeRemovedClient, error)

	// Event DistributedNodesUpdated
	//
	// Called when distribution is changed.
	//
	// Note: This event is experimental.
	DistributedNodesUpdated(context.Context) (dom.DistributedNodesUpdatedClient, error)

	// Event DocumentUpdated
	//
	// Fired when `Document` has been totally updated. Node ids are no
	// longer valid.
	DocumentUpdated(context.Context) (dom.DocumentUpdatedClient, error)

	// Event InlineStyleInvalidated
	//
	// Fired when `Element`'s inline style is modified via a CSS property
	// modification.
	//
	// Note: This event is experimental.
	InlineStyleInvalidated(context.Context) (dom.InlineStyleInvalidatedClient, error)

	// Event PseudoElementAdded
	//
	// Called when a pseudo element is added to an element.
	//
	// Note: This event is experimental.
	PseudoElementAdded(context.Context) (dom.PseudoElementAddedClient, error)

	// Event PseudoElementRemoved
	//
	// Called when a pseudo element is removed from an element.
	//
	// Note: This event is experimental.
	PseudoElementRemoved(context.Context) (dom.PseudoElementRemovedClient, error)

	// Event SetChildNodes
	//
	// Fired when backend wants to provide client with the missing DOM
	// structure. This happens upon most of the calls requesting node ids.
	SetChildNodes(context.Context) (dom.SetChildNodesClient, error)

	// Event ShadowRootPopped
	//
	// Called when shadow root is popped from the element.
	//
	// Note: This event is experimental.
	ShadowRootPopped(context.Context) (dom.ShadowRootPoppedClient, error)

	// Event ShadowRootPushed
	//
	// Called when shadow root is pushed into the element.
	//
	// Note: This event is experimental.
	ShadowRootPushed(context.Context) (dom.ShadowRootPushedClient, error)
}

The DOM domain. This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an `id`. This `id` can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client.

Note that `iframe` owner elements will return corresponding document elements as their child nodes.

type DOMDebugger

type DOMDebugger interface {
	// Command GetEventListeners
	//
	// Returns event listeners of the given object.
	GetEventListeners(context.Context, *domdebugger.GetEventListenersArgs) (*domdebugger.GetEventListenersReply, error)

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

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

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

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

	// Command SetBreakOnCSPViolation
	//
	// Sets breakpoint on particular CSP violations.
	//
	// Note: This command is experimental.
	SetBreakOnCSPViolation(context.Context, *domdebugger.SetBreakOnCSPViolationArgs) error

	// Command SetDOMBreakpoint
	//
	// Sets breakpoint on particular operation with DOM.
	SetDOMBreakpoint(context.Context, *domdebugger.SetDOMBreakpointArgs) error

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

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

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

The DOMDebugger domain. DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript execution will stop on these operations as if there was a regular breakpoint set.

type DOMSnapshot

type DOMSnapshot interface {
	// Command Disable
	//
	// Disables DOM snapshot agent for the given page.
	Disable(context.Context) error

	// Command Enable
	//
	// Enables DOM snapshot agent for the given page.
	Enable(context.Context) error

	// Command GetSnapshot
	//
	// Deprecated: Returns a document snapshot, including the full DOM
	// tree of the root node (including iframes, template contents, and
	// imported documents) in a flattened array, as well as layout and
	// white-listed computed style information for the nodes. Shadow DOM in
	// the returned DOM tree is flattened.
	GetSnapshot(context.Context, *domsnapshot.GetSnapshotArgs) (*domsnapshot.GetSnapshotReply, error)

	// Command CaptureSnapshot
	//
	// Returns a document snapshot, including the full DOM tree of the
	// root node (including iframes, template contents, and imported
	// documents) in a flattened array, as well as layout and white-listed
	// computed style information for the nodes. Shadow DOM in the returned
	// DOM tree is flattened.
	CaptureSnapshot(context.Context, *domsnapshot.CaptureSnapshotArgs) (*domsnapshot.CaptureSnapshotReply, error)
}

The DOMSnapshot domain. This domain facilitates obtaining document snapshots with DOM, layout, and style information.

Note: This domain is experimental.

type DOMStorage

type DOMStorage interface {
	// Command Clear
	Clear(context.Context, *domstorage.ClearArgs) error

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

	// Command Enable
	//
	// Enables storage tracking, storage events will now be delivered to
	// the client.
	Enable(context.Context) error

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

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

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

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

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

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

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

The DOMStorage domain. Query and modify DOM storage.

Note: This domain is experimental.

type Database

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

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

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

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

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

The Database domain.

Note: This domain is experimental.

type Debugger

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

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

	// Command Enable
	//
	// Enables debugger for the given page. Clients should not assume that
	// the debugging has been enabled until the result for this command is
	// received.
	Enable(context.Context, *debugger.EnableArgs) (*debugger.EnableReply, error)

	// Command EvaluateOnCallFrame
	//
	// Evaluates expression on a given call frame.
	EvaluateOnCallFrame(context.Context, *debugger.EvaluateOnCallFrameArgs) (*debugger.EvaluateOnCallFrameReply, error)

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

	// Command GetScriptSource
	//
	// Returns source for the script with given id.
	GetScriptSource(context.Context, *debugger.GetScriptSourceArgs) (*debugger.GetScriptSourceReply, error)

	// Command GetWASMBytecode
	//
	// Deprecated: This command is deprecated. Use getScriptSource
	// instead.
	GetWASMBytecode(context.Context, *debugger.GetWASMBytecodeArgs) (*debugger.GetWASMBytecodeReply, error)

	// Command GetStackTrace
	//
	// Returns stack trace with given `stackTraceId`.
	//
	// Note: This command is experimental.
	GetStackTrace(context.Context, *debugger.GetStackTraceArgs) (*debugger.GetStackTraceReply, error)

	// Command Pause
	//
	// Stops on the next JavaScript statement.
	Pause(context.Context) error

	// Command PauseOnAsyncCall
	//
	// Deprecated: This command is deprecated.
	//
	// Note: This command is experimental.
	PauseOnAsyncCall(context.Context, *debugger.PauseOnAsyncCallArgs) error

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

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

	// Command Resume
	//
	// Resumes JavaScript execution.
	Resume(context.Context, *debugger.ResumeArgs) error

	// Command SearchInContent
	//
	// Searches for given string in script content.
	SearchInContent(context.Context, *debugger.SearchInContentArgs) (*debugger.SearchInContentReply, error)

	// Command SetAsyncCallStackDepth
	//
	// Enables or disables async call stacks tracking.
	SetAsyncCallStackDepth(context.Context, *debugger.SetAsyncCallStackDepthArgs) error

	// Command SetBlackboxPatterns
	//
	// Replace previous blackbox patterns with passed ones. Forces backend
	// to skip stepping/pausing in scripts with url matching one of the
	// patterns. VM will try to leave blackboxed script by performing 'step
	// in' several times, finally resorting to 'step out' if unsuccessful.
	//
	// Note: This command is experimental.
	SetBlackboxPatterns(context.Context, *debugger.SetBlackboxPatternsArgs) error

	// Command SetBlackboxedRanges
	//
	// Makes backend skip steps in the script in blackboxed ranges. VM
	// will try leave blacklisted scripts by performing 'step in' several
	// times, finally resorting to 'step out' if unsuccessful. Positions
	// array contains positions where blackbox state is changed. First
	// interval isn't blackboxed. Array should be sorted.
	//
	// Note: This command is experimental.
	SetBlackboxedRanges(context.Context, *debugger.SetBlackboxedRangesArgs) error

	// Command SetBreakpoint
	//
	// Sets JavaScript breakpoint at a given location.
	SetBreakpoint(context.Context, *debugger.SetBreakpointArgs) (*debugger.SetBreakpointReply, error)

	// Command SetInstrumentationBreakpoint
	//
	// Sets instrumentation breakpoint.
	SetInstrumentationBreakpoint(context.Context, *debugger.SetInstrumentationBreakpointArgs) (*debugger.SetInstrumentationBreakpointReply, error)

	// Command SetBreakpointByURL
	//
	// Sets JavaScript breakpoint at given location specified either by
	// URL or URL regex. Once this command is issued, all existing parsed
	// scripts will have breakpoints resolved and returned in `locations`
	// property. Further matching script parsing will result in subsequent
	// `breakpointResolved` events issued. This logical breakpoint will
	// survive page reloads.
	SetBreakpointByURL(context.Context, *debugger.SetBreakpointByURLArgs) (*debugger.SetBreakpointByURLReply, error)

	// Command SetBreakpointOnFunctionCall
	//
	// Sets JavaScript breakpoint before each call to the given function.
	// If another function was created from the same source as a given one,
	// calling it will also trigger the breakpoint.
	//
	// Note: This command is experimental.
	SetBreakpointOnFunctionCall(context.Context, *debugger.SetBreakpointOnFunctionCallArgs) (*debugger.SetBreakpointOnFunctionCallReply, error)

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

	// Command SetPauseOnExceptions
	//
	// Defines pause on exceptions state. Can be set to stop on all
	// exceptions, uncaught exceptions or no exceptions. Initial pause on
	// exceptions state is `none`.
	SetPauseOnExceptions(context.Context, *debugger.SetPauseOnExceptionsArgs) error

	// Command SetReturnValue
	//
	// Changes return value in top frame. Available only at return break
	// position.
	//
	// Note: This command is experimental.
	SetReturnValue(context.Context, *debugger.SetReturnValueArgs) error

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

	// Command SetSkipAllPauses
	//
	// Makes page not interrupt on any pauses (breakpoint, exception, dom
	// exception etc).
	SetSkipAllPauses(context.Context, *debugger.SetSkipAllPausesArgs) error

	// Command SetVariableValue
	//
	// Changes value of variable in a callframe. Object-based scopes are
	// not supported and must be mutated manually.
	SetVariableValue(context.Context, *debugger.SetVariableValueArgs) error

	// Command StepInto
	//
	// Steps into the function call.
	StepInto(context.Context, *debugger.StepIntoArgs) error

	// Command StepOut
	//
	// Steps out of the function call.
	StepOut(context.Context) error

	// Command StepOver
	//
	// Steps over the statement.
	StepOver(context.Context, *debugger.StepOverArgs) error

	// Event BreakpointResolved
	//
	// Fired when breakpoint is resolved to an actual script and location.
	BreakpointResolved(context.Context) (debugger.BreakpointResolvedClient, error)

	// Event Paused
	//
	// Fired when the virtual machine stopped on breakpoint or exception
	// or any other stop criteria.
	Paused(context.Context) (debugger.PausedClient, error)

	// Event Resumed
	//
	// Fired when the virtual machine resumed execution.
	Resumed(context.Context) (debugger.ResumedClient, error)

	// Event ScriptFailedToParse
	//
	// Fired when virtual machine fails to parse the script.
	ScriptFailedToParse(context.Context) (debugger.ScriptFailedToParseClient, error)

	// Event ScriptParsed
	//
	// Fired when virtual machine parses script. This event is also fired
	// for all known and uncollected scripts upon enabling debugger.
	ScriptParsed(context.Context) (debugger.ScriptParsedClient, error)
}

The Debugger domain. Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.

type DeviceOrientation

type DeviceOrientation interface {
	// Command ClearDeviceOrientationOverride
	//
	// Clears the overridden Device Orientation.
	ClearDeviceOrientationOverride(context.Context) error

	// Command SetDeviceOrientationOverride
	//
	// Overrides the Device Orientation.
	SetDeviceOrientationOverride(context.Context, *deviceorientation.SetDeviceOrientationOverrideArgs) error
}

The DeviceOrientation domain.

Note: This domain is experimental.

type Emulation

type Emulation interface {
	// Command CanEmulate
	//
	// Tells whether emulation is supported.
	CanEmulate(context.Context) (*emulation.CanEmulateReply, error)

	// Command ClearDeviceMetricsOverride
	//
	// Clears the overridden device metrics.
	ClearDeviceMetricsOverride(context.Context) error

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

	// Command ResetPageScaleFactor
	//
	// Requests that page scale factor is reset to initial values.
	//
	// Note: This command is experimental.
	ResetPageScaleFactor(context.Context) error

	// Command SetFocusEmulationEnabled
	//
	// Enables or disables simulating a focused and active page.
	//
	// Note: This command is experimental.
	SetFocusEmulationEnabled(context.Context, *emulation.SetFocusEmulationEnabledArgs) error

	// Command SetAutoDarkModeOverride
	//
	// Automatically render all web contents using a dark theme.
	//
	// Note: This command is experimental.
	SetAutoDarkModeOverride(context.Context, *emulation.SetAutoDarkModeOverrideArgs) error

	// Command SetCPUThrottlingRate
	//
	// Enables CPU throttling to emulate slow CPUs.
	//
	// Note: This command is experimental.
	SetCPUThrottlingRate(context.Context, *emulation.SetCPUThrottlingRateArgs) error

	// Command SetDefaultBackgroundColorOverride
	//
	// Sets or clears an override of the default background color of the
	// frame. This override is used if the content does not specify one.
	SetDefaultBackgroundColorOverride(context.Context, *emulation.SetDefaultBackgroundColorOverrideArgs) error

	// Command SetDeviceMetricsOverride
	//
	// Overrides the values of device screen dimensions
	// (window.screen.width, window.screen.height, window.innerWidth,
	// window.innerHeight, and "device-width"/"device-height"-related CSS
	// media query results).
	SetDeviceMetricsOverride(context.Context, *emulation.SetDeviceMetricsOverrideArgs) error

	// Command SetScrollbarsHidden
	//
	// Note: This command is experimental.
	SetScrollbarsHidden(context.Context, *emulation.SetScrollbarsHiddenArgs) error

	// Command SetDocumentCookieDisabled
	//
	// Note: This command is experimental.
	SetDocumentCookieDisabled(context.Context, *emulation.SetDocumentCookieDisabledArgs) error

	// Command SetEmitTouchEventsForMouse
	//
	// Note: This command is experimental.
	SetEmitTouchEventsForMouse(context.Context, *emulation.SetEmitTouchEventsForMouseArgs) error

	// Command SetEmulatedMedia
	//
	// Emulates the given media type or media feature for CSS media
	// queries.
	SetEmulatedMedia(context.Context, *emulation.SetEmulatedMediaArgs) error

	// Command SetEmulatedVisionDeficiency
	//
	// Emulates the given vision deficiency.
	//
	// Note: This command is experimental.
	SetEmulatedVisionDeficiency(context.Context, *emulation.SetEmulatedVisionDeficiencyArgs) error

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

	// Command SetIdleOverride
	//
	// Overrides the Idle state.
	//
	// Note: This command is experimental.
	SetIdleOverride(context.Context, *emulation.SetIdleOverrideArgs) error

	// Command ClearIdleOverride
	//
	// Clears Idle state overrides.
	//
	// Note: This command is experimental.
	ClearIdleOverride(context.Context) error

	// Command SetNavigatorOverrides
	//
	// Deprecated: Overrides value returned by the javascript navigator
	// object.
	//
	// Note: This command is experimental.
	SetNavigatorOverrides(context.Context, *emulation.SetNavigatorOverridesArgs) error

	// Command SetPageScaleFactor
	//
	// Sets a specified page scale factor.
	//
	// Note: This command is experimental.
	SetPageScaleFactor(context.Context, *emulation.SetPageScaleFactorArgs) error

	// Command SetScriptExecutionDisabled
	//
	// Switches script execution in the page.
	SetScriptExecutionDisabled(context.Context, *emulation.SetScriptExecutionDisabledArgs) error

	// Command SetTouchEmulationEnabled
	//
	// Enables touch on platforms which do not support them.
	SetTouchEmulationEnabled(context.Context, *emulation.SetTouchEmulationEnabledArgs) error

	// Command SetVirtualTimePolicy
	//
	// Turns on virtual time for all frames (replacing real-time with a
	// synthetic time source) and sets the current virtual time policy.
	// Note this supersedes any previous time budget.
	//
	// Note: This command is experimental.
	SetVirtualTimePolicy(context.Context, *emulation.SetVirtualTimePolicyArgs) (*emulation.SetVirtualTimePolicyReply, error)

	// Command SetLocaleOverride
	//
	// Overrides default host system locale with the specified one.
	//
	// Note: This command is experimental.
	SetLocaleOverride(context.Context, *emulation.SetLocaleOverrideArgs) error

	// Command SetTimezoneOverride
	//
	// Overrides default host system timezone with the specified one.
	//
	// Note: This command is experimental.
	SetTimezoneOverride(context.Context, *emulation.SetTimezoneOverrideArgs) 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 SetDisabledImageTypes
	//
	// Note: This command is experimental.
	SetDisabledImageTypes(context.Context, *emulation.SetDisabledImageTypesArgs) error

	// Command SetHardwareConcurrencyOverride
	//
	// Note: This command is experimental.
	SetHardwareConcurrencyOverride(context.Context, *emulation.SetHardwareConcurrencyOverrideArgs) error

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

	// Command SetAutomationOverride
	//
	// Allows overriding the automation flag.
	//
	// Note: This command is experimental.
	SetAutomationOverride(context.Context, *emulation.SetAutomationOverrideArgs) 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)
}

The Emulation domain. This domain emulates different environments for the page.

type EventBreakpoints added in v0.33.0

type EventBreakpoints interface {
	// Command SetInstrumentationBreakpoint
	//
	// Sets breakpoint on particular native event.
	SetInstrumentationBreakpoint(context.Context, *eventbreakpoints.SetInstrumentationBreakpointArgs) error

	// Command RemoveInstrumentationBreakpoint
	//
	// Removes breakpoint on particular native event.
	RemoveInstrumentationBreakpoint(context.Context, *eventbreakpoints.RemoveInstrumentationBreakpointArgs) error
}

The EventBreakpoints domain. EventBreakpoints permits setting breakpoints on particular operations and events in targets that run JavaScript but do not have a DOM. JavaScript execution will stop on these operations as if there was a regular breakpoint set.

Note: This domain is experimental.

type Fetch added in v0.21.0

type Fetch interface {
	// Command Disable
	//
	// Disables the fetch domain.
	Disable(context.Context) error

	// Command Enable
	//
	// Enables issuing of requestPaused events. A request will be paused
	// until client calls one of failRequest, fulfillRequest or
	// continueRequest/continueWithAuth.
	Enable(context.Context, *fetch.EnableArgs) error

	// Command FailRequest
	//
	// Causes the request to fail with specified reason.
	FailRequest(context.Context, *fetch.FailRequestArgs) error

	// Command FulfillRequest
	//
	// Provides response to the request.
	FulfillRequest(context.Context, *fetch.FulfillRequestArgs) error

	// Command ContinueRequest
	//
	// Continues the request, optionally modifying some of its parameters.
	ContinueRequest(context.Context, *fetch.ContinueRequestArgs) error

	// Command ContinueWithAuth
	//
	// Continues a request supplying authChallengeResponse following
	// authRequired event.
	ContinueWithAuth(context.Context, *fetch.ContinueWithAuthArgs) error

	// Command ContinueResponse
	//
	// Continues loading of the paused response, optionally modifying the
	// response headers. If either responseCode or headers are modified,
	// all of them must be present.
	//
	// Note: This command is experimental.
	ContinueResponse(context.Context, *fetch.ContinueResponseArgs) error

	// Command GetResponseBody
	//
	// Causes the body of the response to be received from the server and
	// returned as a single string. May only be issued for a request that
	// is paused in the Response stage and is mutually exclusive with
	// takeResponseBodyForInterceptionAsStream. Calling other methods that
	// affect the request or disabling fetch domain before body is received
	// results in an undefined behavior.
	GetResponseBody(context.Context, *fetch.GetResponseBodyArgs) (*fetch.GetResponseBodyReply, error)

	// Command TakeResponseBodyAsStream
	//
	// Returns a handle to the stream representing the response body. The
	// request must be paused in the HeadersReceived stage. Note that after
	// this command the request can't be continued as is -- client either
	// needs to cancel it or to provide the response body. The stream only
	// supports sequential read, IO.read will fail if the position is
	// specified. This method is mutually exclusive with getResponseBody.
	// Calling other methods that affect the request or disabling fetch
	// domain before body is received results in an undefined behavior.
	TakeResponseBodyAsStream(context.Context, *fetch.TakeResponseBodyAsStreamArgs) (*fetch.TakeResponseBodyAsStreamReply, error)

	// Event RequestPaused
	//
	// Issued when the domain is enabled and the request URL matches the
	// specified filter. The request is paused until the client responds
	// with one of continueRequest, failRequest or fulfillRequest. The
	// stage of the request can be determined by presence of
	// responseErrorReason and responseStatusCode -- the request is at the
	// response stage if either of these fields is present and in the
	// request stage otherwise.
	RequestPaused(context.Context) (fetch.RequestPausedClient, error)

	// Event AuthRequired
	//
	// Issued when the domain is enabled with handleAuthRequests set to
	// true. The request is paused until client responds with
	// continueWithAuth.
	AuthRequired(context.Context) (fetch.AuthRequiredClient, error)
}

The Fetch domain. A domain for letting clients substitute browser's network layer with client code.

type HeadlessExperimental added in v0.14.1

type HeadlessExperimental interface {
	// Command BeginFrame
	//
	// Sends a BeginFrame to the target and returns when the frame was
	// completed. Optionally captures a screenshot from the resulting
	// frame. Requires that the target was created with enabled
	// BeginFrameControl. Designed for use with
	// --run-all-compositor-stages-before-draw, see also
	// https://goo.gle/chrome-headless-rendering for more background.
	BeginFrame(context.Context, *headlessexperimental.BeginFrameArgs) (*headlessexperimental.BeginFrameReply, error)

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

	// Command Enable
	//
	// Enables headless events for the target.
	Enable(context.Context) error

	// Event NeedsBeginFramesChanged
	//
	// Deprecated: Issued when the target starts or stops needing
	// BeginFrames. Deprecated. Issue beginFrame unconditionally instead
	// and use result from beginFrame to detect whether the frames were
	// suppressed.
	NeedsBeginFramesChanged(context.Context) (headlessexperimental.NeedsBeginFramesChangedClient, error)
}

The HeadlessExperimental domain. This domain provides experimental commands only supported in headless mode.

Note: This domain is experimental.

type HeapProfiler

type HeapProfiler interface {
	// Command AddInspectedHeapObject
	//
	// Enables console to refer to the node with given id via $x (see
	// Command Line API for more details $x functions).
	AddInspectedHeapObject(context.Context, *heapprofiler.AddInspectedHeapObjectArgs) error

	// Command CollectGarbage
	CollectGarbage(context.Context) error

	// Command Disable
	Disable(context.Context) error

	// Command Enable
	Enable(context.Context) error

	// Command GetHeapObjectID
	GetHeapObjectID(context.Context, *heapprofiler.GetHeapObjectIDArgs) (*heapprofiler.GetHeapObjectIDReply, error)

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

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

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

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

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

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

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

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

	// Event HeapStatsUpdate
	//
	// If heap objects tracking has been started then backend may send
	// update for one or more fragments
	HeapStatsUpdate(context.Context) (heapprofiler.HeapStatsUpdateClient, error)

	// Event LastSeenObjectID
	//
	// If heap objects tracking has been started then backend regularly
	// sends a current value for last seen object id and corresponding
	// timestamp. If the were changes in the heap since last event then one
	// or more heapStatsUpdate events will be sent before a new
	// lastSeenObjectId event.
	LastSeenObjectID(context.Context) (heapprofiler.LastSeenObjectIDClient, error)

	// Event ReportHeapSnapshotProgress
	ReportHeapSnapshotProgress(context.Context) (heapprofiler.ReportHeapSnapshotProgressClient, error)

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

The HeapProfiler domain.

Note: This domain is experimental.

type IO

type IO interface {
	// Command Close
	//
	// Close the stream, discard any temporary backing storage.
	Close(context.Context, *io.CloseArgs) error

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

	// Command ResolveBlob
	//
	// Return UUID of Blob object specified by a remote object id.
	ResolveBlob(context.Context, *io.ResolveBlobArgs) (*io.ResolveBlobReply, error)
}

The IO domain. Input/Output operations for streams produced by DevTools.

type IndexedDB

type IndexedDB interface {
	// Command ClearObjectStore
	//
	// Clears all entries from an object store.
	ClearObjectStore(context.Context, *indexeddb.ClearObjectStoreArgs) error

	// Command DeleteDatabase
	//
	// Deletes a database.
	DeleteDatabase(context.Context, *indexeddb.DeleteDatabaseArgs) error

	// Command DeleteObjectStoreEntries
	//
	// Delete a range of entries from an object store
	DeleteObjectStoreEntries(context.Context, *indexeddb.DeleteObjectStoreEntriesArgs) error

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

	// Command Enable
	//
	// Enables events from backend.
	Enable(context.Context) error

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

	// Command GetMetadata
	//
	// Gets metadata of an object store
	GetMetadata(context.Context, *indexeddb.GetMetadataArgs) (*indexeddb.GetMetadataReply, error)

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

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

The IndexedDB domain.

Note: This domain is experimental.

type Input

type Input interface {
	// Command DispatchDragEvent
	//
	// Dispatches a drag event into the page.
	//
	// Note: This command is experimental.
	DispatchDragEvent(context.Context, *input.DispatchDragEventArgs) error

	// Command DispatchKeyEvent
	//
	// Dispatches a key event to the page.
	DispatchKeyEvent(context.Context, *input.DispatchKeyEventArgs) error

	// Command InsertText
	//
	// This method emulates inserting text that doesn't come from a key
	// press, for example an emoji keyboard or an IME.
	//
	// Note: This command is experimental.
	InsertText(context.Context, *input.InsertTextArgs) error

	// Command IMESetComposition
	//
	// This method sets the current candidate text for ime. Use
	// imeCommitComposition to commit the final text. Use imeSetComposition
	// with empty string as text to cancel composition.
	//
	// Note: This command is experimental.
	IMESetComposition(context.Context, *input.IMESetCompositionArgs) error

	// Command DispatchMouseEvent
	//
	// Dispatches a mouse event to the page.
	DispatchMouseEvent(context.Context, *input.DispatchMouseEventArgs) error

	// Command DispatchTouchEvent
	//
	// Dispatches a touch event to the page.
	DispatchTouchEvent(context.Context, *input.DispatchTouchEventArgs) error

	// Command EmulateTouchFromMouseEvent
	//
	// Emulates touch event from the mouse event parameters.
	//
	// Note: This command is experimental.
	EmulateTouchFromMouseEvent(context.Context, *input.EmulateTouchFromMouseEventArgs) error

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

	// Command SetInterceptDrags
	//
	// Prevents default drag and drop behavior and instead emits
	// `Input.dragIntercepted` events. Drag and drop behavior can be
	// directly controlled via `Input.dispatchDragEvent`.
	//
	// Note: This command is experimental.
	SetInterceptDrags(context.Context, *input.SetInterceptDragsArgs) 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

	// Event DragIntercepted
	//
	// Emitted only when `Input.setInterceptDrags` is enabled. Use this
	// data with `Input.dispatchDragEvent` to restore normal drag and drop
	// behavior.
	//
	// Note: This event is experimental.
	DragIntercepted(context.Context) (input.DragInterceptedClient, error)
}

The Input domain.

type Inspector

type Inspector interface {
	// Command Disable
	//
	// Disables inspector domain notifications.
	Disable(context.Context) error

	// Command Enable
	//
	// Enables inspector domain notifications.
	Enable(context.Context) error

	// Event Detached
	//
	// Fired when remote debugging connection is about to be terminated.
	// Contains detach reason.
	Detached(context.Context) (inspector.DetachedClient, error)

	// Event TargetCrashed
	//
	// Fired when debugging target has crashed
	TargetCrashed(context.Context) (inspector.TargetCrashedClient, error)

	// Event TargetReloadedAfterCrash
	//
	// Fired when debugging target has reloaded after crash
	TargetReloadedAfterCrash(context.Context) (inspector.TargetReloadedAfterCrashClient, error)
}

The Inspector domain.

Note: This domain is experimental.

type LayerTree

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

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

	// Command Enable
	//
	// Enables compositing tree inspection.
	Enable(context.Context) error

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

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

	// Command ProfileSnapshot
	ProfileSnapshot(context.Context, *layertree.ProfileSnapshotArgs) (*layertree.ProfileSnapshotReply, error)

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

	// Command ReplaySnapshot
	//
	// Replays the layer snapshot and returns the resulting bitmap.
	ReplaySnapshot(context.Context, *layertree.ReplaySnapshotArgs) (*layertree.ReplaySnapshotReply, error)

	// Command SnapshotCommandLog
	//
	// Replays the layer snapshot and returns canvas log.
	SnapshotCommandLog(context.Context, *layertree.SnapshotCommandLogArgs) (*layertree.SnapshotCommandLogReply, error)

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

	// Event LayerTreeDidChange
	LayerTreeDidChange(context.Context) (layertree.DidChangeClient, error)
}

The LayerTree domain.

Note: This domain is experimental.

type Log

type Log interface {
	// Command Clear
	//
	// Clears the log.
	Clear(context.Context) error

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

	// Command Enable
	//
	// Enables log domain, sends the entries collected so far to the
	// client by means of the `entryAdded` notification.
	Enable(context.Context) error

	// Command StartViolationsReport
	//
	// start violation reporting.
	StartViolationsReport(context.Context, *log.StartViolationsReportArgs) error

	// Command StopViolationsReport
	//
	// Stop violation reporting.
	StopViolationsReport(context.Context) error

	// Event EntryAdded
	//
	// Issued when new message was logged.
	EntryAdded(context.Context) (log.EntryAddedClient, error)
}

The Log domain. Provides access to log entries.

type Media added in v0.25.0

type Media interface {
	// Command Enable
	//
	// Enables the Media domain
	Enable(context.Context) error

	// Command Disable
	//
	// Disables the Media domain.
	Disable(context.Context) error

	// Event PlayerPropertiesChanged
	//
	// This can be called multiple times, and can be used to set /
	// override / remove player properties. A null propValue indicates
	// removal.
	PlayerPropertiesChanged(context.Context) (media.PlayerPropertiesChangedClient, error)

	// Event PlayerEventsAdded
	//
	// Send events as a list, allowing them to be batched on the browser
	// for less congestion. If batched, events must ALWAYS be in
	// chronological order.
	PlayerEventsAdded(context.Context) (media.PlayerEventsAddedClient, error)

	// Event PlayerMessagesLogged
	//
	// Send a list of any messages that need to be delivered.
	PlayerMessagesLogged(context.Context) (media.PlayerMessagesLoggedClient, error)

	// Event PlayerErrorsRaised
	//
	// Send a list of any errors that need to be delivered.
	PlayerErrorsRaised(context.Context) (media.PlayerErrorsRaisedClient, error)

	// Event PlayersCreated
	//
	// Called whenever a player is created, or when a new agent joins and
	// receives a list of active players. If an agent is restored, it will
	// receive the full list of player ids and all events again.
	PlayersCreated(context.Context) (media.PlayersCreatedClient, error)
}

The Media domain. This domain allows detailed inspection of media elements

Note: This domain is experimental.

type Memory

type Memory interface {
	// Command GetDOMCounters
	GetDOMCounters(context.Context) (*memory.GetDOMCountersReply, error)

	// Command PrepareForLeakDetection
	PrepareForLeakDetection(context.Context) error

	// Command ForciblyPurgeJavaScriptMemory
	//
	// Simulate OomIntervention by purging V8 memory.
	ForciblyPurgeJavaScriptMemory(context.Context) error

	// Command SetPressureNotificationsSuppressed
	//
	// Enable/disable suppressing memory pressure notifications in all
	// processes.
	SetPressureNotificationsSuppressed(context.Context, *memory.SetPressureNotificationsSuppressedArgs) error

	// Command SimulatePressureNotification
	//
	// Simulate a memory pressure notification in all processes.
	SimulatePressureNotification(context.Context, *memory.SimulatePressureNotificationArgs) error

	// Command StartSampling
	//
	// Start collecting native memory profile.
	StartSampling(context.Context, *memory.StartSamplingArgs) error

	// Command StopSampling
	//
	// Stop collecting native memory profile.
	StopSampling(context.Context) error

	// Command GetAllTimeSamplingProfile
	//
	// Retrieve native memory allocations profile collected since renderer
	// process startup.
	GetAllTimeSamplingProfile(context.Context) (*memory.GetAllTimeSamplingProfileReply, error)

	// Command GetBrowserSamplingProfile
	//
	// Retrieve native memory allocations profile collected since browser
	// process startup.
	GetBrowserSamplingProfile(context.Context) (*memory.GetBrowserSamplingProfileReply, error)

	// Command GetSamplingProfile
	//
	// Retrieve native memory allocations profile collected since last
	// `startSampling` call.
	GetSamplingProfile(context.Context) (*memory.GetSamplingProfileReply, error)
}

The Memory domain.

Note: This domain is experimental.

type Network

type Network interface {
	// Command SetAcceptedEncodings
	//
	// Sets a list of content encodings that will be accepted. Empty list
	// means no encoding is accepted.
	//
	// Note: This command is experimental.
	SetAcceptedEncodings(context.Context, *network.SetAcceptedEncodingsArgs) error

	// Command ClearAcceptedEncodingsOverride
	//
	// Clears accepted encodings set by setAcceptedEncodings
	//
	// Note: This command is experimental.
	ClearAcceptedEncodingsOverride(context.Context) error

	// Command CanClearBrowserCache
	//
	// Deprecated: Tells whether clearing browser cache is supported.
	CanClearBrowserCache(context.Context) (*network.CanClearBrowserCacheReply, error)

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

	// Command CanEmulateNetworkConditions
	//
	// Deprecated: Tells whether emulation of network conditions is
	// supported.
	CanEmulateNetworkConditions(context.Context) (*network.CanEmulateNetworkConditionsReply, error)

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

	// Command ClearBrowserCookies
	//
	// Clears browser cookies.
	ClearBrowserCookies(context.Context) error

	// Command ContinueInterceptedRequest
	//
	// Deprecated: 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. use Fetch.continueRequest,
	// Fetch.fulfillRequest and Fetch.failRequest instead.
	//
	// Note: This command is experimental.
	ContinueInterceptedRequest(context.Context, *network.ContinueInterceptedRequestArgs) error

	// Command DeleteCookies
	//
	// Deletes browser cookies with matching name and url or domain/path
	// pair.
	DeleteCookies(context.Context, *network.DeleteCookiesArgs) error

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

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

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

	// Command GetAllCookies
	//
	// Returns all browser cookies. Depending on the backend support, will
	// return detailed cookie information in the `cookies` field.
	GetAllCookies(context.Context) (*network.GetAllCookiesReply, error)

	// Command GetCertificate
	//
	// Returns the DER-encoded certificate.
	//
	// Note: This command is experimental.
	GetCertificate(context.Context, *network.GetCertificateArgs) (*network.GetCertificateReply, error)

	// Command GetCookies
	//
	// Returns all browser cookies for the current URL. Depending on the
	// backend support, will return detailed cookie information in the
	// `cookies` field.
	GetCookies(context.Context, *network.GetCookiesArgs) (*network.GetCookiesReply, error)

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

	// Command GetRequestPostData
	//
	// Returns post data sent with the request. Returns an error when no
	// data was sent with the request.
	GetRequestPostData(context.Context, *network.GetRequestPostDataArgs) (*network.GetRequestPostDataReply, error)

	// Command GetResponseBodyForInterception
	//
	// Returns content served for the given currently intercepted request.
	//
	// Note: This command is experimental.
	GetResponseBodyForInterception(context.Context, *network.GetResponseBodyForInterceptionArgs) (*network.GetResponseBodyForInterceptionReply, error)

	// Command TakeResponseBodyForInterceptionAsStream
	//
	// Returns a handle to the stream representing the response body. Note
	// that after this command, the intercepted request can't be continued
	// as is -- you either need to cancel it or to provide the response
	// body. The stream only supports sequential read, IO.read will fail if
	// the position is specified.
	//
	// Note: This command is experimental.
	TakeResponseBodyForInterceptionAsStream(context.Context, *network.TakeResponseBodyForInterceptionAsStreamArgs) (*network.TakeResponseBodyForInterceptionAsStreamReply, error)

	// Command ReplayXHR
	//
	// This method sends a new XMLHttpRequest which is identical to the
	// original one. The following parameters should be identical: method,
	// url, async, request body, extra headers, withCredentials attribute,
	// user, password.
	//
	// Note: This command is experimental.
	ReplayXHR(context.Context, *network.ReplayXHRArgs) error

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

	// Command SetBlockedURLs
	//
	// Blocks URLs from loading.
	//
	// Note: This command is experimental.
	SetBlockedURLs(context.Context, *network.SetBlockedURLsArgs) error

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

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

	// Command SetCookie
	//
	// Sets a cookie with the given cookie data; may overwrite equivalent
	// cookies if they exist.
	SetCookie(context.Context, *network.SetCookieArgs) (*network.SetCookieReply, error)

	// Command SetCookies
	//
	// Sets given cookies.
	SetCookies(context.Context, *network.SetCookiesArgs) error

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

	// Command SetAttachDebugStack
	//
	// Specifies whether to attach a page script stack id in requests
	//
	// Note: This command is experimental.
	SetAttachDebugStack(context.Context, *network.SetAttachDebugStackArgs) error

	// Command SetRequestInterception
	//
	// Deprecated: Sets the requests to intercept that match the provided
	// patterns and optionally resource types. please use
	// Fetch.enable instead.
	//
	// Note: This command is experimental.
	SetRequestInterception(context.Context, *network.SetRequestInterceptionArgs) error

	// Command GetSecurityIsolationStatus
	//
	// Returns information about the COEP/COOP isolation status.
	//
	// Note: This command is experimental.
	GetSecurityIsolationStatus(context.Context, *network.GetSecurityIsolationStatusArgs) (*network.GetSecurityIsolationStatusReply, error)

	// Command EnableReportingAPI
	//
	// Enables tracking for the Reporting API, events generated by the
	// Reporting API will now be delivered to the client. Enabling triggers
	// 'reportingApiReportAdded' for all existing reports.
	//
	// Note: This command is experimental.
	EnableReportingAPI(context.Context, *network.EnableReportingAPIArgs) error

	// Command LoadNetworkResource
	//
	// Fetches the resource and returns the content.
	//
	// Note: This command is experimental.
	LoadNetworkResource(context.Context, *network.LoadNetworkResourceArgs) (*network.LoadNetworkResourceReply, error)

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

	// Event EventSourceMessageReceived
	//
	// Fired when EventSource message is received.
	EventSourceMessageReceived(context.Context) (network.EventSourceMessageReceivedClient, error)

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

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

	// Event RequestIntercepted
	//
	// Deprecated: Details of an intercepted HTTP request, which must be
	// either allowed, blocked, modified or mocked. use
	// Fetch.requestPaused instead.
	//
	// Note: This event is experimental.
	RequestIntercepted(context.Context) (network.RequestInterceptedClient, error)

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

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

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

	// Event SignedExchangeReceived
	//
	// Fired when a signed exchange was received over the network
	//
	// Note: This event is experimental.
	SignedExchangeReceived(context.Context) (network.SignedExchangeReceivedClient, error)

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

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

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

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

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

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

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

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

	// Event WebTransportCreated
	//
	// Fired upon WebTransport creation.
	WebTransportCreated(context.Context) (network.WebTransportCreatedClient, error)

	// Event WebTransportConnectionEstablished
	//
	// Fired when WebTransport handshake is finished.
	WebTransportConnectionEstablished(context.Context) (network.WebTransportConnectionEstablishedClient, error)

	// Event WebTransportClosed
	//
	// Fired when WebTransport is disposed.
	WebTransportClosed(context.Context) (network.WebTransportClosedClient, error)

	// Event RequestWillBeSentExtraInfo
	//
	// Fired when additional information about a requestWillBeSent event
	// is available from the network stack. Not every requestWillBeSent
	// event will have an additional requestWillBeSentExtraInfo fired for
	// it, and there is no guarantee whether requestWillBeSent or
	// requestWillBeSentExtraInfo will be fired first for the same request.
	//
	// Note: This event is experimental.
	RequestWillBeSentExtraInfo(context.Context) (network.RequestWillBeSentExtraInfoClient, error)

	// Event ResponseReceivedExtraInfo
	//
	// Fired when additional information about a responseReceived event is
	// available from the network stack. Not every responseReceived event
	// will have an additional responseReceivedExtraInfo for it, and
	// responseReceivedExtraInfo may be fired before or after
	// responseReceived.
	//
	// Note: This event is experimental.
	ResponseReceivedExtraInfo(context.Context) (network.ResponseReceivedExtraInfoClient, error)

	// Event TrustTokenOperationDone
	//
	// Fired exactly once for each Trust Token operation. Depending on the
	// type of the operation and whether the operation succeeded or failed,
	// the event is fired before the corresponding request was sent or
	// after the response was received.
	//
	// Note: This event is experimental.
	TrustTokenOperationDone(context.Context) (network.TrustTokenOperationDoneClient, error)

	// Event SubresourceWebBundleMetadataReceived
	//
	// Fired once when parsing the .wbn file has succeeded. The event
	// contains the information about the web bundle contents.
	//
	// Note: This event is experimental.
	SubresourceWebBundleMetadataReceived(context.Context) (network.SubresourceWebBundleMetadataReceivedClient, error)

	// Event SubresourceWebBundleMetadataError
	//
	// Fired once when parsing the .wbn file has failed.
	//
	// Note: This event is experimental.
	SubresourceWebBundleMetadataError(context.Context) (network.SubresourceWebBundleMetadataErrorClient, error)

	// Event SubresourceWebBundleInnerResponseParsed
	//
	// Fired when handling requests for resources within a .wbn file.
	// Note: this will only be fired for resources that are requested by
	// the webpage.
	//
	// Note: This event is experimental.
	SubresourceWebBundleInnerResponseParsed(context.Context) (network.SubresourceWebBundleInnerResponseParsedClient, error)

	// Event SubresourceWebBundleInnerResponseError
	//
	// Fired when request for resources within a .wbn file failed.
	//
	// Note: This event is experimental.
	SubresourceWebBundleInnerResponseError(context.Context) (network.SubresourceWebBundleInnerResponseErrorClient, error)

	// Event ReportingAPIReportAdded
	//
	// Is sent whenever a new report is added. And after
	// 'enableReportingApi' for all existing reports.
	//
	// Note: This event is experimental.
	ReportingAPIReportAdded(context.Context) (network.ReportingAPIReportAddedClient, error)

	// Event ReportingAPIReportUpdated
	//
	// Note: This event is experimental.
	ReportingAPIReportUpdated(context.Context) (network.ReportingAPIReportUpdatedClient, error)

	// Event ReportingAPIEndpointsChangedForOrigin
	//
	// Note: This event is experimental.
	ReportingAPIEndpointsChangedForOrigin(context.Context) (network.ReportingAPIEndpointsChangedForOriginClient, error)
}

The Network domain. Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.

type Overlay

type Overlay interface {
	// Command Disable
	//
	// Disables domain notifications.
	Disable(context.Context) error

	// Command Enable
	//
	// Enables domain notifications.
	Enable(context.Context) error

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

	// Command GetGridHighlightObjectsForTest
	//
	// For Persistent Grid testing.
	GetGridHighlightObjectsForTest(context.Context, *overlay.GetGridHighlightObjectsForTestArgs) (*overlay.GetGridHighlightObjectsForTestReply, error)

	// Command GetSourceOrderHighlightObjectForTest
	//
	// For Source Order Viewer testing.
	GetSourceOrderHighlightObjectForTest(context.Context, *overlay.GetSourceOrderHighlightObjectForTestArgs) (*overlay.GetSourceOrderHighlightObjectForTestReply, error)

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

	// Command HighlightFrame
	//
	// Deprecated: Highlights owner element of the frame with given id.
	// Deprecated: Doesn't work reliablity and cannot be fixed due to
	// process separatation (the owner node might be in a different
	// process). Determine the owner node in the client and use
	// highlightNode.
	HighlightFrame(context.Context, *overlay.HighlightFrameArgs) error

	// Command HighlightNode
	//
	// Highlights DOM node with given id or with the given JavaScript
	// object wrapper. Either nodeId or objectId must be specified.
	HighlightNode(context.Context, *overlay.HighlightNodeArgs) error

	// Command HighlightQuad
	//
	// Highlights given quad. Coordinates are absolute with respect to the
	// main frame viewport.
	HighlightQuad(context.Context, *overlay.HighlightQuadArgs) error

	// Command HighlightRect
	//
	// Highlights given rectangle. Coordinates are absolute with respect
	// to the main frame viewport.
	HighlightRect(context.Context, *overlay.HighlightRectArgs) error

	// Command HighlightSourceOrder
	//
	// Highlights the source order of the children of the DOM node with
	// given id or with the given JavaScript object wrapper. Either nodeId
	// or objectId must be specified.
	HighlightSourceOrder(context.Context, *overlay.HighlightSourceOrderArgs) 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 SetShowAdHighlights
	//
	// Highlights owner element of all frames detected to be ads.
	SetShowAdHighlights(context.Context, *overlay.SetShowAdHighlightsArgs) error

	// Command SetPausedInDebuggerMessage
	SetPausedInDebuggerMessage(context.Context, *overlay.SetPausedInDebuggerMessageArgs) error

	// Command SetShowDebugBorders
	//
	// Requests that backend shows debug borders on layers
	SetShowDebugBorders(context.Context, *overlay.SetShowDebugBordersArgs) error

	// Command SetShowFPSCounter
	//
	// Requests that backend shows the FPS counter
	SetShowFPSCounter(context.Context, *overlay.SetShowFPSCounterArgs) error

	// Command SetShowGridOverlays
	//
	// Highlight multiple elements with the CSS Grid overlay.
	SetShowGridOverlays(context.Context, *overlay.SetShowGridOverlaysArgs) error

	// Command SetShowFlexOverlays
	SetShowFlexOverlays(context.Context, *overlay.SetShowFlexOverlaysArgs) error

	// Command SetShowScrollSnapOverlays
	SetShowScrollSnapOverlays(context.Context, *overlay.SetShowScrollSnapOverlaysArgs) error

	// Command SetShowContainerQueryOverlays
	SetShowContainerQueryOverlays(context.Context, *overlay.SetShowContainerQueryOverlaysArgs) error

	// Command SetShowPaintRects
	//
	// Requests that backend shows paint rectangles
	SetShowPaintRects(context.Context, *overlay.SetShowPaintRectsArgs) error

	// Command SetShowLayoutShiftRegions
	//
	// Requests that backend shows layout shift regions
	SetShowLayoutShiftRegions(context.Context, *overlay.SetShowLayoutShiftRegionsArgs) error

	// Command SetShowScrollBottleneckRects
	//
	// Requests that backend shows scroll bottleneck rects
	SetShowScrollBottleneckRects(context.Context, *overlay.SetShowScrollBottleneckRectsArgs) error

	// Command SetShowHitTestBorders
	//
	// Deprecated: No longer has any effect.
	SetShowHitTestBorders(context.Context, *overlay.SetShowHitTestBordersArgs) error

	// Command SetShowWebVitals
	//
	// Request that backend shows an overlay with web vital metrics.
	SetShowWebVitals(context.Context, *overlay.SetShowWebVitalsArgs) error

	// Command SetShowViewportSizeOnResize
	//
	// Paints viewport size upon main frame resize.
	SetShowViewportSizeOnResize(context.Context, *overlay.SetShowViewportSizeOnResizeArgs) error

	// Command SetShowHinge
	//
	// Add a dual screen device hinge
	SetShowHinge(context.Context, *overlay.SetShowHingeArgs) error

	// Command SetShowIsolatedElements
	//
	// Show elements in isolation mode with overlays.
	SetShowIsolatedElements(context.Context, *overlay.SetShowIsolatedElementsArgs) error

	// Event InspectNodeRequested
	//
	// Fired when the node should be inspected. This happens after call to
	// `setInspectMode` or when user manually inspects an element.
	InspectNodeRequested(context.Context) (overlay.InspectNodeRequestedClient, error)

	// Event NodeHighlightRequested
	//
	// Fired when the node should be highlighted. This happens after call
	// to `setInspectMode`.
	NodeHighlightRequested(context.Context) (overlay.NodeHighlightRequestedClient, error)

	// Event ScreenshotRequested
	//
	// Fired when user asks to capture screenshot of some area on the
	// page.
	ScreenshotRequested(context.Context) (overlay.ScreenshotRequestedClient, error)

	// Event InspectModeCanceled
	//
	// Fired when user cancels the inspect mode.
	InspectModeCanceled(context.Context) (overlay.InspectModeCanceledClient, error)
}

The Overlay domain. This domain provides various functionality related to drawing atop the inspected page.

Note: This domain is experimental.

type Page

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

	// Command AddScriptToEvaluateOnNewDocument
	//
	// Evaluates given script in every frame upon creation (before loading
	// frame's scripts).
	AddScriptToEvaluateOnNewDocument(context.Context, *page.AddScriptToEvaluateOnNewDocumentArgs) (*page.AddScriptToEvaluateOnNewDocumentReply, error)

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

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

	// Command CaptureSnapshot
	//
	// Returns a snapshot of the page as a string. For MHTML format, the
	// serialization includes iframes, shadow DOM, external resources, and
	// element-inline styles.
	//
	// Note: This command is experimental.
	CaptureSnapshot(context.Context, *page.CaptureSnapshotArgs) (*page.CaptureSnapshotReply, error)

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

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

	// Command Enable
	//
	// Enables page domain notifications.
	Enable(context.Context) error

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

	// Command GetInstallabilityErrors
	//
	// Note: This command is experimental.
	GetInstallabilityErrors(context.Context) (*page.GetInstallabilityErrorsReply, error)

	// Command GetManifestIcons
	//
	// Note: This command is experimental.
	GetManifestIcons(context.Context) (*page.GetManifestIconsReply, error)

	// Command GetAppID
	//
	// Returns the unique (PWA) app id. Only returns values if the feature
	// flag 'WebAppEnableManifestId' is enabled
	//
	// Note: This command is experimental.
	GetAppID(context.Context) (*page.GetAppIDReply, error)

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

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

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

	// Command ResetNavigationHistory
	//
	// Resets navigation history for the current page.
	ResetNavigationHistory(context.Context) error

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

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

	// Command HandleJavaScriptDialog
	//
	// Accepts or dismisses a JavaScript initiated dialog (alert, confirm,
	// prompt, or onbeforeunload).
	HandleJavaScriptDialog(context.Context, *page.HandleJavaScriptDialogArgs) error

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

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

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

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

	// Command RemoveScriptToEvaluateOnLoad
	//
	// Deprecated: Please use
	// removeScriptToEvaluateOnNewDocument instead.
	//
	// Note: This command is experimental.
	RemoveScriptToEvaluateOnLoad(context.Context, *page.RemoveScriptToEvaluateOnLoadArgs) error

	// Command RemoveScriptToEvaluateOnNewDocument
	//
	// Removes given script from the list.
	RemoveScriptToEvaluateOnNewDocument(context.Context, *page.RemoveScriptToEvaluateOnNewDocumentArgs) error

	// Command ScreencastFrameAck
	//
	// Acknowledges that a screencast frame has been received by the
	// frontend.
	//
	// Note: This command is experimental.
	ScreencastFrameAck(context.Context, *page.ScreencastFrameAckArgs) error

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

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

	// Command SetBypassCSP
	//
	// Enable page Content Security Policy by-passing.
	//
	// Note: This command is experimental.
	SetBypassCSP(context.Context, *page.SetBypassCSPArgs) error

	// Command GetPermissionsPolicyState
	//
	// Get Permissions Policy state on given frame.
	//
	// Note: This command is experimental.
	GetPermissionsPolicyState(context.Context, *page.GetPermissionsPolicyStateArgs) (*page.GetPermissionsPolicyStateReply, error)

	// Command GetOriginTrials
	//
	// Get Origin Trials on given frame.
	//
	// Note: This command is experimental.
	GetOriginTrials(context.Context, *page.GetOriginTrialsArgs) (*page.GetOriginTrialsReply, error)

	// Command SetFontFamilies
	//
	// Set generic font families.
	//
	// Note: This command is experimental.
	SetFontFamilies(context.Context, *page.SetFontFamiliesArgs) error

	// Command SetFontSizes
	//
	// Set default font sizes.
	//
	// Note: This command is experimental.
	SetFontSizes(context.Context, *page.SetFontSizesArgs) error

	// Command SetDocumentContent
	//
	// Sets given markup as the document's HTML.
	SetDocumentContent(context.Context, *page.SetDocumentContentArgs) error

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

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

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

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

	// Command Crash
	//
	// Crashes renderer on the IO thread, generates minidumps.
	//
	// Note: This command is experimental.
	Crash(context.Context) error

	// Command Close
	//
	// Tries to close page, running its beforeunload hooks, if any.
	//
	// Note: This command is experimental.
	Close(context.Context) error

	// Command SetWebLifecycleState
	//
	// Tries to update the web lifecycle state of the page. It will
	// transition the page to the given state according to:
	// https://github.com/WICG/web-lifecycle/
	//
	// Note: This command is experimental.
	SetWebLifecycleState(context.Context, *page.SetWebLifecycleStateArgs) error

	// Command StopScreencast
	//
	// Stops sending each frame in the `screencastFrame`.
	//
	// Note: This command is experimental.
	StopScreencast(context.Context) error

	// Command ProduceCompilationCache
	//
	// Requests backend to produce compilation cache for the specified
	// scripts. `scripts` are appeneded to the list of scripts for which
	// the cache would be produced. The list may be reset during page
	// navigation. When script with a matching URL is encountered, the
	// cache is optionally produced upon backend discretion, based on
	// internal heuristics. See also: `Page.compilationCacheProduced`.
	//
	// Note: This command is experimental.
	ProduceCompilationCache(context.Context, *page.ProduceCompilationCacheArgs) error

	// Command AddCompilationCache
	//
	// Seeds compilation cache for given url. Compilation cache does not
	// survive cross-process navigation.
	//
	// Note: This command is experimental.
	AddCompilationCache(context.Context, *page.AddCompilationCacheArgs) error

	// Command ClearCompilationCache
	//
	// Clears seeded compilation cache.
	//
	// Note: This command is experimental.
	ClearCompilationCache(context.Context) error

	// Command SetSPCTransactionMode
	//
	// Sets the Secure Payment Confirmation transaction mode.
	// https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode
	//
	// Note: This command is experimental.
	SetSPCTransactionMode(context.Context, *page.SetSPCTransactionModeArgs) error

	// Command GenerateTestReport
	//
	// Generates a report for testing.
	//
	// Note: This command is experimental.
	GenerateTestReport(context.Context, *page.GenerateTestReportArgs) error

	// Command WaitForDebugger
	//
	// Pauses page execution. Can be resumed using generic
	// Runtime.runIfWaitingForDebugger.
	//
	// Note: This command is experimental.
	WaitForDebugger(context.Context) error

	// Command SetInterceptFileChooserDialog
	//
	// Intercept file chooser requests and transfer control to protocol
	// clients. When file chooser interception is enabled, native file
	// chooser dialog is not shown. Instead, a protocol event
	// `Page.fileChooserOpened` is emitted.
	//
	// Note: This command is experimental.
	SetInterceptFileChooserDialog(context.Context, *page.SetInterceptFileChooserDialogArgs) error

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

	// Event FileChooserOpened
	//
	// Emitted only when `page.interceptFileChooser` is enabled.
	FileChooserOpened(context.Context) (page.FileChooserOpenedClient, error)

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

	// Event FrameClearedScheduledNavigation
	//
	// Deprecated: Fired when frame no longer has a scheduled navigation.
	FrameClearedScheduledNavigation(context.Context) (page.FrameClearedScheduledNavigationClient, error)

	// Event FrameDetached
	//
	// Fired when frame has been detached from its parent.
	FrameDetached(context.Context) (page.FrameDetachedClient, 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 DocumentOpened
	//
	// Fired when opening document to write to.
	//
	// Note: This event is experimental.
	DocumentOpened(context.Context) (page.DocumentOpenedClient, error)

	// Event FrameResized
	//
	// Note: This event is experimental.
	FrameResized(context.Context) (page.FrameResizedClient, error)

	// Event FrameRequestedNavigation
	//
	// Fired when a renderer-initiated navigation is requested. Navigation
	// may still be canceled after the event is issued.
	//
	// Note: This event is experimental.
	FrameRequestedNavigation(context.Context) (page.FrameRequestedNavigationClient, error)

	// Event FrameScheduledNavigation
	//
	// Deprecated: Fired when frame schedules a potential navigation.
	FrameScheduledNavigation(context.Context) (page.FrameScheduledNavigationClient, error)

	// Event FrameStartedLoading
	//
	// Fired when frame has started loading.
	//
	// Note: This event is experimental.
	FrameStartedLoading(context.Context) (page.FrameStartedLoadingClient, error)

	// Event FrameStoppedLoading
	//
	// Fired when frame has stopped loading.
	//
	// Note: This event is experimental.
	FrameStoppedLoading(context.Context) (page.FrameStoppedLoadingClient, error)

	// Event DownloadWillBegin
	//
	// Deprecated: Fired when page is about to start a download.
	// Deprecated. Use Browser.downloadWillBegin instead.
	//
	// Note: This event is experimental.
	DownloadWillBegin(context.Context) (page.DownloadWillBeginClient, error)

	// Event DownloadProgress
	//
	// Deprecated: Fired when download makes progress. Last call has
	// |done| == true. Deprecated. Use Browser.downloadProgress instead.
	//
	// Note: This event is experimental.
	DownloadProgress(context.Context) (page.DownloadProgressClient, error)

	// Event InterstitialHidden
	//
	// Fired when interstitial page was hidden
	InterstitialHidden(context.Context) (page.InterstitialHiddenClient, error)

	// Event InterstitialShown
	//
	// Fired when interstitial page was shown
	InterstitialShown(context.Context) (page.InterstitialShownClient, error)

	// Event JavascriptDialogClosed
	//
	// Fired when a JavaScript initiated dialog (alert, confirm, prompt,
	// or onbeforeunload) has been closed.
	JavascriptDialogClosed(context.Context) (page.JavascriptDialogClosedClient, error)

	// Event JavascriptDialogOpening
	//
	// Fired when a JavaScript initiated dialog (alert, confirm, prompt,
	// or onbeforeunload) is about to open.
	JavascriptDialogOpening(context.Context) (page.JavascriptDialogOpeningClient, error)

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

	// Event BackForwardCacheNotUsed
	//
	// Fired for failed bfcache history navigations if BackForwardCache
	// feature is enabled. Do not assume any ordering with the
	// Page.frameNavigated event. This event is fired only for main-frame
	// history navigation where the document changes (non-same-document
	// navigations), when bfcache navigation fails.
	//
	// Note: This event is experimental.
	BackForwardCacheNotUsed(context.Context) (page.BackForwardCacheNotUsedClient, error)

	// Event PrerenderAttemptCompleted
	//
	// Fired when a prerender attempt is completed.
	PrerenderAttemptCompleted(context.Context) (page.PrerenderAttemptCompletedClient, error)

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

	// Event NavigatedWithinDocument
	//
	// Fired when same-document navigation happens, e.g. due to history
	// API usage or anchor navigation.
	//
	// Note: This event is experimental.
	NavigatedWithinDocument(context.Context) (page.NavigatedWithinDocumentClient, error)

	// Event ScreencastFrame
	//
	// Compressed image data requested by the `startScreencast`.
	//
	// Note: This event is experimental.
	ScreencastFrame(context.Context) (page.ScreencastFrameClient, error)

	// Event ScreencastVisibilityChanged
	//
	// Fired when the page with currently enabled screencast was shown or
	// hidden `.
	//
	// Note: This event is experimental.
	ScreencastVisibilityChanged(context.Context) (page.ScreencastVisibilityChangedClient, error)

	// Event WindowOpen
	//
	// Fired when a new window is going to be opened, via window.open(),
	// link click, form submission, etc.
	WindowOpen(context.Context) (page.WindowOpenClient, error)

	// Event CompilationCacheProduced
	//
	// Issued for every compilation cache generated. Is only available if
	// Page.setGenerateCompilationCache is enabled.
	//
	// Note: This event is experimental.
	CompilationCacheProduced(context.Context) (page.CompilationCacheProducedClient, error)
}

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

type Performance added in v0.11.1

type Performance interface {
	// Command Disable
	//
	// Disable collecting and reporting metrics.
	Disable(context.Context) error

	// Command Enable
	//
	// Enable collecting and reporting metrics.
	Enable(context.Context, *performance.EnableArgs) error

	// Command SetTimeDomain
	//
	// Deprecated: Sets time domain to use for collecting and reporting
	// duration metrics. Note that this must be called before enabling
	// metrics collection. Calling this method while metrics collection is
	// enabled returns an error.
	//
	// Note: This command is experimental.
	SetTimeDomain(context.Context, *performance.SetTimeDomainArgs) 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 PerformanceTimeline added in v0.31.0

type PerformanceTimeline interface {
	// Command Enable
	//
	// Previously buffered events would be reported before method returns.
	// See also: timelineEventAdded
	Enable(context.Context, *performancetimeline.EnableArgs) error

	// Event TimelineEventAdded
	//
	// Sent when a performance timeline event is added. See
	// reportPerformanceTimeline method.
	TimelineEventAdded(context.Context) (performancetimeline.TimelineEventAddedClient, error)
}

The PerformanceTimeline domain. Reporting of performance timeline events, as specified in https://w3c.github.io/performance-timeline/#dom-performanceobserver.

Note: This domain is experimental.

type Profiler

type Profiler interface {
	// Command Disable
	Disable(context.Context) error

	// Command Enable
	Enable(context.Context) error

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

	// Command SetSamplingInterval
	//
	// Changes CPU profiler sampling interval. Must be called before CPU
	// profiles recording started.
	SetSamplingInterval(context.Context, *profiler.SetSamplingIntervalArgs) error

	// Command Start
	Start(context.Context) error

	// Command StartPreciseCoverage
	//
	// Enable precise code coverage. Coverage data for JavaScript executed
	// before enabling precise code coverage may be incomplete. Enabling
	// prevents running optimized code and resets execution counters.
	StartPreciseCoverage(context.Context, *profiler.StartPreciseCoverageArgs) (*profiler.StartPreciseCoverageReply, error)

	// Command StartTypeProfile
	//
	// Enable type profile.
	//
	// Note: This command is experimental.
	StartTypeProfile(context.Context) error

	// Command Stop
	Stop(context.Context) (*profiler.StopReply, error)

	// Command StopPreciseCoverage
	//
	// Disable precise code coverage. Disabling releases unnecessary
	// execution count records and allows executing optimized code.
	StopPreciseCoverage(context.Context) error

	// Command StopTypeProfile
	//
	// Disable type profile. Disabling releases type profile data
	// collected so far.
	//
	// Note: This command is experimental.
	StopTypeProfile(context.Context) error

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

	// Command TakeTypeProfile
	//
	// Collect type profile.
	//
	// Note: This command is experimental.
	TakeTypeProfile(context.Context) (*profiler.TakeTypeProfileReply, error)

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

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

	// Event PreciseCoverageDeltaUpdate
	//
	// Reports coverage delta since the last poll (either from an event
	// like this, or from `takePreciseCoverage` for the current isolate.
	// May only be sent if precise code coverage has been started. This
	// event can be trigged by the embedder to, for example, trigger
	// collection of coverage data immediately at a certain point in time.
	//
	// Note: This event is experimental.
	PreciseCoverageDeltaUpdate(context.Context) (profiler.PreciseCoverageDeltaUpdateClient, error)
}

The Profiler domain.

type Runtime

type Runtime interface {
	// Command AwaitPromise
	//
	// Add handler to promise with given promise object id.
	AwaitPromise(context.Context, *runtime.AwaitPromiseArgs) (*runtime.AwaitPromiseReply, error)

	// Command CallFunctionOn
	//
	// Calls function with given declaration on the given object. Object
	// group of the result is inherited from the target object.
	CallFunctionOn(context.Context, *runtime.CallFunctionOnArgs) (*runtime.CallFunctionOnReply, error)

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

	// Command Disable
	//
	// Disables reporting of execution contexts creation.
	Disable(context.Context) error

	// Command DiscardConsoleEntries
	//
	// Discards collected exceptions and console API calls.
	DiscardConsoleEntries(context.Context) error

	// Command Enable
	//
	// Enables reporting of execution contexts creation by means of
	// `executionContextCreated` event. When the reporting gets enabled the
	// event will be sent immediately for each existing execution context.
	Enable(context.Context) error

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

	// Command GetIsolateID
	//
	// Returns the isolate id.
	//
	// Note: This command is experimental.
	GetIsolateID(context.Context) (*runtime.GetIsolateIDReply, error)

	// Command GetHeapUsage
	//
	// Returns the JavaScript heap usage. It is the total usage of the
	// corresponding isolate not scoped to a particular Runtime.
	//
	// Note: This command is experimental.
	GetHeapUsage(context.Context) (*runtime.GetHeapUsageReply, error)

	// Command GetProperties
	//
	// Returns properties of a given object. Object group of the result is
	// inherited from the target object.
	GetProperties(context.Context, *runtime.GetPropertiesArgs) (*runtime.GetPropertiesReply, error)

	// Command GlobalLexicalScopeNames
	//
	// Returns all let, const and class variables from global scope.
	GlobalLexicalScopeNames(context.Context, *runtime.GlobalLexicalScopeNamesArgs) (*runtime.GlobalLexicalScopeNamesReply, error)

	// Command QueryObjects
	QueryObjects(context.Context, *runtime.QueryObjectsArgs) (*runtime.QueryObjectsReply, error)

	// Command ReleaseObject
	//
	// Releases remote object with given id.
	ReleaseObject(context.Context, *runtime.ReleaseObjectArgs) error

	// Command ReleaseObjectGroup
	//
	// Releases all remote objects that belong to a given group.
	ReleaseObjectGroup(context.Context, *runtime.ReleaseObjectGroupArgs) error

	// Command RunIfWaitingForDebugger
	//
	// Tells inspected instance to run if it was waiting for debugger to
	// attach.
	RunIfWaitingForDebugger(context.Context) error

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

	// Command SetCustomObjectFormatterEnabled
	//
	// Note: This command is experimental.
	SetCustomObjectFormatterEnabled(context.Context, *runtime.SetCustomObjectFormatterEnabledArgs) error

	// Command SetMaxCallStackSizeToCapture
	//
	// Note: This command is experimental.
	SetMaxCallStackSizeToCapture(context.Context, *runtime.SetMaxCallStackSizeToCaptureArgs) error

	// Command TerminateExecution
	//
	// Terminate current or next JavaScript execution. Will cancel the
	// termination when the outer-most script execution ends.
	//
	// Note: This command is experimental.
	TerminateExecution(context.Context) error

	// Command AddBinding
	//
	// If executionContextId is empty, adds binding with the given name on
	// the global objects of all inspected contexts, including those
	// created later, bindings survive reloads. Binding function takes
	// exactly one argument, this argument should be string, in case of any
	// other input, function throws an exception. Each binding function
	// call produces Runtime.bindingCalled notification.
	//
	// Note: This command is experimental.
	AddBinding(context.Context, *runtime.AddBindingArgs) error

	// Command RemoveBinding
	//
	// This method does not remove binding function from global object but
	// unsubscribes current runtime agent from Runtime.bindingCalled
	// notifications.
	//
	// Note: This command is experimental.
	RemoveBinding(context.Context, *runtime.RemoveBindingArgs) error

	// Command GetExceptionDetails
	//
	// This method tries to lookup and populate exception details for a
	// JavaScript Error object. Note that the stackTrace portion of the
	// resulting exceptionDetails will only be populated if the Runtime
	// domain was enabled at the time when the Error was thrown.
	//
	// Note: This command is experimental.
	GetExceptionDetails(context.Context, *runtime.GetExceptionDetailsArgs) (*runtime.GetExceptionDetailsReply, error)

	// Event BindingCalled
	//
	// Notification is issued every time when binding is called.
	//
	// Note: This event is experimental.
	BindingCalled(context.Context) (runtime.BindingCalledClient, error)

	// Event ConsoleAPICalled
	//
	// Issued when console API was called.
	ConsoleAPICalled(context.Context) (runtime.ConsoleAPICalledClient, error)

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

	// Event ExceptionThrown
	//
	// Issued when exception was thrown and unhandled.
	ExceptionThrown(context.Context) (runtime.ExceptionThrownClient, error)

	// Event ExecutionContextCreated
	//
	// Issued when new execution context is created.
	ExecutionContextCreated(context.Context) (runtime.ExecutionContextCreatedClient, error)

	// Event ExecutionContextDestroyed
	//
	// Issued when execution context is destroyed.
	ExecutionContextDestroyed(context.Context) (runtime.ExecutionContextDestroyedClient, error)

	// Event ExecutionContextsCleared
	//
	// Issued when all executionContexts were cleared in browser
	ExecutionContextsCleared(context.Context) (runtime.ExecutionContextsClearedClient, error)

	// Event InspectRequested
	//
	// Issued when object should be inspected (for example, as a result of
	// inspect() command line API call).
	InspectRequested(context.Context) (runtime.InspectRequestedClient, error)
}

The Runtime domain. Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.

type Schema deprecated

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

The Schema domain.

Deprecated: This domain is deprecated.

type Security

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

	// Command Enable
	//
	// Enables tracking security state changes.
	Enable(context.Context) error

	// Command SetIgnoreCertificateErrors
	//
	// Enable/disable whether all certificate errors should be ignored.
	//
	// Note: This command is experimental.
	SetIgnoreCertificateErrors(context.Context, *security.SetIgnoreCertificateErrorsArgs) error

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

	// Command SetOverrideCertificateErrors
	//
	// Deprecated: Enable/disable overriding certificate errors. If
	// enabled, all certificate error events need to be handled by the
	// DevTools client and should be answered with `handleCertificateError`
	// commands.
	SetOverrideCertificateErrors(context.Context, *security.SetOverrideCertificateErrorsArgs) error

	// Event CertificateError
	//
	// Deprecated: There is a certificate error. If overriding certificate
	// errors is enabled, then it should be handled with the
	// `handleCertificateError` command. Note: this event does not fire if
	// the certificate error has been allowed internally. Only one client
	// per target should override certificate errors at the same time.
	CertificateError(context.Context) (security.CertificateErrorClient, error)

	// Event VisibleSecurityStateChanged
	//
	// The security state of the page changed.
	//
	// Note: This event is experimental.
	VisibleSecurityStateChanged(context.Context) (security.VisibleSecurityStateChangedClient, error)

	// Event SecurityStateChanged
	//
	// Deprecated: The security state of the page changed. No longer being
	// sent.
	SecurityStateChanged(context.Context) (security.StateChangedClient, error)
}

The Security domain. Security

type ServiceWorker

type ServiceWorker interface {
	// Command DeliverPushMessage
	DeliverPushMessage(context.Context, *serviceworker.DeliverPushMessageArgs) error

	// Command Disable
	Disable(context.Context) error

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

	// Command DispatchPeriodicSyncEvent
	DispatchPeriodicSyncEvent(context.Context, *serviceworker.DispatchPeriodicSyncEventArgs) error

	// Command Enable
	Enable(context.Context) error

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

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

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

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

	// Command StopAllWorkers
	StopAllWorkers(context.Context) error

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

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

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

	// Event WorkerErrorReported
	WorkerErrorReported(context.Context) (serviceworker.WorkerErrorReportedClient, error)

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

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

The ServiceWorker domain.

Note: This domain is experimental.

type Storage

type Storage interface {
	// Command GetStorageKeyForFrame
	//
	// Returns a storage key given a frame id.
	GetStorageKeyForFrame(context.Context, *storage.GetStorageKeyForFrameArgs) (*storage.GetStorageKeyForFrameReply, error)

	// Command ClearDataForOrigin
	//
	// Clears storage for origin.
	ClearDataForOrigin(context.Context, *storage.ClearDataForOriginArgs) error

	// Command GetCookies
	//
	// Returns all browser cookies.
	GetCookies(context.Context, *storage.GetCookiesArgs) (*storage.GetCookiesReply, error)

	// Command SetCookies
	//
	// Sets given cookies.
	SetCookies(context.Context, *storage.SetCookiesArgs) error

	// Command ClearCookies
	//
	// Clears cookies.
	ClearCookies(context.Context, *storage.ClearCookiesArgs) error

	// Command GetUsageAndQuota
	//
	// Returns usage and quota in bytes.
	GetUsageAndQuota(context.Context, *storage.GetUsageAndQuotaArgs) (*storage.GetUsageAndQuotaReply, error)

	// Command OverrideQuotaForOrigin
	//
	// Override quota for the specified origin
	//
	// Note: This command is experimental.
	OverrideQuotaForOrigin(context.Context, *storage.OverrideQuotaForOriginArgs) error

	// Command TrackCacheStorageForOrigin
	//
	// Registers origin to be notified when an update occurs to its cache
	// storage list.
	TrackCacheStorageForOrigin(context.Context, *storage.TrackCacheStorageForOriginArgs) error

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

	// Command UntrackCacheStorageForOrigin
	//
	// Unregisters origin from receiving notifications for cache storage.
	UntrackCacheStorageForOrigin(context.Context, *storage.UntrackCacheStorageForOriginArgs) error

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

	// Command GetTrustTokens
	//
	// Returns the number of stored Trust Tokens per issuer for the
	// current browsing context.
	//
	// Note: This command is experimental.
	GetTrustTokens(context.Context) (*storage.GetTrustTokensReply, error)

	// Command ClearTrustTokens
	//
	// Removes all Trust Tokens issued by the provided issuerOrigin.
	// Leaves other stored data, including the issuer's Redemption Records,
	// intact.
	//
	// Note: This command is experimental.
	ClearTrustTokens(context.Context, *storage.ClearTrustTokensArgs) (*storage.ClearTrustTokensReply, error)

	// Command GetInterestGroupDetails
	//
	// Gets details for a named interest group.
	//
	// Note: This command is experimental.
	GetInterestGroupDetails(context.Context, *storage.GetInterestGroupDetailsArgs) (*storage.GetInterestGroupDetailsReply, error)

	// Command SetInterestGroupTracking
	//
	// Enables/Disables issuing of interestGroupAccessed events.
	//
	// Note: This command is experimental.
	SetInterestGroupTracking(context.Context, *storage.SetInterestGroupTrackingArgs) error

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

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

	// Event IndexedDBContentUpdated
	//
	// The origin's IndexedDB object store has been modified.
	IndexedDBContentUpdated(context.Context) (storage.IndexedDBContentUpdatedClient, error)

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

	// Event InterestGroupAccessed
	//
	// One of the interest groups was accessed by the associated page.
	InterestGroupAccessed(context.Context) (storage.InterestGroupAccessedClient, 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)

	// Command GetProcessInfo
	//
	// Returns information about all running processes.
	GetProcessInfo(context.Context) (*systeminfo.GetProcessInfoReply, error)
}

The SystemInfo domain. The SystemInfo domain defines methods and events for querying low-level system information.

Note: This domain is experimental.

type Target

type Target interface {
	// Command ActivateTarget
	//
	// Activates (focuses) the target.
	ActivateTarget(context.Context, *target.ActivateTargetArgs) error

	// Command AttachToTarget
	//
	// Attaches to the target with given id.
	AttachToTarget(context.Context, *target.AttachToTargetArgs) (*target.AttachToTargetReply, error)

	// Command AttachToBrowserTarget
	//
	// Attaches to the browser target, only uses flat sessionId mode.
	//
	// Note: This command is experimental.
	AttachToBrowserTarget(context.Context) (*target.AttachToBrowserTargetReply, error)

	// Command CloseTarget
	//
	// Closes the target. If the target is a page that gets closed too.
	CloseTarget(context.Context, *target.CloseTargetArgs) (*target.CloseTargetReply, error)

	// Command ExposeDevToolsProtocol
	//
	// Inject object to the target's main frame that provides a
	// communication channel with browser target.
	//
	// Injected object will be available as `window[bindingName]`.
	//
	// The object has the follwing API: - `binding.send(json)` - a method
	// to send messages over the remote debugging protocol -
	// `binding.onmessage = json => handleMessage(json)` - a callback that
	// will be called for the protocol notifications and command responses.
	//
	// Note: This command is experimental.
	ExposeDevToolsProtocol(context.Context, *target.ExposeDevToolsProtocolArgs) error

	// Command CreateBrowserContext
	//
	// Creates a new empty BrowserContext. Similar to an incognito profile
	// but you can have more than one.
	//
	// Note: This command is experimental.
	CreateBrowserContext(context.Context, *target.CreateBrowserContextArgs) (*target.CreateBrowserContextReply, error)

	// Command GetBrowserContexts
	//
	// Returns all browser contexts created with
	// `Target.createBrowserContext` method.
	//
	// Note: This command is experimental.
	GetBrowserContexts(context.Context) (*target.GetBrowserContextsReply, error)

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

	// Command DetachFromTarget
	//
	// Detaches session with given id.
	DetachFromTarget(context.Context, *target.DetachFromTargetArgs) error

	// Command DisposeBrowserContext
	//
	// Deletes a BrowserContext. All the belonging pages will be closed
	// without calling their beforeunload hooks.
	//
	// Note: This command is experimental.
	DisposeBrowserContext(context.Context, *target.DisposeBrowserContextArgs) error

	// Command GetTargetInfo
	//
	// Returns information about a target.
	//
	// Note: This command is experimental.
	GetTargetInfo(context.Context, *target.GetTargetInfoArgs) (*target.GetTargetInfoReply, error)

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

	// Command SendMessageToTarget
	//
	// Deprecated: Sends protocol message over session with given id.
	// Consider using flat mode instead; see commands attachToTarget,
	// setAutoAttach, and crbug.com/991325.
	SendMessageToTarget(context.Context, *target.SendMessageToTargetArgs) error

	// Command SetAutoAttach
	//
	// Controls whether to automatically attach to new targets which are
	// considered to be related to this one. When turned on, attaches to
	// all existing related targets as well. When turned off, automatically
	// detaches from all currently attached targets. This also clears all
	// targets added by `autoAttachRelated` from the list of targets to
	// watch for creation of related targets.
	//
	// Note: This command is experimental.
	SetAutoAttach(context.Context, *target.SetAutoAttachArgs) error

	// Command AutoAttachRelated
	//
	// Adds the specified target to the list of targets that will be
	// monitored for any related target creation (such as child frames,
	// child workers and new versions of service worker) and reported
	// through `attachedToTarget`. The specified target is also
	// auto-attached. This cancels the effect of any previous
	// `setAutoAttach` and is also canceled by subsequent `setAutoAttach`.
	// Only available at the Browser target.
	//
	// Note: This command is experimental.
	AutoAttachRelated(context.Context, *target.AutoAttachRelatedArgs) error

	// Command SetDiscoverTargets
	//
	// Controls whether to discover available targets and notify via
	// `targetCreated/targetInfoChanged/targetDestroyed` events.
	SetDiscoverTargets(context.Context, *target.SetDiscoverTargetsArgs) error

	// Command SetRemoteLocations
	//
	// Enables target discovery for the specified locations, when
	// `setDiscoverTargets` was set to `true`.
	//
	// Note: This command is experimental.
	SetRemoteLocations(context.Context, *target.SetRemoteLocationsArgs) error

	// Event AttachedToTarget
	//
	// Issued when attached to target because of auto-attach or
	// `attachToTarget` command.
	//
	// Note: This event is experimental.
	AttachedToTarget(context.Context) (target.AttachedToTargetClient, error)

	// Event DetachedFromTarget
	//
	// Issued when detached from target for any reason (including
	// `detachFromTarget` command). Can be issued multiple times per target
	// if multiple sessions have been attached to it.
	//
	// Note: This event is experimental.
	DetachedFromTarget(context.Context) (target.DetachedFromTargetClient, error)

	// Event ReceivedMessageFromTarget
	//
	// Notifies about a new protocol message received from the session (as
	// reported in `attachedToTarget` event).
	ReceivedMessageFromTarget(context.Context) (target.ReceivedMessageFromTargetClient, error)

	// Event TargetCreated
	//
	// Issued when a possible inspection target is created.
	TargetCreated(context.Context) (target.CreatedClient, error)

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

	// Event TargetCrashed
	//
	// Issued when a target has crashed.
	TargetCrashed(context.Context) (target.CrashedClient, error)

	// Event TargetInfoChanged
	//
	// Issued when some information about a target has changed. This only
	// happens between `targetCreated` and `targetDestroyed`.
	TargetInfoChanged(context.Context) (target.InfoChangedClient, error)
}

The Target domain. Supports additional targets discovery and allows to attach to them.

type Tethering

type Tethering interface {
	// Command Bind
	//
	// Request browser port binding.
	Bind(context.Context, *tethering.BindArgs) error

	// Command Unbind
	//
	// Request browser port unbinding.
	Unbind(context.Context, *tethering.UnbindArgs) error

	// Event Accepted
	//
	// Informs that port was successfully bound and got a specified
	// connection id.
	Accepted(context.Context) (tethering.AcceptedClient, error)
}

The Tethering domain. The Tethering domain defines methods and events for browser port binding.

Note: This domain is experimental.

type Tracing

type Tracing interface {
	// Command End
	//
	// Stop trace events collection.
	End(context.Context) error

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

	// Command RecordClockSyncMarker
	//
	// Record a clock sync marker in the trace.
	RecordClockSyncMarker(context.Context, *tracing.RecordClockSyncMarkerArgs) error

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

	// Command Start
	//
	// Start trace events collection.
	Start(context.Context, *tracing.StartArgs) error

	// Event BufferUsage
	BufferUsage(context.Context) (tracing.BufferUsageClient, error)

	// Event DataCollected
	//
	// Contains an bucket of collected trace events. When tracing is
	// stopped collected events will be send as a sequence of dataCollected
	// events followed by tracingComplete event.
	DataCollected(context.Context) (tracing.DataCollectedClient, error)

	// Event TracingComplete
	//
	// Signals that tracing is stopped and there is no trace buffers
	// pending flush, all data were delivered via dataCollected events.
	TracingComplete(context.Context) (tracing.CompleteClient, error)
}

The Tracing domain.

Note: This domain is experimental.

type WebAudio added in v0.23.2

type WebAudio interface {
	// Command Enable
	//
	// Enables the WebAudio domain and starts sending context lifetime
	// events.
	Enable(context.Context) error

	// Command Disable
	//
	// Disables the WebAudio domain.
	Disable(context.Context) error

	// Command GetRealtimeData
	//
	// Fetch the realtime data from the registered contexts.
	GetRealtimeData(context.Context, *webaudio.GetRealtimeDataArgs) (*webaudio.GetRealtimeDataReply, error)

	// Event ContextCreated
	//
	// Notifies that a new BaseAudioContext has been created.
	ContextCreated(context.Context) (webaudio.ContextCreatedClient, error)

	// Event ContextWillBeDestroyed
	//
	// Notifies that an existing BaseAudioContext will be destroyed.
	ContextWillBeDestroyed(context.Context) (webaudio.ContextWillBeDestroyedClient, error)

	// Event ContextChanged
	//
	// Notifies that existing BaseAudioContext has changed some properties
	// (id stays the same)..
	ContextChanged(context.Context) (webaudio.ContextChangedClient, error)

	// Event AudioListenerCreated
	//
	// Notifies that the construction of an AudioListener has finished.
	AudioListenerCreated(context.Context) (webaudio.AudioListenerCreatedClient, error)

	// Event AudioListenerWillBeDestroyed
	//
	// Notifies that a new AudioListener has been created.
	AudioListenerWillBeDestroyed(context.Context) (webaudio.AudioListenerWillBeDestroyedClient, error)

	// Event AudioNodeCreated
	//
	// Notifies that a new AudioNode has been created.
	AudioNodeCreated(context.Context) (webaudio.AudioNodeCreatedClient, error)

	// Event AudioNodeWillBeDestroyed
	//
	// Notifies that an existing AudioNode has been destroyed.
	AudioNodeWillBeDestroyed(context.Context) (webaudio.AudioNodeWillBeDestroyedClient, error)

	// Event AudioParamCreated
	//
	// Notifies that a new AudioParam has been created.
	AudioParamCreated(context.Context) (webaudio.AudioParamCreatedClient, error)

	// Event AudioParamWillBeDestroyed
	//
	// Notifies that an existing AudioParam has been destroyed.
	AudioParamWillBeDestroyed(context.Context) (webaudio.AudioParamWillBeDestroyedClient, error)

	// Event NodesConnected
	//
	// Notifies that two AudioNodes are connected.
	NodesConnected(context.Context) (webaudio.NodesConnectedClient, error)

	// Event NodesDisconnected
	//
	// Notifies that AudioNodes are disconnected. The destination can be
	// null, and it means all the outgoing connections from the source are
	// disconnected.
	NodesDisconnected(context.Context) (webaudio.NodesDisconnectedClient, error)

	// Event NodeParamConnected
	//
	// Notifies that an AudioNode is connected to an AudioParam.
	NodeParamConnected(context.Context) (webaudio.NodeParamConnectedClient, error)

	// Event NodeParamDisconnected
	//
	// Notifies that an AudioNode is disconnected to an AudioParam.
	NodeParamDisconnected(context.Context) (webaudio.NodeParamDisconnectedClient, error)
}

The WebAudio domain. This domain allows inspection of Web Audio API. https://webaudio.github.io/web-audio-api/

Note: This domain is experimental.

type WebAuthn added in v0.23.3

type WebAuthn interface {
	// Command Enable
	//
	// Enable the WebAuthn domain and start intercepting credential
	// storage and retrieval with a virtual authenticator.
	Enable(context.Context, *webauthn.EnableArgs) error

	// Command Disable
	//
	// Disable the WebAuthn domain.
	Disable(context.Context) error

	// Command AddVirtualAuthenticator
	//
	// Creates and adds a virtual authenticator.
	AddVirtualAuthenticator(context.Context, *webauthn.AddVirtualAuthenticatorArgs) (*webauthn.AddVirtualAuthenticatorReply, error)

	// Command RemoveVirtualAuthenticator
	//
	// Removes the given authenticator.
	RemoveVirtualAuthenticator(context.Context, *webauthn.RemoveVirtualAuthenticatorArgs) error

	// Command AddCredential
	//
	// Adds the credential to the specified authenticator.
	AddCredential(context.Context, *webauthn.AddCredentialArgs) error

	// Command GetCredential
	//
	// Returns a single credential stored in the given virtual
	// authenticator that matches the credential ID.
	GetCredential(context.Context, *webauthn.GetCredentialArgs) (*webauthn.GetCredentialReply, error)

	// Command GetCredentials
	//
	// Returns all the credentials stored in the given virtual
	// authenticator.
	GetCredentials(context.Context, *webauthn.GetCredentialsArgs) (*webauthn.GetCredentialsReply, error)

	// Command RemoveCredential
	//
	// Removes a credential from the authenticator.
	RemoveCredential(context.Context, *webauthn.RemoveCredentialArgs) error

	// Command ClearCredentials
	//
	// Clears all the credentials from the specified device.
	ClearCredentials(context.Context, *webauthn.ClearCredentialsArgs) error

	// Command SetUserVerified
	//
	// Sets whether User Verification succeeds or fails for an
	// authenticator. The default is true.
	SetUserVerified(context.Context, *webauthn.SetUserVerifiedArgs) error

	// Command SetAutomaticPresenceSimulation
	//
	// Sets whether tests of user presence will succeed immediately (if
	// true) or fail to resolve (if false) for an authenticator. The
	// default is true.
	SetAutomaticPresenceSimulation(context.Context, *webauthn.SetAutomaticPresenceSimulationArgs) error
}

The WebAuthn domain. This domain allows configuring virtual authenticators to test the WebAuthn API.

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/proto
Package proto is used to parse the CDP protocol definitions (JSON).
Package proto is used to parse the CDP protocol definitions (JSON).
Package devtool provides methods for interacting with a DevTools endpoint.
Package devtool provides methods for interacting with a DevTools endpoint.
example
internal
Package protocol contains subpackages representing all domains for the Chrome DevTools Protocol.
Package protocol contains subpackages representing all domains for the Chrome DevTools 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.
backgroundservice
Package backgroundservice implements the BackgroundService domain.
Package backgroundservice implements the BackgroundService 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.
cast
Package cast implements the Cast domain.
Package cast implements the Cast 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.
eventbreakpoints
Package eventbreakpoints implements the EventBreakpoints domain.
Package eventbreakpoints implements the EventBreakpoints domain.
fetch
Package fetch implements the Fetch domain.
Package fetch implements the Fetch 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.
media
Package media implements the Media domain.
Package media implements the Media 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.
performancetimeline
Package performancetimeline implements the PerformanceTimeline domain.
Package performancetimeline implements the PerformanceTimeline 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.
webaudio
Package webaudio implements the WebAudio domain.
Package webaudio implements the WebAudio domain.
webauthn
Package webauthn implements the WebAuthn domain.
Package webauthn implements the WebAuthn domain.
Package rpcc provides an RPC client connection with support for the JSON-RPC 2.0 specification, not including Batch requests.
Package rpcc provides an RPC client connection with support for the JSON-RPC 2.0 specification, not including Batch requests.
Package session implements a session Manager for establishing session connections to targets (via the Target domain).
Package session implements a session Manager for establishing session connections to targets (via the Target domain).

Jump to

Keyboard shortcuts

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