Chromedp: How to open a new tab (and use it)

Created on 5 Jun 2017  路  5Comments  路  Source: chromedp/chromedp

I am looking at cdp package and no way I can find it;)

All 5 comments

Create a new target, create a handler from the target, and then initialise it for use:

client := cdpclient.New()
t, err := client.NewPageTarget(ctx)
if err != nil {
    return err
}

h, err := cdp.NewTargetHandler(t, log.Printf, log.Printf, log.Printf)
if err != nil {
    return err
}

if err := h.Run(ctx); err != nil {
    return err
}

As @MrSaints has described.

Is it possible to create a new private tab?

@KristinaEtc I don't think so, but you can simply disable cookies (or rather, delete them), and disable caching. You'll get a similar behaviour to Incognito.

@MrSaints And how to interact with the "h"? How to "click" an element for instance? Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pmurley picture pmurley  路  5Comments

jafriyie1 picture jafriyie1  路  3Comments

iMaxopoly picture iMaxopoly  路  3Comments

t-blake picture t-blake  路  3Comments

mschilli picture mschilli  路  4Comments