> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browsertest.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Javascript SDK

> JavaScript SDK for automated browser testing and screenshots with AI-powered agentic testing

<Hero
  title="BrowserTest SDK"
  subtitle="Automate browser testing and capture screenshots with AI-powered agentic testing"
  actions={[
{
  text: "Get Started",
  href: "/quickstart",
  icon: "rocket",
  variant: "primary"
},
{
  text: "View on GitHub",
  href: "https://github.com/hematejaaluru/browsertest-sdk",
  icon: "github",
  variant: "secondary"
}
]}
  image={{
src: "/images/hero-screenshot.png",
alt: "BrowserTest SDK hero image"
}}
/>

## 🚀 Features

<Columns cols={2}>
  <Card title="Fast Screenshots" icon="camera" href="/guides/screenshots">
    Capture website screenshots with customizable options including full-page, element-specific, and batch processing.
  </Card>

  <Card title="Agentic Testing" icon="robot" href="/guides/agentic-testing">
    Run browser tests using natural language instructions with AI agents that understand and execute complex testing scenarios.
  </Card>

  <Card title="Test Templates" icon="file-text" href="/guides/templates">
    Create reusable test templates with structured output schemas for consistent and repeatable testing.
  </Card>

  <Card title="Batch Operations" icon="grid" href="/guides/batch-operations">
    Process multiple screenshots and tests efficiently with built-in concurrency control and error handling.
  </Card>
</Columns>

## 📦 Quick Installation

```bash theme={null}
npm install browsertest-sdk
# or
yarn add browsertest-sdk
```

## 💡 Basic Usage

```javascript theme={null}
import { BrowserTest } from 'browsertest-sdk';

const bt = new BrowserTest({
  apiKey: 'your-api-key-here' // Get from https://browsertest.in
});

// Take a screenshot
const screenshot = await bt.screenshot.take({
  url: 'https://example.com',
  fullPage: true,
  format: 'png'
});

// Run an agentic test
const testResult = await bt.testing.execute({
  instructions: 'Test the login functionality with valid credentials',
  url: 'https://example.com/login',
  outputSchema: {
    type: 'object',
    properties: {
      loginSuccessful: { type: 'boolean' },
      userName: { type: 'string' },
      errorMessage: { type: 'string' }
    }
  }
});
```

## 🛠️ Built for Developers

<Columns cols={2}>
  <Card title="TypeScript Support" icon="code" href="/guides/typescript">
    Full type definitions included with comprehensive IntelliSense support.
  </Card>

  <Card title="Async Job Management" icon="clock" href="/guides/async-jobs">
    Queue and monitor long-running test jobs with real-time status updates.
  </Card>
</Columns>

## 📊 Usage & Quotas

Track your API usage and manage quotas with built-in monitoring:

```javascript theme={null}
// Check current usage
const usage = await bt.getUsage();
console.log('Screenshots used:', usage.usage.screenshot.used);
console.log('Agentic tests used:', usage.usage.agentic.used);
```

## 🎯 Perfect For

* **QA Automation**: Automate repetitive testing tasks
* **Visual Regression**: Capture and compare screenshots
* **E2E Testing**: Run complex user journey tests
* **Monitoring**: Regularly check website functionality
* **Documentation**: Generate visual documentation

## 📈 Plans & Pricing

* **Starter**: 1,000 screenshots/month, 100 agentic tests/month
* **Pro**: 10,000 screenshots/month, 500 agentic tests/month
* **Enterprise**: Custom limits and features

<Callout type="info">
  Get your API key at [BrowserTest Dashboard](https://browsertest.in) to start using the SDK.
</Callout>
