← Back to Projects
Latest: v1.0.0 View Source →

BAF Studio Icon

Browser Automation Framework & BAF Studio

A stealth-first, .NET 10 browser automation, web scraping, and site reverse-engineering framework powered by real browser sessions.


Why BAF? The Stealth Advantage Over Patchright, Playwright & Puppeteer

Traditional browser automation frameworks—such as Playwright, Puppeteer, Selenium, and even patched forks like Patchright or puppeteer-extra-plugin-stealth—operate from the outside in. They spawn an instrumented browser binary controlled over the Chrome DevTools Protocol (CDP) or WebDriver. Modern anti-bot systems (Cloudflare Turnstile, DataDome, Akamai, Kasada, Imperva) actively fingerprint and flag these sessions through:

How BAF Achieves True Native Stealth

Browser Automation Framework (BAF) flips the architecture completely: it does not launch a fake or patched browser. Instead, BAF runs a lightweight local C# IPC server (AutomationServer) that communicates with a bridge script running inside your actual, everyday, trusted browser instance.

Capability / Vector Playwright / Patchright / Selenium Browser Automation Framework (BAF)
Browser Instance Spawns an automated/patched browser binary Uses your real, daily-driver browser
Control Protocol Chrome DevTools Protocol (CDP) / WebDriver Local WebSocket / GM_xmlhttpRequest IPC Bridge
TLS / JA3 / HTTP2 Fingerprint Automation binary fingerprint 100% authentic native browser fingerprint
Cookies, Sessions & Trust Tokens Isolated / synthetic profile Real user profile, existing logins & trust score
React / SPA Event Handling External synthetic CDP input dispatch In-context __reactProps$ & native DOM event simulation
Strict Page CSP (connect-src) Often breaks injected scripts Automatic fallback to privileged GM_xmlhttpRequest polling

Because all navigation, DOM inspection, clicking, input entry, and scraping happen inside a genuine human browser session with real cookies, extensions, GPU/WebGL state, and network stack, most anti-bot systems cannot distinguish BAF activity from normal user interaction.


Browser Compatibility & Firefox Support Note

Browser Unpacked MV3 Extension (Recommended) Legacy Tampermonkey Userscript
Google Chrome Supported Supported
Microsoft Edge Supported Supported
Brave / Vivaldi / Opera Supported Supported
Mozilla Firefox Not Yet Available Required (Supported)

