Runnable code examples for common Browserless use cases.
-
Get an API token: sign up at browserless.io and grab your token from the account dashboard.
-
Clone this repo
git clone https://github.com/browserless/examples.git cd examples -
Pick an example: browse the Use cases table below and open the folder for the task you want to run (e.g.
examples/take-a-screenshot). -
Set your token: replace
YOUR_API_TOKEN_HEREin the script with your actual API token. -
Run it: each example folder contains ready-to-run scripts. For example, to take a screenshot with cURL:
bash examples/take-a-screenshot/rest/curl/screenshot.sh
Or with Node.js:
node examples/take-a-screenshot/frameworks/puppeteer/screenshot.mjs
Each example is self-contained. No shared dependencies to install.
| Use case | Description | Languages | Frameworks |
|---|---|---|---|
| Auto-Accept Cookie Consent Banners | Detect and dismiss cookie consent banners before scraping or capturing a page | ||
| Batch DOM Queries | Run multiple DOM queries in a single BQL request — all fields execute in the same browser session with no repeated page loads | ||
| Basic Playwright Connection | Connect an existing Playwright script to Browserless by swapping chromium.launch() for connectOverCDP() |
||
| Browse Cloudflare Access-Protected Pages | Access pages protected by Cloudflare Access zero-trust policies using Service Token headers or a saved authenticated profile | ||
| Close a Session | Terminate a BQL or Session API browser session when your automation is complete | ||
| Run Concurrent Browser Sessions | Launch multiple independent browser sessions in parallel to speed up large-scale scraping or automation | ||
| E2E Testing | Run end-to-end tests against a live remote browser using Playwright, Puppeteer, or BQL | ||
| Export a Slide Deck | Export a Google Slides presentation as a PDF by navigating to its export URL | ||
| Export Pages and Assets | Export a page and all its linked resources (CSS, JS, images) as a ZIP file using the Browserless /export endpoint | ||
| Fill and Submit a Form | Automate form interactions — typing into fields, selecting options, solving CAPTCHAs, and clicking submit | ||
| Generate a PDF | Export any webpage or HTML content as a PDF using the Browserless PDF API | ||
| Log In and Reuse Sessions | Log in once and reuse that authenticated state across many browser sessions without re-entering credentials | ||
| Log In via Email OTP | Automate login flows that send a one-time passcode to an email address — trigger the OTP, read the code, and enter it | ||
| Log In with BQL and Browser Automation | Automate a login flow — filling credentials, solving CAPTCHAs, and handling post-login redirects | ||
| Navigate After Click | Click a link and wait for the resulting page navigation to complete before continuing | ||
| Persist a Session | Save and restore browser state across requests for multi-step automation workflows | ||
| Record a Browser Session | Capture a browser session as a .webm video file using the Browserless recording API |
||
| Reconnect to a Browser | Reattach to an existing running browser session after disconnecting | ||
| Retry with Exponential Backoff | Implement retry logic with exponential backoff around Browserless requests to handle transient failures | ||
| Route Traffic Through a Proxy | Route browser sessions through a residential or custom proxy | ||
| Save Logins to Authenticated Profiles | Capture a logged-in browser state once and reuse it across parallel sessions without re-entering credentials | ||
| Scrape Booking.com | Extract hotel listings from Booking.com using stealth mode and a residential proxy | ||
| Scrape Etsy | Search Etsy and extract product titles, prices, and links | ||
| Scrape Glassdoor | Extract job listings from Glassdoor using stealth mode and a residential proxy | ||
| Scrape Google Shopping | Pull product results from Google Shopping search pages using stealth mode | ||
| Scrape Reddit | Extract posts from a subreddit using stealth mode | ||
| Scrape Walmart | Extract product listings from Walmart search results using stealth mode and a residential proxy | ||
| Scrape YouTube | Extract video results from YouTube search pages using stealth mode | ||
| Scrape Zillow | Extract property listings from Zillow using stealth mode and a residential proxy | ||
| Solving Cloudflare Challenges | Bypass Cloudflare Turnstile and JS challenges using the /unblock endpoint or BQL's solve mutation |
||
| Solving reCAPTCHAs | Automatically detect and solve reCAPTCHA v2, v3, invisible, and other CAPTCHA challenges during browser automation | ||
| Take a Screenshot | Capture any webpage as a PNG or JPEG using the Browserless screenshot API |