
The application will receive a URL from the user it will generate a PDF with the content of the website and will save the generated file in a defined directory. Let's see how to generate PDF files with a C# console app using the Puppeteer Sharp NuGet package.

Let's play with Puppeteer Sharp and leverage it to generate content in PDF. So, we can automate interactions with those web browsers. One cool thing is that Puppeteer Sharp supports Chromium-based browsers (Google Chrome, Microsoft Edge), but also Mozilla Firefox. As the library was developed with a C# focus, we can use it with features like dependency injection, Async suffixes, etc. We can interact with a headless browser through a command line.Įven though Puppeteer runs mainly as a headless Chromium instance, we have the possibility to set it as "non-headless" and display all the interactions on the screen. It renders HTML documents and executes JavaScript code, but without displaying it on the screen. What Is Puppeteer?Īccording to the official definition, Puppeteer is "A Node library which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol".Ī headless browser is basically a web browser without a graphic user interface. One of the first to be released was Puppeteer. There are various browser automation tools in the market, implemented for several programming languages and with different features or purposes. Crawl a Single-Page Application (SPA) and generate pre-rendered content.Automate and validate keyboard input responses.


"Browser automation" is the action of automating the usage of a web browser. In this article, we will see how to implement automatic workflows interacting with a web browser instance.

One example of this is the dynamic generation of files and images. We get consistent results over iterations.īesides the benefits that automation brings us, there are some scenarios that couldn't be achieved if we don't execute an automatic process.Some of the reasons why we should try to automate our workflows are: One of the goals every developer has is to automate as many actions and tasks as possible.
