Questions tagged [chromedp]

A Go language package that implements a client for CDP (Chrome DevTools Protocol).

chromedp package is a high level CDP (Chrome DevTools Protocol) client in language 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.

65 questions
1
vote
1 answer

Chromedp working in non-headless but doing nothing in headless

I am using Chromedp to post some stuff occasionally on Social Media. When I run the script in non-headless mode it is working perfect. When I try to run it in headless mode, nothing happens. Obviously something is going wrong, but since I cannot…
1
vote
1 answer

Scrapper colly in headless mode?

Scrapper colly in headless mode? Hello, I am new on golang and I have to make a scraper for my school in France. The site I have to scrape is www.allrecipes.com. On this site, I chose this page https://www.allrecipes.com/recipes/17562/dinner/ On…
maka
  • 39
  • 7
1
vote
1 answer

Go ChromeDP ignores any external or internal css during printing to pdf and uses only those, that in html file ONLY

Go ChromeDP not using any css either internal or external styles (only those, that was written in html, not other file). I using method page.SetDocumentContent(frameTree.Frame.ID, string(buf.Bytes())).Do(ctx) to add html file to chromedp, and buf,…
1
vote
1 answer

Golang Chromedp: pdf file download without saving in server

How to chromedp pdf download without saving in server? Below code is working for generating pdf file and saving in server side. But I want to download pdf file without saving in server side. func PDFInvoice(c *gin.Context) { session :=…
1
vote
1 answer

Chromedp says node has children but none are there

I got a list (ul) from a website and now I want to loop over the children and their text i.e.
  • some text
  • some text 2
  • some text 3
1
vote
2 answers

Chromedp sending request with cookies

I was trying to open a checkout page with chromedp library but it doesn't receive the cookies I'm sending. I tried network.SetCookies()and network.SetCookie() in a loop but it doesn't work. It compiles and run without errors. Help is appreciated,…
1
vote
2 answers

Go package "chromedp" cannot take text from specific url

I am learning "Go" for web crawling. I would like to take some text from following site: "https://edition.cnn.com/markets/fear-and-greed" This site need waiting time to load all html text. So I have used chromedp to get the text from this…
puraria
  • 11
  • 2
1
vote
2 answers

golang chromedp ERROR: could not unmarshal event: unknown PrivateNetworkRequestPolicy value

I'm getting ERROR: could not unmarshal event: unknown PrivateNetworkRequestPolicy value while fetching amazon using chromedp. Tried with different user-agents but nothing works. github.com/chromedp/cdproto v0.0.0-20220816211547-b8b15824df23…
Jff
  • 91
  • 1
  • 8
1
vote
2 answers

How to navigate page from string html golang in chromedp

var x = `

Hello World

` How to navigate chromedp to x without saving x as file?
1
vote
1 answer

"Host header is specified and is not an IP address or localhost" message when using chromedp headless-shell

I'm trying to deploy chromedp/headless-shell to Cloud Run. Here is my Dockerfile: FROM chromedp/headless-shell ENTRYPOINT [ "/headless-shell/headless-shell", "--remote-debugging-address=0.0.0.0", "--remote-debugging-port=9222", "--disable-gpu",…
1
vote
1 answer

chromedp - Go - Show invalid printer settings error (-32000) - When setting WithMarginTop

I'm playing around with chromedp and been trying to replicate the functionality in puppeteer node.js but in golang. I'm finding that the same JSON payload to chromium is causing an error when using chromedp package main import ( "context" …
mike james
  • 8,840
  • 3
  • 18
  • 21
1
vote
1 answer

How to post request in Chromedp, simulate a form

Chromedp have a chromedp.Submit() function which query a form exist in html page and submit it. Now what I need is post a request in pure golang code, there are have no form elements in html page, similar ajax post, this post should base in current…
Jayden
  • 11
  • 2
1
vote
1 answer

Unable to run chromedp in docker

I had installed chromedp locally using this usual way:- $ go get -u github.com/chromedp/chromedp. I am able to run it locally but when I deployed it to my stage environment, I got below error:- exec: \"google-chrome\": executable file not found in…
Umesh Malhotra
  • 967
  • 1
  • 10
  • 25
1
vote
1 answer

chromedp golang: How to create screenshot and pdf from template HTML string instead of URL?

Is it possible to generate PDF/screenshots from HTML template instead of URL in chrome dp library? func printToPDF(urlstr string, res *[]byte) chromedp.Tasks { return chromedp.Tasks{ chromedp.Navigate(urlstr), …
Krishnadas PC
  • 5,981
  • 2
  • 53
  • 54
1
vote
1 answer

How to detect javascript alert using chromedp

I'm trying to identify that an alert popped up after navigating to a URL using chromedp. I tried using a listener as follows but I'm new to Golang so I'm not sure why it didn't work. package main import ( "context" "log" …
Raywando
  • 129
  • 5