chromedp: github.com/chromedp/chromedp Index | Examples | Files | Directories

package chromedp

import "github.com/chromedp/chromedp"

Package chromedp is a high level Chrome DevTools Protocol client that simplifies driving browsers for scraping, unit testing, or profiling web pages using the CDP.

chromedp requires no third-party dependencies, implementing the async Chrome DevTools Protocol entirely in Go.

This package includes a number of simple examples. Additionally, https://github.com/chromedp/examples contains more complex examples.

Code:

ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()

ts := httptest.NewServer(writeHTML(`<!doctype html>
<html>
<body>
  <div id="content">the content</div>
</body>
</html>`))
defer ts.Close()

const expr = `(function(d, id, v) {
		var b = d.querySelector('body');
		var el = d.createElement('div');
		el.id = id;
		el.innerText = v;
		b.insertBefore(el, b.childNodes[0]);
	})(document, %q, %q);`

var nodes []*cdp.Node
if err := chromedp.Run(ctx,
    chromedp.Navigate(ts.URL),
    chromedp.Nodes(`document`, &nodes, chromedp.ByJSPath),
    chromedp.WaitVisible(`#content`),
    chromedp.ActionFunc(func(ctx context.Context) error {
        s := fmt.Sprintf(expr, "thing", "a new thing!")
        _, exp, err := runtime.Evaluate(s).Do(ctx)
        if err != nil {
            return err
        }
        if exp != nil {
            return exp
        }
        return nil
    }),
    chromedp.WaitVisible(`#thing`),
); err != nil {
    panic(err)
}

fmt.Println("Document tree:")
fmt.Print(nodes[0].Dump("  ", "  ", false))

Output:

Document tree:
  #document <Document>
    html <DocumentType>
    html
      head
      body
        div#thing
          #text "a new thing!"
        div#content
          #text "the content"

Code:

ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()

ts := httptest.NewServer(writeHTML(`
<body>
<p id="content" onclick="changeText()">Original content.</p>
<script>
function changeText() {
	document.getElementById("content").textContent = "New content!"
}
</script>
</body>
	`))
defer ts.Close()

var outerBefore, outerAfter string
if err := chromedp.Run(ctx,
    chromedp.Navigate(ts.URL),
    chromedp.OuterHTML("#content", &outerBefore),
    chromedp.Click("#content", chromedp.ByID),
    chromedp.OuterHTML("#content", &outerAfter),
); err != nil {
    panic(err)
}
fmt.Println("OuterHTML before clicking:")
fmt.Println(outerBefore)
fmt.Println("OuterHTML after clicking:")
fmt.Println(outerAfter)

Output:

OuterHTML before clicking:
<p id="content" onclick="changeText()">Original content.</p>
OuterHTML after clicking:
<p id="content" onclick="changeText()">New content!</p>

Index

Examples

Package Files

allocate.go allocate_linux.go browser.go browser_easyjson.go chromedp.go conn.go emulate.go errors.go eval.go input.go js.go nav.go query.go target.go util.go

Variables

var DefaultExecAllocatorOptions = [...]ExecAllocatorOption{
    NoFirstRun,
    NoDefaultBrowserCheck,
    Headless,

    Flag("disable-background-networking", true),
    Flag("enable-features", "NetworkService,NetworkServiceInProcess"),
    Flag("disable-background-timer-throttling", true),
    Flag("disable-backgrounding-occluded-windows", true),
    Flag("disable-breakpad", true),
    Flag("disable-client-side-phishing-detection", true),
    Flag("disable-default-apps", true),
    Flag("disable-dev-shm-usage", true),
    Flag("disable-extensions", true),
    Flag("disable-features", "site-per-process,TranslateUI,BlinkGenPropertyTrees"),
    Flag("disable-hang-monitor", true),
    Flag("disable-ipc-flooding-protection", true),
    Flag("disable-popup-blocking", true),
    Flag("disable-prompt-on-repost", true),
    Flag("disable-renderer-backgrounding", true),
    Flag("disable-sync", true),
    Flag("force-color-profile", "srgb"),
    Flag("metrics-recording-only", true),
    Flag("safebrowsing-disable-auto-update", true),
    Flag("enable-automation", true),
    Flag("password-store", "basic"),
    Flag("use-mock-keychain", true),
}

DefaultExecAllocatorOptions are the ExecAllocator options used by NewContext if the given parent context doesn't have an allocator set up. Do not modify this global; instead, use NewExecAllocator. See ExampleExecAllocator.

func ButtonLeft Uses

