How to Capture a Continuous Screenshot? | CaptureAPI Blog
Back to Blog
Tutorial January 15, 2024 8 min read

How to Capture a Continuous Screenshot?

CaptureAPI
screenshot api full page screenshot automation tutorial

Capturing continuous screenshots—also known as full-page screenshots—is essential for many applications, from documentation generators to visual regression testing. In this comprehensive guide, we'll show you how to use our screenshot API to capture entire web pages, not just the viewport.

What is a Continuous Screenshot?

A continuous screenshot, or full-page screenshot, captures the entire content of a webpage, including content that extends beyond the initial viewport. Unlike standard screenshots that only capture what's visible on screen, continuous screenshots automatically scroll through the page and stitch together multiple captures to create a complete image of the entire page.

This is particularly useful for:

  • Documentation sites with long-form content
  • E-commerce product pages with detailed descriptions
  • Blog posts and articles
  • Landing pages with multiple sections
  • Visual regression testing

Using Our Screenshot API for Continuous Screenshots

Our website screenshot API makes it incredibly easy to capture full-page screenshots. You simply need to set the full_page parameter to true in your API request.

Basic Example

Here's a simple example using cURL:

curl "https://api.captureapi.net/screenshot?url=https://example.com&api_key=YOUR_API_KEY&full_page=true"

Python Example

For Python developers, here's how to capture continuous screenshots:

import requests

# Capture a full-page screenshot
response = requests.get(
    'https://api.captureapi.net/screenshot',
    params={
        'url': 'https://example.com',
        'api_key': 'YOUR_API_KEY',
        'full_page': True,
        'width': 1920,
        'height': 1080,
        'format': 'png'
    }
)

data = response.json()
print(f"Screenshot URL: {data['screenshot_url']}")
print(f"File Size: {data['file_size']} bytes")

JavaScript/Node.js Example

For Node.js applications:

const axios = require('axios');

async function captureFullPage() {
    const response = await axios.get(
        'https://api.captureapi.net/screenshot',
        {
            params: {
                url: 'https://example.com',
                api_key: 'YOUR_API_KEY',
                full_page: true,
                width: 1920,
                height: 1080,
                format: 'png'
            }
        }
    );

    console.log('Screenshot URL:', response.data.screenshot_url);
    console.log('File Size:', response.data.file_size, 'bytes');
}

captureFullPage();

Advanced Techniques

1. Removing Popups and Banners

When capturing continuous screenshots, popups and cookie banners can interfere with the final image. Our API includes an automatic popup removal feature:

curl "https://api.captureapi.net/screenshot?url=https://example.com&api_key=YOUR_API_KEY&full_page=true&remove_popups=true"

This automatically removes cookie consent banners, newsletter popups, and modal dialogs, ensuring your continuous screenshot captures only the main content.

2. Custom Resolutions for Continuous Screenshots

You can specify custom resolutions for your full-page screenshots. This is useful when you need consistent sizing across multiple captures:

curl "https://api.captureapi.net/screenshot?url=https://example.com&api_key=YOUR_API_KEY&full_page=true&width=1920&height=1080"

The width and height parameters set the viewport size before capturing. The full-page screenshot will maintain this width while extending vertically to capture all content.

Best Practices for Continuous Screenshots

1. Optimize for Performance

Full-page screenshots take longer to generate than viewport screenshots. To optimize performance:

  • Use appropriate viewport sizes (1920x1080 is a good default)
  • Enable remove_popups to avoid waiting for animations
  • Consider caching screenshots for static content
  • Implement retry logic for failed captures

Conclusion

Capturing continuous screenshots is straightforward with our screenshot API. Simply set full_page=true in your API request, and you'll get a complete screenshot of the entire webpage. Whether you're building documentation tools, visual testing systems, or content archiving solutions, our website screenshot API has you covered.

Ready to start capturing continuous screenshots? Get your free API key and start building today. Check out our API documentation for more examples and integration guides.

Ready to Start Building?

Get your free API key and start capturing screenshots in minutes

Get Your Free API Key →