---
title: "Comment by Furqan Ashraf on \"How to Take Screenshots in Python: Full Screen, Full Page, and Custom Settings\" | Hashnode"
description: "The max_steps cap in scroll_to_bottom is a good detail. Infinite-scroll pages are where most homemade full-page scripts hang. There's one gap left after scrolli"
url: "https://hashnode.com/posts/how-to-take-screenshots-in-python-full-screen-full-page-and-custom-settings-x23fr/6afd4aad6125e2871b343105/comment/6b053222bd953dca395ff81c"
---

[Discussion](https://hashnode.com/posts/how-to-take-screenshots-in-python-full-screen-full-page-and-custom-settings-x23fr/6afd4aad6125e2871b343105)

Comment [How to Take Screenshots in Python: Full Screen, Full Page, and Custom Settings](https://hashnode.com/posts/how-to-take-screenshots-in-python-full-screen-full-page-and-custom-settings-x23fr/6afd4aad6125e2871b343105)

[Furqan Ashraf](https://hashnode.com/@jfreaks)

[8h ago](https://hashnode.com/posts/how-to-take-screenshots-in-python-full-screen-full-page-and-custom-settings-x23fr/6afd4aad6125e2871b343105/comment/6b053222bd953dca395ff81c)

The `max_steps` cap in `scroll_to_bottom` is a good detail. Infinite-scroll pages are where most homemade full-page scripts hang.

There's one gap left after scrolling. A lazy image can have started loading but not finished decoding by the time you scroll back to the top and capture, so you still get the occasional grey box. Waiting for the images to actually finish closes most of that:

```python
scroll_to_bottom(page)
page.wait_for_function(
    "Array.from(document.images).every(img => img.complete && img.naturalWidth > 0)",
    timeout=10000,
)
page.screenshot(path=output, full_page=True)
```

(Wrap it in the same `PlaywrightTimeout` try/except you already use for `networkidle`, because one broken image URL shouldn't fail the whole capture.) Cookie banners are the other common problem in full-page shots. `page.add_style_tag()` with a few known banner selectors set to `display:none` is the cheap fix.

For the "hundreds on a schedule" case from your intro, running Chromium yourself becomes most of the work: memory, timeouts, retries, and keeping the browser build up to date. At that point a hosted endpoint with the same options may be simpler. The [APIFreaks Website Screenshot API](https://apifreaks.com/api/website-screenshot) maps closely to the flags in your `webshot.py`:

```python
import requests

r = requests.get(
    "api.apifreaks.com/v1.0/screenshot",
    params={
        "url": "example.com",
        "full_page": "true",
        "lazy_load": "true",        # does the scroll-through for you
        "scroll_delay": 150,        # same idea as your pause_ms
        "no_cookie_banners": "true",
        "dark_mode": "true",
        "retina": "true",
        "file_type": "PNG",
        "output": "json",
    },
    headers={"X-apiKey": API_KEY},
    timeout=120,
)
print(r.json()["screenshot"])  # hosted file URL
```

A basic capture costs 50 credits and new accounts start with 10,000, so you can test a batch before deciding whether to keep running Playwright yourself.

[ZyVOP](https://hashnode.com/@zyvop)

[4h ago](https://hashnode.com/posts/how-to-take-screenshots-in-python-full-screen-full-page-and-custom-settings-x23fr/6afd4aad6125e2871b343105/comment/6b053222bd953dca395ff81c#reply-6b056c3efcc0deb1f25ff8d9)

Good additions. I'd use `img.decode()` to explicitly wait for image decoding, while handling individual failures so broken URLs don't block the capture. Cookie banners also need site-specific selectors. The hosted API is worth considering for larger workloads, though cost and external dependencies become part of the trade-off.
