CLI Launch Args

Browsers offer a wide range of configuration options that can be set via CLI arguments. This includes enabling experimental features, tweaking browser behavior, and more.

BrowserCat gives you full control over your browser instance, including both the ability to add new args as well as to disable the default set.

Available options

You can tweak CLI args using two settings:

interface BrowserCatOptsHeader {
  // An array of CLI arguments to pass to the browser.
  enableArgs?: string[]

  // An array of default CLI arguments to ignore. 
  // Or `true` to ignore all default arguments.
  disableArgs?: string[] | boolean
}

At present, only Chrome, Chromium, and Firefox support setting CLI args. Webkit does not.

Here’s some handy links for each browser:

Configure your CLI args

Send your args configuration using the BrowserCat-Opts header. Here’s an example:

const headers = {
  'browsercat-opts': JSON.stringify({
    enableArgs: ['--disable-features=site-per-process'],
    disableArgs: ['--enable-automation'],
  }),
};
headers = {
    'browsercat-opts': json.dumps({
        'enableArgs': ['--disable-features=site-per-process'],
        'disableArgs': ['--enable-automation'],
    })
}

Playwright request

import * as pw from 'playwright';

const bcatUrl = 'wss://api.browsercat.com/connect';
const browser = await pw.chromium.connect(bcatUrl, {
  headers: {
    'api-key': '<YOUR_API_KEY>',
    'browsercat-opts': JSON.stringify({
      enableArgs: ['--disable-features=site-per-process'],
      disableArgs: ['--enable-automation'],
    }),
  },
});
await browser.close();
import asyncio
from playwright.async_api import async_playwright, Playwright

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

async def run():
    async with async_playwright() as pw:
        browser = await pw.chromium.connect(bcatUrl, headers={
            'Api-Key': '<YOUR_API_KEY>'
            'browsercat-opts': json.dumps({
                'enableArgs': ['--disable-features=site-per-process'],
                'disableArgs': ['--enable-automation'],
            })
        })
        await browser.close()

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

Puppeteer request

import puppeteer from 'puppeteer-core';

const bcatUrl = 'wss://api.browsercat.com/connect';
const browser = await puppeteer.connect({
  browserWSEndpoint: bcatUrl,
  headers: {
    'api-key': '<YOUR_API_KEY>',
    'browsercat-opts': JSON.stringify({
      enableArgs: ['--disable-features=site-per-process'],
      disableArgs: ['--enable-automation'],
    }),
  },
});
await browser.close();
import asyncio
from pyppeteer import connect

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

async def run():
    browser = await connect({
        'browserWSEndpoint': bcatUrl,
        'headers': {
            'api-key': '<YOUR_API_KEY>',
            'browsercat-opts': json.dumps({
                'enableArgs': ['--disable-features=site-per-process'],
                'disableArgs': ['--enable-automation'],
            })
        }
    })
    await browser.close()

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