func ButtonLeft(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams

ButtonLeft is a mouse action option to set the button clicked as the left mouse button.

func ButtonMiddle Uses

func ButtonMiddle(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams

ButtonMiddle is a mouse action option to set the button clicked as the middle mouse button.

func ButtonNone Uses

func ButtonNone(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams

ButtonNone is a mouse action option to set the button clicked as none (used for mouse movements).

func ButtonRight Uses

func ButtonRight(p *input.DispatchMouseEventParams) *input.DispatchMouseEventParams

ButtonRight is a mouse action option to set the button clicked as the right mouse button.

func ByID Uses

func ByID(s *Selector)

ByID is an element query option to select a single element by its CSS #id.

Similar to calling document.querySelector('#' + ID) in the browser.

func ByJSPath Uses

func ByJSPath(s *Selector)

ByJSPath is an element query option to select elements by the "JS Path" value (as shown in the Chrome DevTools UI).

Allows for the direct querying of DOM elements that otherwise cannot be retrieved using the other By* funcs, such as ShadowDOM elements.

Note: Do not use with an untrusted selector value, as any defined selector will be passed to runtime.Evaluate.

Code:

ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()

ts := httptest.NewServer(writeHTML(`
<body>
	<div id="content">cool content</div>
</body>
	`))
defer ts.Close()

var ids []cdp.NodeID
var html string
if err := chromedp.Run(ctx,
    chromedp.Navigate(ts.URL),
    chromedp.NodeIDs(`document`, &ids, chromedp.ByJSPath),
    chromedp.ActionFunc(func(ctx context.Context) error {
        var err error
        html, err = dom.GetOuterHTML().WithNodeID(ids[0]).Do(ctx)
        return err
    }),
); err != nil {
    panic(err)
}

fmt.Println("Outer HTML:")
fmt.Println(html)

Output:

Outer HTML:
<html><head></head><body>
	<div id="content">cool content</div>
</body></html>

func ByNodeID Uses

func ByNodeID(s *Selector)

ByNodeID is an element query option to select elements by their node IDs.

Uses DOM.requestChildNodes to retrieve elements with specific node IDs.

Note: must be used with []cdp.NodeID.

func ByQuery Uses

func ByQuery(s *Selector)

ByQuery is an element query action option to select a single element by the DOM.querySelector command.

Similar to calling document.querySelector() in the browser.

func ByQueryAll Uses

func ByQueryAll(s *Selector)

ByQueryAll is an element query action option to select elements by the DOM.querySelectorAll command.

Similar to calling document.querySelectorAll() in the browser.

func BySearch Uses

func BySearch(s *Selector)

BySearch is an element query option to select elements by the DOM.performSearch command. Works with both CSS and XPath queries.

func Cancel Uses

func Cancel(ctx context.Context) error

Cancel cancels a chromedp context, waits for its resources to be cleaned up, and returns any error encountered during that process.

Usually a "defer cancel()" will be enough for most use cases. This API is useful if you want to catch underlying cancel errors, such as when a temporary directory cannot be deleted.

func DisableGPU Uses

func DisableGPU(a *ExecAllocator)

DisableGPU is the command line option to disable the GPU process.

func EmulateLandscape Uses

func EmulateLandscape(p1 *emulation.SetDeviceMetricsOverrideParams, p2 *emulation.SetTouchEmulationEnabledParams)

EmulateLandscape is an emulate viewport option to set the device viewport screen orientation in landscape primary mode and an angle of 90.

func EmulateMobile Uses

func EmulateMobile(p1 *emulation.SetDeviceMetricsOverrideParams, p2 *emulation.SetTouchEmulationEnabledParams)

EmulateMobile is an emulate viewport option to toggle the device viewport to display as a mobile device.

func EmulatePortrait Uses

func EmulatePortrait(p1 *emulation.SetDeviceMetricsOverrideParams, p2 *emulation.SetTouchEmulationEnabledParams)

EmulatePortrait is an emulate viewport option to set the device viewport screen orentation in portrait primary mode and an angle of 0.

func EmulateTouch Uses

func EmulateTouch(p1 *emulation.SetDeviceMetricsOverrideParams, p2 *emulation.SetTouchEmulationEnabledParams)

EmulateTouch is an emulate viewport option to enable touch emulation.

func EvalAsValue Uses

func EvalAsValue(p *runtime.EvaluateParams) *runtime.EvaluateParams

EvalAsValue is a evaluate option that will cause the evaluated Javascript expression to encode the result of the expression as a JSON-encoded value.

func EvalIgnoreExceptions Uses

func EvalIgnoreExceptions(p *runtime.EvaluateParams) *runtime.EvaluateParams

EvalIgnoreExceptions is a evaluate option that will cause Javascript evaluation to ignore exceptions.

func EvalWithCommandLineAPI Uses

func EvalWithCommandLineAPI(p *runtime.EvaluateParams) *runtime.EvaluateParams

EvalWithCommandLineAPI is an evaluate option to make the DevTools Command Line API available to the evaluated script.

See Evaluate for more information on how evaluate actions work.

Note: this should not be used with untrusted Javascript.

func Headless Uses

func Headless(a *ExecAllocator)

Headless is the command line option to run in headless mode. On top of setting the headless flag, it also hides scrollbars and mutes audio.

func ListenBrowser Uses

func ListenBrowser(ctx context.Context, fn func(ev interface{}))

ListenBrowser adds a function which will be called whenever a browser event is received on the chromedp context. Cancelling ctx stops the listener from receiving any more events.

Note that the function is called synchronously when handling events. The function should avoid blocking at all costs. For example, any Actions must be run via a separate goroutine.

func ListenTarget Uses

func ListenTarget(ctx context.Context, fn func(ev interface{}))

ListenTarget adds a function which will be called whenever a target event is received on the chromedp context. Note that this only includes browser events; command responses and target events are not included. Cancelling ctx stops the listener from receiving any more events.

Note that the function is called synchronously when handling events. The function should avoid blocking at all costs. For example, any Actions must be run via a separate goroutine.

Code:

ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()

mux := http.NewServeMux()
mux.Handle("/second", writeHTML(``))
ts := httptest.NewServer(writeHTML(`
<input id='alert' type='button' value='alert' onclick='alert("alert text");'/>
	`))
defer ts.Close()

chromedp.ListenTarget(ctx, func(ev interface{}) {
    if ev, ok := ev.(*page.EventJavascriptDialogOpening); ok {
        fmt.Println("closing alert:", ev.Message)
        go func() {
            if err := chromedp.Run(ctx,
                page.HandleJavaScriptDialog(true),
            ); err != nil {
                panic(err)
            }
        }()
    }
})

if err := chromedp.Run(ctx,
    chromedp.Navigate(ts.URL),
    chromedp.Click("#alert", chromedp.ByID),
); err != nil {
    panic(err)
}

Output:

closing alert: alert text

Code:

ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()

ts := httptest.NewServer(writeHTML(`
<body>
<script>
	console.log("hello js world")
	var p = document.createElement("div");
	p.setAttribute("id", "jsFinished");
	document.body.appendChild(p);
</script>
</body>
	`))
defer ts.Close()

chromedp.ListenTarget(ctx, func(ev interface{}) {
    switch ev := ev.(type) {
    case *runtime.EventConsoleAPICalled:
        fmt.Printf("console.%s call:\n", ev.Type)
        for _, arg := range ev.Args {
            fmt.Printf("%s - %s\n", arg.Type, arg.Value)
        }
    }
})

if err := chromedp.Run(ctx,
    chromedp.Navigate(ts.URL),
    chromedp.WaitVisible("#jsFinished", chromedp.ByID),
); err != nil {
    panic(err)
}

Output:

console.log call:
string - "hello js world"

func NewContext Uses

func NewContext(parent context.Context, opts ...ContextOption) (context.Context, context.CancelFunc)

NewContext creates a chromedp context from the parent context. The parent context's Allocator is inherited, defaulting to an ExecAllocator with DefaultExecAllocatorOptions.

If the parent context contains an allocated Browser, the child context inherits it, and its first Run creates a new tab on that browser. Otherwise, its first Run will allocate a new browser.

Cancelling the returned context will close a tab or an entire browser, depending on the logic described above. To cancel a context while checking for errors, see Cancel.

Code:

// new browser, first tab
ctx1, cancel := chromedp.NewContext(context.Background())
defer cancel()

// ensure the first tab is created
if err := chromedp.Run(ctx1); err != nil {
    panic(err)
}

// same browser, second tab
ctx2, _ := chromedp.NewContext(ctx1)

// ensure the second tab is created
if err := chromedp.Run(ctx2); err != nil {
    panic(err)
}

c1 := chromedp.FromContext(ctx1)
c2 := chromedp.FromContext(ctx2)

fmt.Printf("Same browser: %t\n", c1.Browser == c2.Browser)
fmt.Printf("Same tab: %t\n", c1.Target == c2.Target)

Output:

Same browser: true
Same tab: false

func NewExecAllocator Uses

func NewExecAllocator(parent context.Context, opts ...ExecAllocatorOption) (context.Context, context.CancelFunc)

NewExecAllocator creates a new context set up with an ExecAllocator, suitable for use with NewContext.

func NewRemoteAllocator Uses

func NewRemoteAllocator(parent context.Context, url string) (context.Context, context.CancelFunc)

NewRemoteAllocator creates a new context set up with a RemoteAllocator, suitable for use with NewContext. The url should point to the browser's websocket address, such as "ws://127.0.0.1:$PORT/devtools/browser/...".

func NoDefaultBrowserCheck Uses

func NoDefaultBrowserCheck(a *ExecAllocator)

NoDefaultBrowserCheck is the Chrome comamnd line option to disable the default browser check.

func NoFirstRun Uses

func NoFirstRun(a *ExecAllocator)

NoFirstRun is the Chrome comamnd line option to disable the first run dialog.

func NoSandbox Uses

func NoSandbox(a *ExecAllocator)

NoSandbox is the Chrome comamnd line option to disable the sandbox.

func NodeEnabled Uses

func NodeEnabled(s *Selector)

NodeEnabled is an element query option to wait until all queried element nodes have been sent by the browser and are enabled (ie, do not have a 'disabled' attribute).

func NodeNotPresent Uses

func NodeNotPresent(s *Selector)

NodeNotPresent is an element query option to wait until no elements are present that match the query.

Note: forces the expected number of element nodes to be 0.

func NodeNotVisible Uses

func NodeNotVisible(s *Selector)

NodeNotVisible is an element query option to wait until all queried element nodes have been sent by the browser and are not visible.

func NodeReady Uses

func NodeReady(s *Selector)

NodeReady is an element query option to wait until all queried element nodes have been sent by the browser.

func NodeSelected Uses

func NodeSelected(s *Selector)

NodeSelected is an element query option to wait until all queried element nodes have been sent by the browser and are selected (ie, has 'selected' attribute).

func NodeVisible Uses

func NodeVisible(s *Selector)

NodeVisible is an element query option to wait until all queried element nodes have been sent by the browser and are visible.

func Run Uses

func Run(ctx context.Context, actions ...Action) error

Run runs an action against context. The provided context must be a valid chromedp context, typically created via NewContext.

func Targets Uses

func Targets(ctx context.Context) ([]*target.Info, error)

Targets lists all the targets in the browser attached to the given context.

func WaitNewTarget Uses

func WaitNewTarget(ctx context.Context, fn func(*target.Info) bool) <-chan target.ID

WaitNewTarget can be used to wait for the current target to open a new target. Once fn matches a new unattached target, its target ID is sent via the returned channel.

Code:

ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()

mux := http.NewServeMux()
mux.Handle("/first", writeHTML(`
<input id='newtab' type='button' value='open' onclick='window.open("/second", "_blank");'/>
	`))
mux.Handle("/second", writeHTML(``))
ts := httptest.NewServer(mux)
defer ts.Close()

// Grab the first spawned tab that isn't blank.
ch := chromedp.WaitNewTarget(ctx, func(info *target.Info) bool {
    return info.URL != ""
})
if err := chromedp.Run(ctx,
    chromedp.Navigate(ts.URL+"/first"),
    chromedp.Click("#newtab", chromedp.ByID),
); err != nil {
    panic(err)
}
newCtx, cancel := chromedp.NewContext(ctx, chromedp.WithTargetID(<-ch))
defer cancel()

var urlstr string
if err := chromedp.Run(newCtx, chromedp.Location(&urlstr)); err != nil {
    panic(err)
}
fmt.Println("new tab's path:", strings.TrimPrefix(urlstr, ts.URL))

Output:

new tab's path: /second

type Action Uses

type Action interface {
    // Do executes the action using the provided context and frame handler.
    Do(context.Context) error
}

Action is the common interface for an action that will be executed against a context and frame handler.

func CaptureScreenshot Uses

func CaptureScreenshot(res *[]byte) Action

CaptureScreenshot is an action that captures/takes a screenshot of the current browser viewport.

See the Screenshot action to take a screenshot of a specific element.

See the 'screenshot' example in the https://github.com/chromedp/examples project for an example of taking a screenshot of the entire page.

func Location Uses

func Location(urlstr *string) Action

Location is an action that retrieves the document location.

func Sleep Uses

func Sleep(d time.Duration) Action

Sleep is an empty action that calls time.Sleep with the specified duration.

Note: this is a temporary action definition for convenience, and will likely be marked for deprecation in the future, after the remaining Actions have been able to be written/tested.

func Title Uses

func Title(title *string) Action

Title is an action that retrieves the document title.

Code:

ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()

ts := httptest.NewServer(writeHTML(`
<head>
	<title>fancy website title</title>
</head>
<body>
	<div id="content"></div>
</body>
	`))
defer ts.Close()

var title string
if err := chromedp.Run(ctx,
    chromedp.Navigate(ts.URL),
    chromedp.Title(&title),
); err != nil {
    panic(err)
}
fmt.Println(title)

Output:

fancy website title

type ActionFunc Uses

type ActionFunc func(context.Context) error

ActionFunc is a adapter to allow the use of ordinary func's as an Action.

func (ActionFunc) Do Uses

func (f ActionFunc) Do(ctx context.Context) error

Do executes the func f using the provided context and frame handler.

type Allocator Uses

type Allocator interface {
    // Allocate creates a new browser. It can be cancelled via the provided
    // context, at which point all the resources used by the browser (such
    // as temporary directories) will be freed.
    Allocate(context.Context, ...BrowserOption) (*Browser, error)

    // Wait blocks until an allocator has freed all of its resources.
    // Cancelling the allocator context will already perform this operation,
    // so normally there's no need to call Wait directly.
    Wait()
}

An Allocator is responsible for creating and managing a number of browsers.

This interface abstracts away how the browser process is actually run. For example, an Allocator implementation may reuse browser processes, or connect to already-running browsers on remote machines.

type Browser Uses

type Browser struct {
    // LostConnection is closed when the websocket connection to Chrome is
    // dropped. This can be useful to make sure that Browser's context is
    // cancelled (and the handler stopped) once the connection has failed.
    LostConnection chan struct{}
    // contains filtered or unexported fields
}

Browser is the high-level Chrome DevTools Protocol browser manager, handling the browser process runner, WebSocket clients, associated targets, and network, page, and DOM events.

func NewBrowser Uses

func NewBrowser(ctx context.Context, urlstr string, opts ...BrowserOption) (*Browser, error)

NewBrowser creates a new browser. Typically, this function wouldn't be called directly, as the Allocator interface takes care of it.

func (*Browser) Execute Uses

func (b *Browser) Execute(ctx context.Context, method string, params easyjson.Marshaler, res easyjson.Unmarshaler) error

type BrowserOption Uses

type BrowserOption = func(*Browser)

BrowserOption is a browser option.

func WithBrowserDebugf Uses

func WithBrowserDebugf(f func(string, ...interface{})) BrowserOption

WithBrowserDebugf is a browser option to specify a func to log actual websocket messages.

func WithBrowserErrorf Uses

func WithBrowserErrorf(f func(string, ...interface{})) BrowserOption

WithBrowserErrorf is a browser option to specify a func to receive error logging.

func WithBrowserLogf Uses

func WithBrowserLogf(f func(string, ...interface{})) BrowserOption

WithBrowserLogf is a browser option to specify a func to receive general logging.

func WithConsolef Uses

func WithConsolef(f func(string, ...interface{})) BrowserOption

WithConsolef is a browser option to specify a func to receive chrome log events.

Note: NOT YET IMPLEMENTED.

func WithDialTimeout Uses

func WithDialTimeout(d time.Duration) BrowserOption

WithDialTimeout is a browser option to specify the timeout when dialing a browser's websocket address. The default is ten seconds; use a zero duration to not use a timeout.

type Conn Uses

type Conn struct {
    // contains filtered or unexported fields
}

Conn implements Transport with a gobwas/ws websocket connection.

func DialContext Uses

func DialContext(ctx context.Context, urlstr string, opts ...DialOption) (*Conn, error)

DialContext dials the specified websocket URL using gobwas/ws.

func (*Conn) Close Uses

func (c *Conn) Close() error

Close satisfies the io.Closer interface.

func (*Conn) Read Uses

func (c *Conn) Read(_ context.Context, msg *cdproto.Message) error

Read reads the next message.

func (*Conn) Write Uses

func (c *Conn) Write(_ context.Context, msg *cdproto.Message) error

Write writes a message.

type Context Uses

type Context struct {
    // Allocator is used to create new browsers. It is inherited from the
    // parent context when using NewContext.
    Allocator Allocator

    // Browser is the browser being used in the context. It is inherited
    // from the parent context when using NewContext.
    Browser *Browser

    // Target is the target to run actions (commands) against. It is not
    // inherited from the parent context, and typically each context will
    // have its own unique Target pointing to a separate browser tab (page).
    Target *Target
    // contains filtered or unexported fields
}

Context is attached to any context.Context which is valid for use with Run.

func FromContext Uses

func FromContext(ctx context.Context) *Context

FromContext extracts the Context data stored inside a context.Context.

type ContextOption Uses

type ContextOption = func(*Context)

ContextOption is a context option.

func WithBrowserOption Uses

func WithBrowserOption(opts ...BrowserOption) ContextOption

WithBrowserOption allows passing a number of browser options to the allocator when allocating a new browser. As such, this context option can only be used when NewContext is allocating a new browser.

func WithDebugf Uses

func WithDebugf(f func(string, ...interface{})) ContextOption

WithDebugf is a shortcut for WithBrowserOption(WithBrowserDebugf(f)).

func WithErrorf Uses

func WithErrorf(f func(string, ...interface{})) ContextOption

WithErrorf is a shortcut for WithBrowserOption(WithBrowserErrorf(f)).

func WithLogf Uses

func WithLogf(f func(string, ...interface{})) ContextOption

WithLogf is a shortcut for WithBrowserOption(WithBrowserLogf(f)).

func WithTargetID Uses

func WithTargetID(id target.ID) ContextOption

WithTargetID sets up a context to be attached to an existing target, instead of creating a new one.

type Device Uses

type Device interface {
    // Device returns the device info.
    Device() device.Info
}

Device is the shared interface for known device types.

See: github.com/chromedp/chromedp/device for a set of off-the-shelf devices and modes.

type DialOption Uses

type DialOption = func(*Conn)

DialOption is a dial option.

func WithConnDebugf Uses

func WithConnDebugf(f func(string, ...interface{})) DialOption

WithConnDebugf is a dial option to set a protocol logger.

type EmulateAction Uses

type EmulateAction Action

EmulateAction are actions that change the emulation settings for the browser.

func Emulate Uses

func Emulate(device Device) EmulateAction

Emulate is an action to emulate a specific device.

See: github.com/chromedp/chromedp/device for a set of off-the-shelf devices and modes.

Code:

ctx, cancel := chromedp.NewContext(context.Background())
defer cancel()

var buf []byte
if err := chromedp.Run(ctx,
    chromedp.Emulate(device.IPhone7),
    chromedp.Navigate(`https://google.com/`),
    chromedp.WaitVisible(`#main`, chromedp.ByID),
    chromedp.SendKeys(`input[name=q]`, "what's my user agent?\n"),
    chromedp.WaitVisible(`#rso`, chromedp.ByID),
    chromedp.CaptureScreenshot(&buf),
); err != nil {
    panic(err)
}

if err := ioutil.WriteFile("google-iphone7.png", buf, 0644); err != nil {
    panic(err)
}

func EmulateReset Uses

func EmulateReset() EmulateAction

EmulateReset is an action to reset the device emulation.

Resets the browser's viewport, screen orientation, user-agent, and mobile/touch emulation settings to the original values the browser was started with.

func EmulateViewport Uses

func EmulateViewport(width, height int64, opts ...EmulateViewportOption) EmulateAction

EmulateViewport is an action to change the browser viewport.

Wraps calls to emulation.SetDeviceMetricsOverride and emulation.SetTouchEmulationEnabled.

Note: this has the effect of setting/forcing the screen orientation to landscape, and will disable mobile and touch emulation by default. If this is not the desired behavior, use the emulate viewport options EmulateOrientation (or EmulateLandscape/EmulatePortrait), EmulateMobile, and EmulateTouch, respectively.

func ResetViewport Uses

func ResetViewport() EmulateAction

ResetViewport is an action to reset the browser viewport to the default values the browser was started with.

Note: does not modify / change the browser's emulated User-Agent, if any.

type EmulateViewportOption Uses

type EmulateViewportOption = func(*emulation.SetDeviceMetricsOverrideParams, *emulation.SetTouchEmulationEnabledParams)

EmulateViewportOption is the type for emulate viewport options.

func EmulateOrientation Uses

func EmulateOrientation(orientation emulation.OrientationType, angle int64) EmulateViewportOption

EmulateOrientation is an emulate viewport option to set the device viewport screen orientation.

func EmulateScale Uses

func EmulateScale(scale float64) EmulateViewportOption

EmulateScale is an emulate viewport option to set the device viewport scaling factor.

type Error Uses

type Error string

Error is a chromedp error.

const (
    // ErrInvalidWebsocketMessage is the invalid websocket message.
    ErrInvalidWebsocketMessage Error = "invalid websocket message"

    // ErrInvalidDimensions is the invalid dimensions error.
    ErrInvalidDimensions Error = "invalid dimensions"

    // ErrNoResults is the no results error.
    ErrNoResults Error = "no results"

    // ErrHasResults is the has results error.
    ErrHasResults Error = "has results"

    // ErrNotVisible is the not visible error.
    ErrNotVisible Error = "not visible"

    // ErrVisible is the visible error.
    ErrVisible Error = "visible"

    // ErrDisabled is the disabled error.
    ErrDisabled Error = "disabled"

    // ErrNotSelected is the not selected error.
    ErrNotSelected Error = "not selected"

    // ErrInvalidBoxModel is the invalid box model error.
    ErrInvalidBoxModel Error = "invalid box model"

    // ErrChannelClosed is the channel closed error.
    ErrChannelClosed Error = "channel closed"

    // ErrInvalidTarget is the invalid target error.
    ErrInvalidTarget Error = "invalid target"

    // ErrInvalidContext is the invalid context error.
    ErrInvalidContext Error = "invalid context"
)

Error types.

func (Error) Error Uses

func (err Error) Error() string

Error satisfies the error interface.

type EvaluateAction Uses

type EvaluateAction Action

EvaluateAction are actions that evaluate Javascript expressions using runtime.Evaluate.

func Evaluate Uses

func Evaluate(expression string, res interface{}, opts ...EvaluateOption) EvaluateAction

Evaluate is an action to evaluate the Javascript expression, unmarshaling the result of the script evaluation to res.

When res is a type other than *[]byte, or **chromedp/cdproto/runtime.RemoteObject, then the result of the script evaluation will be returned "by value" (ie, JSON-encoded), and subsequently an attempt will be made to json.Unmarshal the script result to res.

Otherwise, when res is a *[]byte, the raw JSON-encoded value of the script result will be placed in res. Similarly, if res is a *runtime.RemoteObject, then res will be set to the low-level protocol type, and no attempt will be made to convert the result.

Note: any exception encountered will be returned as an error.

func EvaluateAsDevTools Uses

func EvaluateAsDevTools(expression string, res interface{}, opts ...EvaluateOption) EvaluateAction

EvaluateAsDevTools is an action that evaluates a Javascript expression as Chrome DevTools would, evaluating the expression in the "console" context, and making the Command Line API available to the script.

See Evaluate for more information on how script expressions are evaluated.

Note: this should not be used with untrusted Javascript.

type EvaluateOption Uses

type EvaluateOption = func(*runtime.EvaluateParams) *runtime.EvaluateParams

EvaluateOption is the type for Javascript evaluation options.

func EvalObjectGroup Uses

func EvalObjectGroup(objectGroup string) EvaluateOption

EvalObjectGroup is a evaluate option to set the object group.

type ExecAllocator Uses

type ExecAllocator struct {
    // contains filtered or unexported fields
}

ExecAllocator is an Allocator which starts new browser processes on the host machine.

Code:

dir, err := ioutil.TempDir("", "chromedp-example")
if err != nil {
    panic(err)
}
defer os.RemoveAll(dir)

opts := append(chromedp.DefaultExecAllocatorOptions[:],
    chromedp.DisableGPU,
    chromedp.UserDataDir(dir),
)

allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
defer cancel()

// also set up a custom logger
taskCtx, cancel := chromedp.NewContext(allocCtx, chromedp.WithLogf(log.Printf))
defer cancel()

// ensure that the browser process is started
if err := chromedp.Run(taskCtx); err != nil {
    panic(err)
}

path := filepath.Join(dir, "DevToolsActivePort")
bs, err := ioutil.ReadFile(path)
if err != nil {
    panic(err)
}
lines := bytes.Split(bs, []byte("\n"))
fmt.Printf("DevToolsActivePort has %d lines\n", len(lines))

Output:

DevToolsActivePort has 2 lines

func (*ExecAllocator) Allocate Uses

func (a *ExecAllocator) Allocate(ctx context.Context, opts ...BrowserOption) (*Browser, error)

Allocate satisfies the Allocator interface.

func (*ExecAllocator) Wait Uses

func (a *ExecAllocator) Wait()

Wait satisfies the Allocator interface.

type ExecAllocatorOption Uses

type ExecAllocatorOption = func(*ExecAllocator)

ExecAllocatorOption is a exec allocator option.

func CombinedOutput Uses

func CombinedOutput(w io.Writer) ExecAllocatorOption

CombinedOutput is used to set an io.Writer where stdout and stderr from the browser will be sent

func Env Uses

func Env(vars ...string) ExecAllocatorOption

Env is a list of generic environment variables in the form NAME=value to pass into the new Chrome process. These will be appended to the environment of the golang process as retrieved by os.Environ.

func ExecPath Uses

func ExecPath(path string) ExecAllocatorOption

ExecPath returns an ExecAllocatorOption which uses the given path to execute browser processes. The given path can be an absolute path to a binary, or just the name of the program to find via exec.LookPath.

func Flag Uses

func Flag(name string, value interface{}) ExecAllocatorOption

Flag is a generic command line option to pass a flag to Chrome. If the value is a string, it will be passed as --name=value. If it's a boolean, it will be passed as --name if value is true.

func ProxyServer Uses

func ProxyServer(proxy string) ExecAllocatorOption

ProxyServer is the command line option to set the outbound proxy server.

func UserAgent Uses

func UserAgent(userAgent string) ExecAllocatorOption

UserAgent is the command line option to set the default User-Agent header.

func UserDataDir Uses

func UserDataDir(dir string) ExecAllocatorOption

UserDataDir is the command line option to set the user data dir.

Note: set this option to manually set the profile directory used by Chrome. When this is not set, then a default path will be created in the /tmp directory.

func WindowSize Uses

func WindowSize(width, height int) ExecAllocatorOption

WindowSize is the command line option to set the initial window size.

type KeyAction Uses

type KeyAction Action

KeyAction are keyboard (key) input event actions.

func KeyEvent Uses

func KeyEvent(keys string, opts ...KeyOption) KeyAction

KeyEvent is a key action that synthesizes a keyDown, char, and keyUp event for each rune contained in keys along with any supplied key options.

Only well-known, "printable" characters will have char events synthesized.

See the SendKeys action to synthesize key events for a specific element node.

See the chromedp/kb package for implementation details and list of well-known keys.

func KeyEventNode Uses

func KeyEventNode(n *cdp.Node, keys string, opts ...KeyOption) KeyAction

KeyEventNode is a key action that dispatches a key event on a element node.

type KeyOption Uses

type KeyOption = func(*input.DispatchKeyEventParams) *input.DispatchKeyEventParams

KeyOption is a key action option.

func KeyModifiers Uses

func KeyModifiers(modifiers ...input.Modifier) KeyOption

KeyModifiers is a key action option to add additional modifiers on the key press.

type MouseAction Uses

type MouseAction Action

MouseAction are mouse input event actions

func MouseClickNode Uses

func MouseClickNode(n *cdp.Node, opts ...MouseOption) MouseAction

MouseClickNode is an action that dispatches a mouse left button click event at the center of a specified node.

Note that the window will be scrolled if the node is not within the window's viewport.

func MouseClickXY Uses

func MouseClickXY(x, y float64, opts ...MouseOption) MouseAction

MouseClickXY is an action that sends a left mouse button click (ie, mousePressed and mouseReleased event) to the X, Y location.

func MouseEvent Uses

func MouseEvent(typ input.MouseType, x, y float64, opts ...MouseOption) MouseAction

MouseEvent is a mouse event action to dispatch the specified mouse event type at coordinates x, y.

type MouseOption Uses

type MouseOption = func(*input.DispatchMouseEventParams) *input.DispatchMouseEventParams

MouseOption is a mouse action option.

func Button Uses

func Button(btn string) MouseOption

Button is a mouse action option to set the button to click from a string.

func ButtonModifiers Uses

func ButtonModifiers(modifiers ...input.Modifier) MouseOption

ButtonModifiers is a mouse action option to add additional input modifiers for a button click.

func ButtonType Uses

func ButtonType(button input.ButtonType) MouseOption

ButtonType is a mouse action option to set the button to click.

func ClickCount Uses

func ClickCount(n int) MouseOption

ClickCount is a mouse action option to set the click count.

type NavigateAction Action

NavigateAction are actions that manipulate the navigation of the browser.

func Navigate(urlstr string) NavigateAction

Navigate is an action that navigates the current frame.

func NavigateBack() NavigateAction

NavigateBack is an action that navigates the current frame backwards in its history.

func NavigateForward() NavigateAction

NavigateForward is an action that navigates the current frame forwards in its history.

func NavigateToHistoryEntry(entryID int64) NavigateAction

NavigateToHistoryEntry is an action to navigate to the specified navigation entry.

func NavigationEntries(currentIndex *int64, entries *[]*page.NavigationEntry) NavigateAction

NavigationEntries is an action that retrieves the page's navigation history entries.

func Reload Uses

func Reload() NavigateAction

Reload is an action that reloads the current page.

func Stop Uses

func Stop() NavigateAction

Stop is an action that stops all navigation and pending resource retrieval.

type QueryAction Uses

type QueryAction Action

QueryAction are element query actions that select node elements from the browser's DOM for retrieval or manipulation.

See Query for details on building element query selectors.

func AttributeValue Uses

func AttributeValue(sel interface{}, name string, value *string, ok *bool, opts ...QueryOption) QueryAction

AttributeValue is an element query action that retrieves the element attribute value for the first element node matching the selector.

func Attributes Uses

func Attributes(sel interface{}, attributes *map[string]string, opts ...QueryOption) QueryAction

Attributes is an element query action that retrieves the element attributes for the first element node matching the selector.

func AttributesAll Uses

func AttributesAll(sel interface{}, attributes *[]map[string]string, opts ...QueryOption) QueryAction

AttributesAll is an element query action that retrieves the element attributes for all element nodes matching the selector.

Note: this should be used with the ByQueryAll query option.

func Blur Uses

func Blur(sel interface{}, opts ...QueryOption) QueryAction

Blur is an element query action that unfocuses (blurs) the first element node matching the selector.

func Clear Uses

func Clear(sel interface{}, opts ...QueryOption) QueryAction

Clear is an element query action that clears the values of any input/textarea element nodes matching the selector.

func Click Uses

func Click(sel interface{}, opts ...QueryOption) QueryAction

Click is an element query action that sends a mouse click event to the first element node matching the selector.

func ComputedStyle Uses

func ComputedStyle(sel interface{}, style *[]*css.ComputedProperty, opts ...QueryOption) QueryAction

ComputedStyle is an element query action that retrieves the computed style of the first element node matching the selector.

func Dimensions Uses

func Dimensions(sel interface{}, model **dom.BoxModel, opts ...QueryOption) QueryAction

Dimensions is an element query action that retrieves the box model dimensions for the first element node matching the selector.

func DoubleClick Uses

func DoubleClick(sel interface{}, opts ...QueryOption) QueryAction

DoubleClick is an element query action that sends a mouse double click event to the first element node matching the selector.

func Focus Uses

func Focus(sel interface{}, opts ...QueryOption) QueryAction

Focus is an element query action that focuses the first element node matching the selector.

func InnerHTML Uses

func InnerHTML(sel interface{}, html *string, opts ...QueryOption) QueryAction

InnerHTML is an element query action that retrieves the inner html of the first element node matching the selector.

func JavascriptAttribute Uses

func JavascriptAttribute(sel interface{}, name string, res interface{}, opts ...QueryOption) QueryAction

JavascriptAttribute is an element query action that retrieves the Javascript attribute for the first element node matching the selector.

func MatchedStyle Uses

func MatchedStyle(sel interface{}, style **css.GetMatchedStylesForNodeReturns, opts ...QueryOption) QueryAction

MatchedStyle is an element query action that retrieves the matched style information for the first element node matching the selector.

func NodeIDs Uses

func NodeIDs(sel interface{}, ids *[]cdp.NodeID, opts ...QueryOption) QueryAction

NodeIDs is an element query action that retrieves the element node IDs matching the selector.

func Nodes Uses

func Nodes(sel interface{}, nodes *[]*cdp.Node, opts ...QueryOption) QueryAction

Nodes is an element query action that retrieves the document element nodes matching the selector.

func OuterHTML Uses

func OuterHTML(sel interface{}, html *string, opts ...QueryOption) QueryAction

OuterHTML is an element query action that retrieves the outer html of the first element node matching the selector.

func Query Uses

func Query(sel interface{}, opts ...QueryOption) QueryAction

Query is a query action that queries the browser for specific element node(s) matching the criteria.

Query actions that target a browser DOM element node (or nodes) make use of Query, in conjunction with the After option (see below) to retrieve data or to modify the element(s) selected by the query.

For example:

chromedp.Run(ctx, chromedp.SendKeys(`thing`, chromedp.ByID))

The above will perform a "SendKeys" action on the first element matching a browser CSS query for "#thing".

Element selection queries work in conjunction with specific actions and form the primary way of automating Tasks in the browser. They are typically written in the following form:

Action(selector[, parameter1, ...parameterN][,result][, queryOptions...])

Where:

Action         - the action to perform
selector       - element query selection (typically a string), that any matching node(s) will have the action applied
parameter[1-N] - parameter(s) needed for the individual action (if any)
result         - pointer to a result (if any)
queryOptions   - changes how queries are executed, or how nodes are waited for (see below)

Query Options

By* options specify the type of element query used By the browser to perform the selection query. When not specified, element queries will use BySearch (a wrapper for DOM.performSearch).

Node* options specify node conditions that cause the query to wait until the specified condition is true. When not specified, queries will use the NodeReady wait condition.

The AtLeast option alters the minimum number of nodes that must be returned by the element query. If not specified, the default value is 1.

The After option is used to specify a func that will be executed when element query has returned one or more elements, and after the node condition is true.

By Options

The BySearch (default) option enables querying for elements with a CSS or XPath selector, wrapping DOM.performSearch.

The ByID option enables querying for a single element with the matching CSS ID, wrapping DOM.querySelector. ByID is similar to calling document.querySelector('#' + ID) from within the browser.

The ByQuery option enables querying for a single element using a CSS selector, wrapping DOM.querySelector. ByQuery is similar to calling document.querySelector() from within the browser.

The ByQueryAll option enables querying for elements using a CSS selector, wrapping DOM.querySelectorAll. ByQueryAll is similar to calling document.querySelectorAll() from within the browser.

The ByJSPath option enables querying for a single element using its "JS Path" value, wrapping Runtime.evaluate. ByJSPath is similar to executing a Javascript snippet that returns a element from within the browser. ByJSPath should be used only with trusted element queries, as it is passed directly to Runtime.evaluate, and no attempt is made to sanitize the query. Useful for querying DOM elements that cannot be retrieved using other By* funcs, such as ShadowDOM elements.

Node Options

The NodeReady (default) option causes the query to wait until all element nodes matching the selector have been retrieved from the browser.

The NodeVisible option causes the query to wait until all element nodes matching the selector have been retrieved from the browser, and are visible.

The NodeNotVisible option causes the query to wait until all element nodes matching the selector have been retrieved from the browser, and are not visible.

The NodeEnabled option causes the query to wait until all element nodes matching the selector have been retrieved from the browser, and are enabled (ie, do not have a 'disabled' attribute).

The NodeSelected option causes the query to wait until all element nodes matching the selector have been retrieved from the browser, and are are selected (ie, has a 'selected' attribute).

The NodeNotPresent option causes the query to wait until there are no element nodes matching the selector.

func QueryAfter Uses

func QueryAfter(sel interface{}, f func(context.Context, ...*cdp.Node) error, opts ...QueryOption) QueryAction

QueryAfter is an element query action that queries the browser for selector sel. Waits until the visibility conditions of the query have been met, after which executes f.

func RemoveAttribute Uses

func RemoveAttribute(sel interface{}, name string, opts ...QueryOption) QueryAction

RemoveAttribute is an element query action that removes the element attribute with name from the first element node matching the selector.

func Reset Uses

func Reset(sel interface{}, opts ...QueryOption) QueryAction

Reset is an element query action that resets the parent form of the first element node matching the selector.

func Screenshot Uses

func Screenshot(sel interface{}, picbuf *[]byte, opts ...QueryOption) QueryAction

Screenshot is an element query action that takes a screenshot of the first element node matching the selector.

See CaptureScreenshot for capturing a screenshot of the browser viewport.

See the 'screenshot' example in the https://github.com/chromedp/examples project for an example of taking a screenshot of the entire page.

func ScrollIntoView Uses

func ScrollIntoView(sel interface{}, opts ...QueryOption) QueryAction

ScrollIntoView is an element query action that scrolls the window to the first element node matching the selector.

func SendKeys Uses

func SendKeys(sel interface{}, v string, opts ...QueryOption) QueryAction

SendKeys is an element query action that synthesizes the key up, char, and down events as needed for the runes in v, sending them to the first element node matching the selector.

For a complete example on how to use SendKeys, see https://github.com/chromedp/examples/tree/master/keys.

Note: when the element query matches a input[type="file"] node, then dom.SetFileInputFiles is used to set the upload path of the input node to v.

func SetAttributeValue Uses

func SetAttributeValue(sel interface{}, name, value string, opts ...QueryOption) QueryAction

SetAttributeValue is an element query action that sets the element attribute with name to value for the first element node matching the selector.

func SetAttributes Uses

func SetAttributes(sel interface{}, attributes map[string]string, opts ...QueryOption) QueryAction

SetAttributes is an element query action that sets the element attributes for the first element node matching the selector.

func SetJavascriptAttribute Uses

func SetJavascriptAttribute(sel interface{}, name, value string, opts ...QueryOption) QueryAction

SetJavascriptAttribute is an element query action that sets the Javascript attribute for the first element node matching the selector.

func SetUploadFiles Uses

func SetUploadFiles(sel interface{}, files []string, opts ...QueryOption) QueryAction

SetUploadFiles is an element query action that sets the files to upload (ie, for a input[type="file"] node) for the first element node matching the selector.

func SetValue Uses

func SetValue(sel interface{}, value string, opts ...QueryOption) QueryAction

SetValue is an element query action that sets the Javascript value of the first element node matching the selector.

Useful for setting an element's Javascript value, namely form, input, textarea, select, or other element with a '.value' field.

func Submit Uses

func Submit(sel interface{}, opts ...QueryOption) QueryAction

Submit is an element query action that submits the parent form of the first element node matching the selector.

func Text Uses

func Text(sel interface{}, text *string, opts ...QueryOption) QueryAction

Text is an element query action that retrieves the visible text of the first element node matching the selector.

func TextContent Uses

func TextContent(sel interface{}, text *string, opts ...QueryOption) QueryAction

TextContent is an element query action that retrieves the text content of the first element node matching the selector.

func Value Uses

func Value(sel interface{}, value *string, opts ...QueryOption) QueryAction

Value is an element query action that retrieves the Javascript value field of the first element node matching the selector.

Useful for retrieving an element's Javascript value, namely form, input, textarea, select, or any other element with a '.value' field.

func WaitEnabled Uses

func WaitEnabled(sel interface{}, opts ...QueryOption) QueryAction

WaitEnabled is an element query action that waits until the element matching the selector is enabled (ie, does not have attribute 'disabled').

func WaitNotPresent Uses

func WaitNotPresent(sel interface{}, opts ...QueryOption) QueryAction

WaitNotPresent is an element query action that waits until no elements are present matching the selector.

func WaitNotVisible Uses

func WaitNotVisible(sel interface{}, opts ...QueryOption) QueryAction

WaitNotVisible is an element query action that waits until the element matching the selector is not visible.

func WaitReady Uses

func WaitReady(sel interface{}, opts ...QueryOption) QueryAction

WaitReady is an element query action that waits until the element matching the selector is ready (ie, has been "loaded").

func WaitSelected Uses

func WaitSelected(sel interface{}, opts ...QueryOption) QueryAction

WaitSelected is an element query action that waits until the element matching the selector is selected (ie, has attribute 'selected').

func WaitVisible Uses

func WaitVisible(sel interface{}, opts ...QueryOption) QueryAction

WaitVisible is an element query action that waits until the element matching the selector is visible.

type QueryOption Uses

type QueryOption = func(*Selector)

QueryOption is an element query action option.

func After Uses

func After(f func(context.Context, ...*cdp.Node) error) QueryOption

After is an element query option that sets a func to execute after the matched nodes have been returned by the browser, and after the node condition is true.

func AtLeast Uses

func AtLeast(n int) QueryOption

AtLeast is an element query option to set a minimum number of elements that must be returned by the query.

By default, a query will have a value of 1.

func ByFunc Uses

func ByFunc(f func(context.Context, *cdp.Node) ([]cdp.NodeID, error)) QueryOption

ByFunc is an element query action option to set the func used to select elements.

func WaitFunc Uses

func WaitFunc(wait func(context.Context, *cdp.Frame, ...cdp.NodeID) ([]*cdp.Node, error)) QueryOption

WaitFunc is an element query option to set a custom node condition wait.

type RemoteAllocator Uses

type RemoteAllocator struct {
    // contains filtered or unexported fields
}

RemoteAllocator is an Allocator which connects to an already running Chrome process via a websocket URL.

func (*RemoteAllocator) Allocate Uses

func (a *RemoteAllocator) Allocate(ctx context.Context, opts ...BrowserOption) (*Browser, error)

Allocate satisfies the Allocator interface.

func (*RemoteAllocator) Wait Uses

func (a *RemoteAllocator) Wait()

Wait satisfies the Allocator interface.

type Selector Uses

type Selector struct {
    // contains filtered or unexported fields
}

Selector holds information pertaining to an element selection query.

See Query for information on building an element selector and relevant options.

func (*Selector) Do Uses

func (s *Selector) Do(ctx context.Context) error

Do executes the selector, only finishing if the selector's by, wait, and after funcs succeed, or if the context is cancelled.

type Target Uses

type Target struct {
    SessionID target.SessionID
    TargetID  target.ID
    // contains filtered or unexported fields
}

Target manages a Chrome DevTools Protocol target.

func (*Target) Execute Uses

func (t *Target) Execute(ctx context.Context, method string, params easyjson.Marshaler, res easyjson.Unmarshaler) error

type Tasks Uses

type Tasks []Action

Tasks is a sequential list of Actions that can be used as a single Action.

func (Tasks) Do Uses

func (t Tasks) Do(ctx context.Context) error

Do executes the list of Actions sequentially, using the provided context and frame handler.

type Transport Uses

type Transport interface {
    Read(context.Context, *cdproto.Message) error
    Write(context.Context, *cdproto.Message) error
    io.Closer
}

Transport is the common interface to send/receive messages to a target.

This interface is currently used internally by Browser, but it is exposed as it will be useful as part of the public API in the future.

Directories

PathSynopsis
devicePackage device contains device emulation definitions for use with chromedp's Emulate action.
kbPackage kb provides keyboard mappings for Chrome DOM Keys for use with input events.

Package chromedp imports 38 packages (graph) and is imported by 30 packages. Updated 2019-09-10. Refresh now. Tools for package owners.