Skip to content

browserless/examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Browserless Examples

Runnable code examples for common Browserless use cases.

Getting Started

  1. Get an API token: sign up at browserless.io and grab your token from the account dashboard.

  2. Clone this repo

    git clone https://github.com/browserless/examples.git
    cd examples
  3. 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).

  4. Set your token: replace YOUR_API_TOKEN_HERE in the script with your actual API token.

  5. 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 cases

Use case Description Languages Frameworks
Auto-Accept Cookie Consent Banners Detect and dismiss cookie consent banners before scraping or capturing a page
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
Run Concurrent Browser Sessions Launch multiple independent browser sessions in parallel to speed up large-scale scraping or automation
Extract and Download Images Find all images on a page and download them to disk, including JS-rendered content
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
Record a Browser Session Capture a browser session as a .webm video file using the Browserless recording API
Save Logins to Authenticated Profiles Capture a logged-in browser state once and reuse it across parallel sessions without re-entering credentials
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

About

Examples of using Browserless

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages