llms.txt Content
Herd Documentation
==
Herd is a powerful platform and SDK for automating your own browser, ten or millions of them. Similar to Puppeteer but with support for multiple devices and real-time events, and no infrastructure to setup.
Document: Automation Basics
URL: https://herd.garden/docs/automation-basics
# Automation Basics
Welcome to Monitoro Herd! This guide will walk you through creating your first browser automation step-by-step. We'll start with the basics and gradually build up to more complex examples, explaining each concept along the way.
## javascript
## JavaScript SDK
### Setting Up Your Environment
Before writing any code, you'll need to set up your JavaScript environment and install the Herd SDK:
1. Make sure you have Node.js installed (version 14 or higher recommended)
2. Create a new project directory
3. Install the SDK using npm:
Code (bash):
npm install @monitoro/herd
### Initializing the Client
The first step in any automation is to initialize the Herd client with your API credentials:
Code (javascript):
// Import the Herd client
import { HerdClient } from '@monitoro/herd';
// Initialize the client with your API URL and token
const client = new HerdClient('your-token');
// Always initialize the client before using it
await client.initialize();
Note: **Note:** Replace the token with your actual Herd API token from your dashboard.
### Connecting to a Device
After initializing the client, you need to connect to a device (browser) that will perform the automation:
Code (javascript):
// Get a list of available devices
const devices = await client.listDevices();
// Connect to the first available device
const device = devices[0];
console.log(`Connected to device: ${device.id}`);
This code retrieves all devices registered to your account and connects to the first one. In a production environment, you might want to select a specific device based on its properties or availability.
### Creating a Page and Navigating
Now that you're con