The web pages might also have external javascript libraries to track user behaviour and collect analytics. The web pages of the e-commerce sites will have several images of the product that we are not interested in. When we write automation scripts with Puppeteer often our page will load resources that are not necessary for our use case.įor instance, let's say we are writing a web scraper to crawl a couple of e-commerce sites to find a particular product and its price. Why block resourcesįirst of all, let's take a look at why we would want to block certain resources. In this article, we will go over all the various methods we can use to block/intercept specific network requests in our automation scripts. There are a couple of ways to block resources in Puppeteer. Puppeteer is one of the most widely used tools for web scraping and automation. In this article, we will take a look at how to block specific resources (HTTP requests, CSS, video, images) from loading in Puppeteer.
0 Comments
Leave a Reply. |