Pyppeteer (Python) - UNMAINTAINED
DEPRECATION WARNING
This documentation is for BaaS v1, which is no longer actively supported. If you are a new user, please refer to the maintained BaaS v2 Quick Start, Playwright configurations, or BrowserQL.
NOTE: We suggest not using this library anymore as it is now unmaintained. Please consider Quick Start and Playwright configurations as the maintained alternatives.
You can use your existing python infrastructure today with browserless by using Pyppeteer, an unofficial python port of puppeteer.
Below is a small example of getting started:
import asyncio
import pyppeteer
async def main():
browser = await pyppeteer.launcher.connect(
browserWSEndpoint='wss://chrome.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 will simply navigate to the example website and return the title, however it'll give you a great starting place for using Pyppeteer alongside browserless.
Be sure to let us know if you have questions or issues.