Important Note for Firefox Users:
There is no native Firefox extension yet for the BAF Browser Extension. If you are automating or scraping in Firefox, you must use the legacy Tampermonkey userscript (Generate & Copy Script (TM) in BAF Studio or ScriptGenerator.Generate(...) in C#) until dedicated Firefox extension support is built.


Key Features

1. Dual-Transport IPC Engine (WebSocket + CSP-Safe HTTP Fallback)

2. Unpacked Manifest V3 Chrome Extension & Live Tab Manager

3. High-Performance Virtualized DOM Explorer & Middle-Click Picker

4. React-Compatible Automation Engine (AutomationRunner)

5. Intelligent Data Scraper (DataScraper & Fluent ScrapeBuilder)

6. Site Reverse Engineering & Asset Dumper (SiteDumper)

7. 100% Decoupled Core Library (BrowserAutomationFramework.dll) & BAF Studio IDE


Quick Start

Option A: Using the BAF Studio GUI

  1. Build and Run BAF Studio:
    dotnet build
    dotnet run --project "BAF Studio/BAF Studio.csproj"
    
  2. Start the Server: Set your desired port (default 9999) and IPC mode (WebSocket), then click Start Server.
  3. Connect Your Browser:
    • Chrome / Edge / Brave (Recommended):
      1. Click Export Chrome Extension... (or use the auto-synced BrowserAutomationFramework\ChromeExtension folder).
      2. Open chrome://extensions, enable Developer mode, click Load unpacked, and select the folder.
      3. Select any open browser tab in the Chrome Extension - Open Tabs panel to inject and switch to it immediately.
    • Firefox (or Legacy Userscript Mode):
      1. Install the Tampermonkey extension in Firefox.
      2. In BAF Studio, configure your target Match URLs (or leave Match Any Site checked) and click Generate & Copy Script (TM).
      3. Create a new userscript in Tampermonkey, paste the clipboard contents, save, and reload your target webpage.

Option B: Programmatic C# Usage (BrowserAutomationFramework.dll)

1. React-Safe Automation & Navigation

using BrowserAutomationFramework.Extensions;
using BrowserAutomationFramework.Models;
using BrowserAutomationFramework.Server;

using var server = new AutomationServer(port: 9999);

server.OnClientConnected += async (sender, client) =>
{
    Console.WriteLine($"Client connected: {client.DisplayName}");

    // Navigate and wait for page load
    await client.NavigateToUrlAsync("https://example.com/search");

    // Set React-controlled input and click search
    await client.SetReactInputValueAsync("input[name='q']", "stealth automation", overwrite: true);
    await client.ClickReactElementAsync("button[type='submit']");

    // Extract a single element's text
    string? heading = await client.ScrapeElementAsync("h1", ScrapeExtractionType.InnerText);
    Console.WriteLine($"Heading: {heading}");
};

await server.StartAsync();

2. Multi-Page Scraping with Fluent ScrapeBuilder

using BrowserAutomationFramework.Extensions;
using BrowserAutomationFramework.Models;
using BrowserAutomationFramework.Server;

public record ListingItem
{
    public string Name { get; set; } = "";
    public string Price { get; set; } = "";
    public string Link { get; set; } = "";
}

public async Task<List<ListingItem>> ScrapeListingsAsync(BrowserClient client)
{
    ScrapeResult result = await client.CreateScrape("Listings")
        .WithContainer("article.listing-card")
        .Field("Name", "h3.title", ScrapeExtractionType.InnerText)
        .Field("Price", "span.price", ScrapeExtractionType.InnerText)
        .Field("Link", "a.details", ScrapeExtractionType.Href)
        .WithPagination(nextPageSelector: "a[rel='next']", maxPages: 10, pageDelayMs: 1500, deduplicateRows: true)
        .ExecuteAsync();

    // Save to CSV/JSON or bind to strongly-typed objects
    await result.SaveToCsvFileAsync("listings.csv");
    return result.BindTo<ListingItem>();
}

3. Reverse-Engineering & Dumping a Site

using BrowserAutomationFramework.Extensions;
using BrowserAutomationFramework.Models;
using BrowserAutomationFramework.Server;

public async Task DumpSiteAssetsAsync(BrowserClient client)
{
    SiteDumpResult dump = await client.DumpAllAsync();
    await dump.SaveToDirectoryAsync(@"C:\ExportedSiteDump");
}

Repository Structure

BrowserAutomationFramework/
├── BrowserAutomationFramework/          # Core .NET 10 Class Library (BrowserAutomationFramework.dll)
│   ├── Automation/                      # AutomationRunner & AutomationStudioSession facade
│   ├── ChromeExtension/                 # Synced Manifest V3 Chrome Extension files
│   ├── Extensions/                      # ReactExtensions for BrowserClient
│   ├── Generators/                      # ScriptGenerator (TM) & ChromeExtensionGenerator
│   ├── Models/                          # Project, Scrape, DOM Snapshot, Dump & Event models
│   ├── ReverseEngineering/              # SiteDumper engine
│   ├── Scraping/                        # DataScraper, ScrapeBuilder & SelectorHelper
│   ├── Server/                          # AutomationServer & BrowserClient IPC engine
│   ├── Utils/                           # Windows file-association utilities
│   ├── BrowserAutomationFramework.csproj# Core library project file
│   └── API_REFERENCE.md                 # Full public API & IPC protocol reference
└── BAF Studio/                          # BAF Studio — Dark-mode WinForms IDE (BAF Studio.exe)
    ├── Controls/                        # Virtualized DomTreeView control
    ├── utils/                           # Dark mode theming utilities
    ├── BAF Studio.csproj                # BAF Studio WinForms project file
    ├── baf-studio-icon.svg              # BAF Studio 512x512 vector application icon
    └── MainForm.cs                      # BAF Studio UI wrapper

Documentation

For detailed type-by-type documentation of every namespace, class, method signature, event, and browser IPC command, see API_REFERENCE.md.