Browser Type

BrowserCat supports launching modern versions of Chrome, Chromium, Firefox, and Webkit browsers. Your client library will typically send the necessary configuration.

This setting will typically only be needed when using userland Chrome or when using an obscure client library. (Or making raw CDP requests!)

Available browser types

At present, we support the following browsers:

  • chrome: Chrome
  • chromium: Chromium
  • firefox: Firefox
  • webkit: WebKit

Configure browser type

In most cases, you won’t need to specify the browser type manually. However, if you do, you can use the browser query parameter or the browsercat-opts header.

The following examples will demonstrate the minimum config necessary to specify the browser type. Redundancy is okay, so long as your configuration aligns with your client library’s expectations.

Playwright request

Playwright sends all necessary information. No configuration needed!

import * as pw from 'playwright';

const bcatUrl = 'wss://api.browsercat.com/connect';

const chrome = await pw.chromium.connect(bcatUrl, {
  headers: {'Api-Key': '<YOUR_API_KEY>'},
  channel: 'chrome',
});
const chromium = await pw.chromium.connect(bcatUrl, {
  headers: {'Api-Key': '<YOUR_API_KEY>'},
});
const firefox = await pw.firefox.connect(bcatUrl, {
  headers: {'Api-Key': '<YOUR_API_KEY>'},
});
const webkit = await pw.webkit.connect(bcatUrl, {
  headers: {'Api-Key': '<YOUR_API_KEY>'},
});
import asyncio
from playwright.async_api import async_playwright, Playwright

async def run():
    async with async_playwright() as pw:
        bcatUrl = 'wss://api.browsercat.com/connect'

        chrome = await pw.chromium.connect(bcatUrl, channel='chrome', headers={
            'Api-Key': '<YOUR_API_KEY>'
        })
        chromium = await pw.chromium.connect(bcatUrl, headers={
            'Api-Key': '<YOUR_API_KEY>'
        })
        firefox = await pw.firefox.connect(bcatUrl, headers={
            'Api-Key': '<YOUR_API_KEY>'
        })
        webkit = await pw.webkit.connect(bcatUrl, headers={
            'Api-Key': '<YOUR_API_KEY>'
        })

asyncio.get_event_loop().run_until_complete(run())

Puppeteer request

Puppeteer requires using the browser query param to launch userland Chrome:

import puppeteer from 'puppeteer-core';

const bcatUrl = 'wss://api.browsercat.com/connect';

const chrome = await puppeteer.connect({
  browserWSEndpoint: bcatUrl + '?browser=chrome',
  headers: {'api-key': '<YOUR_API_KEY>'},
});
const chromium = await puppeteer.connect({
  browserWSEndpoint: bcatUrl,
  headers: {'api-key': '<YOUR_API_KEY>'},
});
import asyncio
from pyppeteer import connect

async def run():
    bcatUrl = 'wss://api.browsercat.com/connect'

    chrome = await connect({
        'browserWSEndpoint': f'{bcatUrl}?browser=chrome',
        'headers': {'api-key': '<YOUR_API_KEY>'},
    })
    chromium = await connect({
        'browserWSEndpoint': bcatUrl,
        'headers': {'api-key': '<YOUR_API_KEY>'}
    })

asyncio.get_event_loop().run_until_complete(run())

Note: Puppeteer does not currently have production-grade support for Firefox or Webkit.