Skip to content

stagehandvscamoufox

MIT 183 14 22,012
2.8 million (month) Oct 29 2024 3.2.1(2026-04-10 21:10:37 ago)
7,089 3 244 MPL-2.0
Mar 01 2024 1.0 million (month) 0.4.11(2025-01-29 09:33:18 ago)

Stagehand is an AI-powered browser automation framework for JavaScript and TypeScript, built by Browserbase. It provides a simple API for controlling browsers using natural language instructions, powered by large language models.

Stagehand offers three core primitives:

  • act() Performs actions on the page described in natural language. For example, page.act("click the login button") will find and click the appropriate element.
  • extract() Extracts structured data from the page based on a natural language description and an optional schema definition.
  • observe() Analyzes the current page state and returns actionable elements and their descriptions, useful for understanding what actions are available on a page.

Key features include:

  • TypeScript-first Built with full TypeScript support and type-safe extraction using Zod schemas.
  • Multiple LLM providers Works with OpenAI, Anthropic, and other LLM providers for powering the AI.
  • Vision and DOM analysis Combines visual screenshot analysis with DOM inspection for robust element identification.
  • Playwright integration Uses Playwright as the browser automation backend, giving access to the full Playwright API alongside AI-powered actions.
  • Browserbase cloud Optionally integrates with Browserbase cloud for managed browser infrastructure.

Stagehand is particularly suited for automating complex web workflows where traditional selectors would be fragile, such as interacting with frequently changing UIs or scraping sites with dynamic layouts.

Camoufox is an anti-detect browser built on Firefox, designed specifically for web scraping and browser automation while evading bot detection systems. Unlike Chrome-based anti-detect solutions, Camoufox uses a patched version of Firefox with over 100 modifications to prevent fingerprinting and detection.

Key features include:

  • Firefox-based stealth Uses Firefox instead of Chrome, which has different fingerprinting characteristics and is less commonly targeted by anti-bot systems. The browser is patched at the C++ level to prevent JavaScript-based fingerprint leaks.
  • Realistic fingerprints Generates and applies realistic browser fingerprints including screen resolution, WebGL renderer, fonts, and other browser properties that match real user configurations.
  • Playwright integration Works seamlessly with Playwright for Python, providing the familiar Playwright API while running through the stealth-patched Firefox instance.
  • Proxy support Built-in proxy support with authentication, including residential proxy rotation.
  • Geolocation spoofing Can spoof browser geolocation to match proxy IP location for consistent fingerprints.
  • Human-like behavior Includes utilities for adding human-like mouse movements and typing patterns.

Camoufox is particularly effective against sophisticated anti-bot systems that detect Chrome-based automation tools. By using Firefox as the base, it avoids many Chrome-specific detection vectors while the deep browser patches prevent general fingerprinting techniques.

Highlights


ai-powerednatural-languagetypescript
anti-detectstealth

Example Use


```javascript import { Stagehand } from '@browserbasehq/stagehand'; import { z } from 'zod'; const stagehand = new Stagehand({ env: 'LOCAL', // or 'BROWSERBASE' for cloud browsers modelName: 'gpt-4o', }); await stagehand.init(); const page = stagehand.page; // Navigate to a page await page.goto('https://news.ycombinator.com'); // Use natural language to interact await page.act('click on the "new" link in the navigation'); // Extract structured data with a schema const stories = await page.extract({ instruction: 'Extract the top 5 story titles and their point counts', schema: z.object({ stories: z.array(z.object({ title: z.string(), points: z.number(), })), }), }); console.log(stories); // Observe available actions on the page const actions = await page.observe('What actions can I take on this page?'); console.log(actions); await stagehand.close(); ```
```python from camoufox.sync_api import Camoufox # Launch stealth Firefox browser with Camoufox(headless=True) as browser: page = browser.new_page() # Navigate - the browser appears as a real Firefox user page.goto("https://example.com") # Use standard Playwright API for interaction page.fill("input[name='search']", "web scraping") page.click("button[type='submit']") # Extract data results = page.query_selector_all(".result") for result in results: title = result.query_selector("h3").text_content() print(title) # With proxy and custom fingerprint from camoufox.sync_api import Camoufox with Camoufox( headless=True, proxy={"server": "http://proxy.example.com:8080"}, geoip=True, # auto-match geolocation to proxy IP ) as browser: page = browser.new_page() page.goto("https://example.com") print(page.content()) ```

Alternatives / Similar


Was this page helpful?