Pyppeteer minimal screenshot example
This script is a minimal example on how to use Pyppeteer to fetch a web page and save a screenshot to screenshot.png
:
#!/usr/bin/env python3
import asyncio
from pyppeteer import launch
async def main():
browser = await launch()
page = await browser.newPage()
await page.goto('https://www.techoverflow.net', {'waitUntil': 'networkidle2'})
# Make screenshot
await page.screenshot({'path': 'screenshot.png'})
# Cleanup
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
How to run:
sudo pip3 install pyppeteer
python3 PyppeteerScreenshotExample.py