Quick Start Guide
Get up and running with Auto-Browse quickly by following these simple steps.
Installation
Install Auto-Browse using npm:
npm install @auto-browse/auto-browse
Basic Setup
- Create a
.env
file in your project root:
# For OpenAI (default)
OPENAI_API_KEY=your_openai_api_key_here
LLM_PROVIDER=openai # Optional, this is default
AUTOBROWSE_LLM_MODEL=gpt-4o-mini # Optional, defaults to gpt-4o-mini
# Or for Google AI
GOOGLE_API_KEY=your_google_key_here
LLM_PROVIDER=google
AUTOBROWSE_LLM_MODEL=gemini-2.0-flash-lite # Or other supported model
Auto-Browse supports multiple LLM providers, with OpenAI as the default.
Simple Example
Here’s a complete example showing form automation:
import { auto } from "@auto-browse/auto-browse";
async function main() {
try {
// Navigate to the form
await auto("go to https://httpbin.org/forms/post");
// Take a snapshot to analyze the page structure
await auto("take a snapshot");
// Fill out the form
await auto('type "John Doe" in the customer name field');
await auto('select "Large" for size');
await auto('select "Mushroom" for topping');
await auto('check "cheese" in extras');
// Submit the form
await auto("click the Order button");
// Take a snapshot of the response page
await auto("take a snapshot of the response page");
} catch (error) {
console.error("Error:", error);
}
}
// Run the script
main().catch(console.error);
Using with Playwright Tests
Auto-Browse seamlessly integrates with Playwright tests:
import { test, expect } from "@playwright/test";
import { auto } from "@auto-browse/auto-browse";
test("example test", async ({ page }) => {
await page.goto("https://example.com");
// Get text using natural language
const headerText = await auto("get the header text");
// Type in an input using natural language
await auto('type "Hello World" in the search box');
// Click elements using natural language
await auto("click the login button");
});
Next Steps