Starting a Browser Task

A browser task in Browser Swarm represents a single browser instance running in the cloud. It's the fundamental unit for executing web automation tasks, providing an isolated environment for your operations.


🛠️ Creating a Browser Task

Browser tasks are initiated through the Sessions API or our SDKs, granting you full control over configuration and features. Upon creation, you'll receive a connection URL to use with your preferred automation framework.

Example

import { BrowserSwarm } from 'browser-swarm-sdk';

const bs = new BrowserSwarm({ apiKey: process.env.BROWSER_SWARM_API_KEY });
const session = await bs.sessions.create({
  projectId: process.env.BROWSER_SWARM_PROJECT_ID,
  // Add configuration options here
});


⚙️ Configuration Options

When creating a session, you can customize various settings to suit your needs.

Basic Settings

  • Region: Choose where your browser runs to reduce latency.

  • Viewport: Set custom screen dimensions for your browser window.

  • Keep Alive: Enable longer-running sessions that persist after disconnection.

  • Recording: Enable or disable session recording (enabled by default).

  • Logging: Enable or disable session logging for debugging (enabled by default).

Advanced Features

  • Stealth Mode: Configure anti-bot mitigations, including automatic fingerprinting and advanced stealth options.

  • Proxies: Set up proxy configurations for your sessions.

  • Captcha Solving: Enable automatic captcha solving (enabled by default).

  • Extensions: Load custom browser extensions to enhance functionality.

  • Browser Context: Configure isolated browsing contexts for session persistence.

  • User Metadata: Attach custom data for session organization and filtering.


Next Steps

After creating a session, you can:

  1. Connect to it using your preferred automation framework.

  2. Monitor it through the Session Inspector.

  3. End it manually or let it timeout.

Last updated