I'm trying to navigate the Chrome settings page using chromedp
in go.
The full example is here, but the gist is something very basic and simple:
//...
if err := cdp.Run(ctx,
cdp.Navigate(`chrome://settings/content/location`),
cdp.SendKeys(`#input`, "hello"),
); err != nil && !strings.Contains(err.Error(), "net::ERR_ABORTED") {
log.Fatal(err)
}
//...
Ostensibly, the settings page at chrome://settings/content/location
has a DOM, and the
search field looks like an input field (with the ID #input
). And yet, trying to interact with it through chromedp
fails: chromedp
does not seem to find it at all.
For some background, I am trying to configure some aspects of Chrome, namely automatically denying location requests, which do not seem to have a command line flag. Or at least I was not able to find one. My example above interacts with the input field because it seem it would be easier to select.
What I really want is to click on the radio button which says "don't allow websites to see your location". Similar to the input field above, I can not figure out the correct incantation that will cause chromedp
to select a specific radio button. If there is an alternative way to achieve this, I'm all ears. I would, however, like to avoid needing a pre-populated userdir if possible. I'm new to chromedp
so I apologize if this is something trivial. Yet, I couldn't find an answer. There is a similar question about selenium, but I think chromedp
may be sufficiently different that the answer may be different too.