By Rajesh Kannan, Co-Founder & CTO, Gramosoft · Last updated: · Code tested with Playwright 1.63 and Chromium against a local test page on December 1, 2026
A full-page screenshot in Python is one line with Playwright, but that line often captures blank images, half-faded sections and a cookie banner in the middle of the page. This guide starts with GcrawlAI's website screenshot API, then shows the Playwright and Selenium code that gets full pages right, with a local test of what each approach actually captures.
TL;DR
- The one-liner misses content: in our test,
page.screenshot(full_page=True)right after load captured 0 of 12 lazy images and painted the cookie banner mid-page. - Resizing the window isn't enough: the page grew from 5,358 to 7,266 px after the resize, so the capture stopped short and missed six images.
- Scroll first, then capture: scrolling to the bottom, waiting for images and hiding banners with Playwright's
styleoption captured all 12 images and the footer. - GcrawlAI does the scrolling, banner and ad blocking for you, from a residential IP in the country you pick, as one request; failed requests are never charged.
How do you take a full-page screenshot of a website in Python? With Playwright, open the page, scroll to the bottom so lazy images load, wait for them, scroll back up, then call page.screenshot(path="page.png", full_page=True) with a style rule that hides cookie banners. For many sites or protected pages, a screenshot API such as GcrawlAI does the same in one call.
| Method | Full page | Lazy images | Cookie banners | Best for |
|---|---|---|---|---|
| GcrawlAI screenshot API | full_page=True |
Auto-scroll built in | block_cookie_banners |
Many pages, protected sites, no browsers to run |
| Playwright | full_page=True |
Scroll first yourself | Hide with style |
Local scripts, tests, full control |
| Selenium with Chrome | DevTools captureBeyondViewport |
Scroll first yourself | Hide with JavaScript | Projects already on Selenium |
| Selenium with Firefox | get_full_page_screenshot_as_file |
Scroll first yourself | Hide with JavaScript | Firefox-only test suites |
Take full-page screenshots with the GcrawlAI API
GcrawlAI loads the page in a real browser through a residential IP in the country you choose, scrolls it so lazy content loads, hides cookie banners and ads, and returns a full-page PNG or JPEG. There's no browser to install or keep updated, each screenshot is one request, and failed requests are never charged.
The call below captures a full page at 1440 px wide from an Indian IP, with cookie banners, ads and a chat widget hidden. auto_scroll is on by default, and scroll_delay controls how long it waits between scroll steps. Point base_url at your own server to run it on the self-hosted core.
# gcrawlai_screenshot.py
# pip install gcrawl-sdk
"""Full-page screenshot through GcrawlAI: a real browser that scrolls for lazy content, hides cookie
banners and ads, and loads the page through a residential IP in the country you choose."""
import os
from gcrawl_sdk import GcrawlClient, ScreenshotOptions
gc = GcrawlClient(api_key=os.getenv("GCRAWL_API_KEY", "gc-YOUR_API_KEY"))
# Self-hosted core: GcrawlClient(api_key=..., base_url="http://localhost:8000")
result = gc.screenshot(
"https://books.toscrape.com/",
options=ScreenshotOptions(
full_page=True, format="png", viewport_width=1440, viewport_height=900,
auto_scroll=True, scroll_delay=500, # trigger lazy images before capture
block_cookie_banners=True, block_ads=True,
hide_selectors=[".chat-widget"], # anything else that floats over content
proxy_geo="IN",
),
wait=True, poll_interval=2,
)
print(result.is_completed, result.screenshot_url) # download the PNG from screenshot_url
- Capture options: full page or viewport, PNG or JPEG with quality, any viewport size, mobile emulation, light or dark colour scheme, and a CSS selector for one element.
- Clean shots: cookie banner and ad blocking,
hide_selectorsfor anything else, andfull_page_max_heightto cap endless pages. - Protected and local sites: residential IPs with country targeting and handling for Cloudflare, DataDome, Akamai and PerimeterX, so you capture the page visitors see, not a bot check.
- Beyond screenshots: scrape, crawl, map and the Search API on the same key, and offline bundles of whole sites.
- How you connect: the managed Cloud API, the Python SDK, an MCP server for AI agents, the Playground and docs, or the MIT-licensed core on your servers.
- Billing: 50 free requests a month with no card, then $0.67 to $9.67 per 1,000 requests, with failed captures, timeouts and blocked pages never billed.
Where it falls short: there's no PDF or video output and no scripted clicks or logins before the capture, so pages behind a login still need your own browser session. Results come back as a URL to download rather than raw bytes. The ecosystem is younger, and self-hosting means bringing your own proxy accounts. For a handful of local test shots, Playwright is free.
"A screenshot that looks fine at a glance can still be missing half the page. We check the footer and count the images in every capture, because nobody notices the blank ones until a customer does."
Rajesh Kannan, Co-Founder & CTO at Gramosoft
Take a full-page screenshot with Playwright
Playwright's full_page=True captures the whole scrollable page in one image, but it captures the page as it is at that moment. Images that load on scroll and sections that fade in on scroll aren't there yet. The fix is to scroll to the bottom first, wait for images, then capture.
# playwright_full_page.py
# pip install playwright && playwright install chromium
"""Full-page screenshot with Playwright that doesn't miss lazy images or catch cookie banners.
page.screenshot(full_page=True) alone captures the page as it is right after load: images that load
on scroll are still empty. So scroll to the bottom first, wait for images, then capture."""
from playwright.sync_api import sync_playwright
HIDE = "[id*=cookie],[class*=cookie],[id*=consent],[class*=consent],[class*=chat-widget]{display:none!important}"
def scroll_through(page, pause_ms=400, max_steps=80):
"""Scroll down a screen at a time until the page stops growing, then wait for every image."""
last, steady = 0, 0
for _ in range(max_steps):
page.evaluate("window.scrollBy(0, innerHeight * 0.8)")
page.wait_for_timeout(pause_ms)
height = page.evaluate("document.documentElement.scrollHeight")
bottom = page.evaluate("innerHeight + scrollY >= document.documentElement.scrollHeight - 2")
steady = steady + 1 if bottom and height == last else 0
if steady >= 2: # at the bottom twice with no growth: nothing left to load
break
last = height
page.evaluate("""() => Promise.race([new Promise(r => setTimeout(r, 8000)),
Promise.all([...document.images].filter(i => !i.complete)
.map(i => new Promise(r => { i.onload = i.onerror = r; })))])""")
page.evaluate("window.scrollTo(0, 0)")
page.wait_for_timeout(300)
def full_page_screenshot(url, path, width=1440, height=900, hide_css=HIDE):
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page(viewport={"width": width, "height": height})
page.goto(url, wait_until="domcontentloaded")
scroll_through(page)
page.screenshot(path=path, full_page=True, animations="disabled", style=hide_css)
browser.close()
if __name__ == "__main__":
full_page_screenshot("https://books.toscrape.com/", "books_full.png")
# One element only: page.locator("#pricing").screenshot(path="pricing.png")
scroll_through() moves down most of a screen at a time and stops when it has reached the bottom twice without the page growing, so pages that add content as you scroll get their extra height before the capture. It then waits up to eight seconds for any images still loading. Playwright's style option applies CSS only during the screenshot, which is the cleanest way to hide cookie banners and chat widgets without changing the page, and animations="disabled" stops half-finished transitions.
For one part of a page, call screenshot() on a locator, such as page.locator("#pricing").screenshot(path="pricing.png"); Playwright scrolls the element into view and crops to it. If the page needs JavaScript to render at all, our guide to scraping dynamic JavaScript websites covers waiting strategies.
What each approach actually captured
We built a local test page with the problems real pages have: six native lazy images, six JavaScript lazy images that grow when loaded, sections that fade in, a fixed header, a cookie banner, a chat bubble and a red footer. Then we captured it three ways with Playwright and Chromium.
# lab_output.txt (printed output)
A) full_page=True right after load
images loaded by now: 0/6 native lazy, 0/6 JS lazy · sections faded in: 2/12
capture 1440x5358 px, page now 5358 px · footer clear at bottom: yes · cookie banner in shot: yes
B) resize window to the measured 5358 px, capture viewport
images loaded by now: 6/6 native lazy, 6/6 JS lazy · sections faded in: 12/12
capture 1440x5358 px, page now 7266 px · footer clear at bottom: NO · cookie banner in shot: yes
C) scroll_through(), then full_page=True with banners hidden
images loaded by now: 6/6 native lazy, 6/6 JS lazy · sections faded in: 12/12
capture 1440x7266 px, page now 7266 px · footer clear at bottom: yes · cookie banner in shot: no
D) very tall page (60 sections), same as C
images loaded by now: 6/6 native lazy, 6/6 JS lazy · sections faded in: 60/60
capture 1440x19789 px, page now 19789 px · footer clear at bottom: yes · cookie banner in shot: no
E) one element: locator('section').nth(2).screenshot() -> 1360x560 px
The one-line capture got the full height, but none of the 12 images and only 2 of 12 sections; the fixed cookie banner was painted where the viewport happened to be. The Selenium-style resize loaded everything, but only after the capture had started, so the page outgrew the screenshot by almost 1,900 px. Scrolling first got every image, every section and the footer. A 60-section page of 19,789 px captured cleanly with the same function. The test page and runner are in the code download.
Take a full-page screenshot with Selenium
Selenium's standard save_screenshot() captures only the visible window. Firefox's driver has a built-in full-page call; with Chrome you ask the DevTools Protocol to capture beyond the viewport. Either way, scroll first, or you'll get the same blank images as the Playwright one-liner.
# selenium_full_page.py
# pip install selenium (Selenium Manager fetches the matching driver)
"""Full-page screenshots with Selenium. Firefox has a native call; Chrome needs the DevTools Protocol."""
import base64
from selenium import webdriver
def chrome_full_page(url, path, width=1440):
opts = webdriver.ChromeOptions()
opts.add_argument("--headless=new")
opts.add_argument(f"--window-size={width},900")
driver = webdriver.Chrome(options=opts)
try:
driver.get(url)
# scroll first so lazy images load (same idea as the Playwright version)
driver.execute_script("""return new Promise(done => { let y = 0; const t = setInterval(() => {
window.scrollBy(0, innerHeight * 0.8); y += 1;
if (innerHeight + scrollY >= document.body.scrollHeight - 2 || y > 80) { clearInterval(t); setTimeout(done, 1500); }
}, 400); });""")
driver.execute_script("window.scrollTo(0, 0)")
shot = driver.execute_cdp_cmd("Page.captureScreenshot", {"format": "png", "captureBeyondViewport": True})
with open(path, "wb") as f:
f.write(base64.b64decode(shot["data"]))
finally:
driver.quit()
def firefox_full_page(url, path):
opts = webdriver.FirefoxOptions()
opts.add_argument("-headless")
driver = webdriver.Firefox(options=opts)
try:
driver.get(url)
driver.get_full_page_screenshot_as_file(path) # Firefox only
finally:
driver.quit()
if __name__ == "__main__":
chrome_full_page("https://books.toscrape.com/", "books_chrome.png")
The common Chrome workaround of resizing the window to the page height is what our test's approach B reproduced: lazy content loads after the resize, six images were still missing from the shot, the cookie banner sat over the footer, and the page ended up 1,908 px taller than the screenshot. captureBeyondViewport after a scroll avoids that. This Selenium file compiles against Selenium 4.54 but wasn't part of our local test, which used Playwright. Our Playwright vs Puppeteer vs Selenium comparison covers the wider trade-offs.
Fix the common full-page screenshot problems
Most broken screenshots come from a short list of causes: capturing too early, content that loads on scroll, things floating over the page, the wrong viewport, and pages that never end. Each has a direct fix in Playwright, and an option in GcrawlAI's screenshot API.
| Problem | Fix in Playwright | Option in GcrawlAI |
|---|---|---|
| Blank or half-loaded page | Wait for a selector or networkidle |
timeout |
| Missing lazy images | scroll_through() before capture |
auto_scroll, scroll_delay |
| Sections faded out | Scroll first, animations="disabled" |
auto_scroll |
| Cookie banner or chat widget on top | style= CSS that hides them |
block_cookie_banners, hide_selectors |
| Ads | Block ad requests with page.route |
block_ads |
| Wrong layout | Set the viewport before goto |
viewport_width, is_mobile |
| Endless or huge page | Cap the scroll steps; crop the image | full_page_max_height |
| Bot check instead of the page | Stealth browser and residential proxies | Residential IPs and anti-bot handling built in |
Pages behind a login need a browser context with saved cookies, never credentials hardcoded in the script. If the target serves a bot check instead of the page, a screenshot only records the bot check; our guide to bypassing Cloudflare covers what's behind those pages.
Playwright, Selenium or a screenshot API in 2027?
Use Playwright for local scripts, tests and a few hundred pages you control. Stay with Selenium if your test suite already runs on it. Use a screenshot API when screenshots are part of a product, run across many sites, or hit protected pages, so browsers, proxies and banners become someone else's job.
| Your situation | Good fit | Where GcrawlAI fits |
|---|---|---|
| Visual tests on your own app | Playwright | Not needed; Playwright is free and local |
| Existing Selenium suite | Selenium with Chrome DevTools or Firefox | Use it for third-party sites the suite can't reach |
| Thumbnails or archives of many sites | Screenshot API | One request per screenshot, failed ones free |
| Competitor or price pages behind bot protection | Screenshot API with residential IPs | Residential IPs and anti-bot handling included |
| Pages as seen from another country | Screenshot API with geotargeting | proxy_geo on every capture |
Our website screenshot APIs comparison lists vendors, formats and prices if you're choosing an API.
Frequently asked questions
How do I take a full-page screenshot in Python?
With Playwright, call page.screenshot(path="page.png", full_page=True). For real sites, scroll to the bottom first so lazy images load, wait for images, scroll back to the top, then capture with a style rule hiding cookie banners. GcrawlAI's screenshot API does all of that in one call with full_page=True.
Why are images missing from my Playwright full-page screenshot?
Because they load only when scrolled into view, and full_page=True captures the page as it is right after load. In our test that one-liner captured 0 of 12 lazy images. Scroll through the page and wait for images before the screenshot, or use an API with auto-scroll such as GcrawlAI.
How do I take a full-page screenshot with Selenium?
Selenium's save_screenshot() captures only the window. With Firefox, use driver.get_full_page_screenshot_as_file(). With Chrome, call the DevTools command Page.captureScreenshot with captureBeyondViewport set to true. In both cases, scroll through the page first so lazy content has loaded, or skip the browser and use a screenshot API.
How do I hide cookie banners in screenshots?
In Playwright, pass CSS through the screenshot's style option, such as a rule that sets cookie and consent elements to display: none. It applies only during the capture. Selectors differ by site, so test them. GcrawlAI's block_cookie_banners and hide_selectors options handle this in the API.
How do I screenshot one element instead of the whole page?
Call screenshot() on a locator: page.locator("#pricing").screenshot(path="pricing.png"). Playwright scrolls the element into view and crops the image to it. In Selenium, call screenshot() on the element. GcrawlAI's screenshot API takes a CSS selector in its selector option for the same result, without running a browser.
Is there a size limit on full-page screenshots?
Very tall pages can hit browser and memory limits, and endless pages never finish. Our 19,789 px test page captured cleanly with Playwright and Chromium, but cap scroll steps on infinite feeds and crop if needed. GcrawlAI's full_page_max_height option sets a ceiling for each capture.
Is GcrawlAI open source, and what does it cost?
Yes. The core is MIT-licensed and self-hostable, alongside a managed Cloud API, Python SDK and MCP server. The free plan has 50 requests a month with no card, and paid plans cost $0.67 to $9.67 per 1,000 requests. Each screenshot is one request with residential IPs included, and failed requests are never charged.
Related guides
- Playwright vs Puppeteer vs Selenium for Web Scraping (2026)
- How to Scrape Dynamic JavaScript Websites with Python (2026 Guide)
- How to Download an Entire Website as a ZIP for Offline Use
- How to Bypass Cloudflare When Web Scraping (2026)
- Camoufox Tutorial: Scrape Without Getting Detected
- Web Scraping with Python vs a Scraping API: When to Stop Writing Your Own Scraper