Pyppeteer minimal example
This script is a minimal example on how to use Pyppeteer to fetch a web page and extract the page title (the content of the .logo_default HTML element)
pyppeteer_minimal_example.py
#!/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')
    # Get the URL and print it
    title = await page.evaluate("() => document.querySelector('.logo-default').textContent")
    print(f"Page title: {title}") # prints Page title: TechOverflow
    # Cleanup
    await browser.close()
asyncio.get_event_loop().run_until_complete(main())How to run:
run_pyppeteer_example.sh
pip install -U pyppeteer
python PyppeteerExample.pyCheck out similar posts by category:
Pyppeteer
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow