Overview

BrowserCat is the purr-fect browser automation platform, offering direct and complete access to a fleet of browsers distributed across the globe.

In just a few lines of code, you can automate web browsers for scraping, generating images, PDFs, and videos, or running automated tests. What’s more, you can scale up to hundreds of parallel browsers without any of the headache of managing them yourself.

In this guide, we’ll quickly explore how BrowserCat works and how you can connect to it.

Let’s go!

Cat’s eye view

What is BrowserCat?

BrowserCat is an infrastructure platform specializing in browser automation. It offers a fleet of globally distributed browsers that you can connect to and control using a websocket connection.

These browsers are frequently used to build web crawlers, generate images and PDFs, automate boring tasks, and run automated tests blazingly fast. More recently, our browsers are frequently used to give LLMs control of real browsers in the cloud.

How does it work?

BrowserCat’s browser fleet listens for websocket requests made from your code. On a new connection, we launch the browser of your choice with the configuration you specify.

After that, your code is free to do everything you would normally do in a browser:

  • Launch new tabs and navigate to URLs
  • Click buttons, fill out forms, and scroll
  • Capture screenshots, generate PDFs, and videos
  • Run arbritrary JS within a browser context
  • And much more!

When your script ends, the browser shuts down, and we record your usage, so that we can bill you the minimum possible amount.

Is it secure?

Yes! BrowserCat is designed with security in mind.

Your browser session is isolated from all others, and at the end of the session, we purge all temporary data, including downloads, the cache, cookies, and local storage.

We also don’t collect any sensitive information from your sessions, so even a hacker couldn’t get their hands on your data or activity log.

How do I connect?

BrowserCat fully supports the Chrome Devtools Protocol (CDP) and the Playwright protocol.

Because of this flexibility, you’ll find good options across a wide range of programing languages, including Javascript, Python, Java, .NET, Ruby, PHP, Go, and Rust. You can even connect using a raw websockets connection and send CDP commands manually.

We recommend the following clients, in order of preference:

  1. Playwright: Fast, reliable, easy to use, under active development, and available for Javascript, Python, Java, and .NET.
  2. Puppeteer: Mature and well-documented, but slower than Playwright and only available for chromium-based browsers.
  3. Other CDP clients: See our docs on Pyppeteer, ChromeDP, Headless Chrome (Rust), and other CDP clients for more information.

Examples

Here’s a few examples to demonstrate just how easy it is to get started with BrowserCat. We’ll use Playwright and TypeScript for these examples, but you can use any of the clients or languages we mentioned above.

import * as pw from 'playwright';

run().catch(console.error)

async function run() {
  const bcatUrl = 'wss://api.browsercat.com/connect';
  const browser = await pw.chromium.connect(bcatUrl, {
    headers: {'Api-Key': '<YOUR_API_KEY>'},
  });

  const page = await browser.newPage();
  await page.goto('https://www.browsercat.com');
  
  const result = {
    title: await page.title(),
    h1: await page.locator('h1').first().innerText(),
    footerLinks: 
      await page.locator('footer a').map(($link) => {
        return {
          text: $link.innerText(),
          href: $link.getAttribute('href'),
        };
      }),
  };
  console.table(result);

  await browser.close();
}
import * as pw from 'playwright';

run().catch(console.error)

async function run() {
  const bcatUrl = 'wss://api.browsercat.com/connect';
  const browser = await pw.chromium.connect(bcatUrl, {
    headers: {'Api-Key': '<YOUR_API_KEY>'},
  });

  const page = await browser.newPage();
  await page.goto('https://www.browsercat.com');
  
  const png = await page.locator('h1').first().screenshot({
    path: 'h1.png',
  });
  console.info(png);

  await browser.close();
}
import * as pw from 'playwright';

run().catch(console.error)

async function run() {
  const bcatUrl = 'wss://api.browsercat.com/connect';
  const browser = await pw.chromium.connect(bcatUrl, {
    headers: {'Api-Key': '<YOUR_API_KEY>'},
  });

  const page = await browser.newPage();
  await page.goto('https://www.browsercat.com/docs');
  await page.locator('main nav').evaluate((el) => {
    el.remove();
  });
  
  const pdf = await page.pdf({
    path: 'docs.pdf',
    format: 'A5',
  });
  console.info(pdf);

  await browser.close();
}
import {test, expect} from '@playwright/test';

test.describe('Pricing', () => {
  test('slider updates values', async ({page}) => { 
    // Navigate to the pricing page
    await page.goto('https://www.browsercat.com/pricing');

    // Wait for the slider to be interactive
    const sliderSelector = 'input[type="range"]';
    await page.waitForLoadState();

    // Test the slider at various positions
    const $range = page.locator(sliderSelector);
    const $savings = page.locator('#price-savings');
    const min = parseInt(await $range.getAttribute('min')!);
    const max = parseInt(await $range.getAttribute('max')!);

    for (let i = min; i <= max; i++) {
      // Set the slider value within the page context
      await $range.evaluate((
        el: HTMLInputElement, 
        value,
      ) => {
        el.value = value.toString();
        el.dispatchEvent(new Event('input'));
      }, i);

      // Verify the displayed savings after the slider moves
      const savings = await $savings.textContent();
      expect(savings).toMatch(/^\d+[bkm]? credits/iu);
    }
  });
});

Start now!

Getting started is easy:

  1. Sign up for a free BrowserCat account.
  2. Create an API key.
  3. Create your first automation. (If you can, start with the Playwright.)
  4. Monitor usage, manage keys, and configure billing on the dashboard.