How to take a full page screenshot with Python and Puppeteer

Install Python Puppeteer Implementation and Chromium

pip install pyppeteer
pyppeteer-install

Take a screenshot of the element and save to file

import asyncio
from pyppeteer import launch

async def main():
    browser = await launch()
    page = await browser.newPage()

    await page.goto('https://www.bbc.co.uk/news/business-63709754')
    await page.screenshot({'path': "full-page.png", 'fullPage': True})

    await browser.close()

asyncio.run(main())

Find out how to capture an element with Python and Puppeteer.

We created Urlbox to make converting HTML to images easy

Learn more about our website screenshot API.