Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Bulk website screenshots in Python with Playwright: full-page, mobile, PDF and no cookie banners

Description and use

An automated Python script using Playwright captures full-page or mobile screenshots of websites, hides cookie banners, triggers lazy-loaded images, and outputs PNG or PDF files.

Problem

Capturing hundreds of website screenshots that look correct is difficult due to cookie banners, lazy-loaded images, large page sizes, and sites that never reach network idle.

Outcome

The script successfully captured screenshots from six diverse sites, handling cookie banners, lazy-loading, and large page heights, producing clean PNG or PDF files.

Workflow

  • Install Playwright and Chromium
  • Create a list of URLs
  • Run the script with desired flags (e.g., --mobile --full --pdf --workers 4)
  • Script launches browsers, navigates to each URL, waits for load, injects CSS to hide cookie banners, scrolls to trigger lazy images, captures full-page or viewport, outputs PNG or PDF
  • Collects screenshots in the specified output directory

Evidence

Taking one screenshot with Playwright is a two-liner. Taking a few hundred that actually look right is where it gets fiddly: cookie banners cover half the page, lazy-loaded images come out blank, news homepages produce 60,000-pixel PNGs, and some sites never reach "network idle".

Source

Here's the script I ended up with, plus what happened when I ran it on six sites on October 21, 2026 (example.com, python.org, crawlee.dev, MDN, BBC and the Guardian).

Source

  • Record date: 2026-10-21T19:26:10.704Z