Skip to main content

Pyppeteer (Python) - UNMAINTAINED

warning

We suggest not using this library anymore as it is now unmaintained, please consider playwright-python as an alternative

Connect your Python automation to Browserless using Pyppeteer, an unofficial Python port of Puppeteer.

Basic Usage

import asyncio
import pyppeteer

async def main():
browser = await pyppeteer.launcher.connect(
browserWSEndpoint='wss://production-sfo.browserless.io?token=YOUR_API_TOKEN_HERE'
)
page = await browser.newPage()
url = "https://www.example.com"
await page.goto(url)
values = await page.evaluate('''() => document.querySelector('h1').innerHTML
''')
print(values)
await browser.close()

asyncio.get_event_loop().run_until_complete(main())

This example navigates to a URL and returns the page's h1 content.