Ask HN: What are you using headless Chrome for?
The headless version of chrome has seen great adoption since it was launched 4-5 years ago. I am wondering what types of use cases it is being used for.
Running automated tests is one the most common use cases I am familiar with. Are there any other purposes folks are using it for?
I am also curious about large scale cloud deployments use cases for headless chrome that the HN crowd might be aware of. Generating diagrams from Markdown files using the Mermaid JS library. They have a CLI but it's NPM based so you basically have to pick your poison as to what you'll be configuring. In my case Chrome made more sense. I used it for creating PDFs at my last job. We've done this. You can run it in AWS lambda. Could someone elaborate? How does this work? Do you create a HTML document then print the output as a PDF with headless Chrome? Yes exactly, HTML document using whatever templating language you want (or even client-side JavaScript framework since Chrome can handle that too) and then output a PDF. I use currently use puppeteer to do the same thing I use it to interface and download reports and other data on behalf of customers from sites that don't have any type of 3rd party api. I use it to get rendered web pages I want to scrap. I was doing the same for an article reader / archiver I built but it was slow. Did you ever figure out how to speed it up? Cancelling image and media requests helped but it increased the likelihood of being flagged as a bot. Sorry I never looked at the perf aspect of it since my needs were modest (less than 50 web pages per day). The first thing that would come to my mind is to parallelize it but then it's going to become pretty complex. *scrape I use it for a trading bot on Fifa 2020 Fut mode I imagine you don't want to share too much info about this, but I'd be interested in any more detail you are willing to share. I use it to test my Content-Security-Policy by crawling my whole site and capturing any violation reports that are sent. Mind sharing your script? This has been absorbed into an internal repo now, but the original version that I wrote a couple of years ago is here: https://gitlab.com/jamieweb/travis-ci_csp-tester/ Cheers! What's wrong with just plain old curl? cURL doesn't load subresources or honour Content-Security-Policy headers as this is beyond the scope of what it's supposed to do. I use it to archive complex web pages. Automated testing.