โ† Back to news

Show HN: Selector Forge โ€“ browser extension for AI-generated resilient selectors

github.com|17 points|0 comments|by ahmadilaiwi|Jun 22, 2026

๐Ÿ› ๏ธ Selector Forge: AI-Powered Resilient Selectors

Selector Forge is a sophisticated browser extension (supporting Chrome and Firefox via Manifest V3) designed to eliminate the headache of brittle fragile selectors. By leveraging AI and real-time DOM verification, it helps developers generate CSS and XPath selectors that actually last.

Whether you are crafting complex end-to-end (E2E) test suites, building a web scraper, or automating repetitive browser tasks, Selector Forge ensures your selectors are robust and reliable.

Selector Forge Logo


โš™๏ธ How It Works

The tool operates on a continuous feedback loop between the user's browser and the Intuned backend.

The Operational Flow

  1. Interaction: Open the extension on any webpage and select your target element(s).
  2. Contextual Capture: The extension gathers a lean snapshot containing the target, the surrounding DOM context, and initial seed candidates.
  3. AI Proposal: The backend generates and ranks potential selectors.
  4. Live Validation: The extension tests every single proposal against the actual live page.
  5. Delivery: Only selectors that are proven to work are presented to the user with a one-click copy button.

๐Ÿ›ก๏ธ The Trust Boundary

The core philosophy of Selector Forge is that the browser is the ultimate source of truth.

"The AI proposes and ranks; it never gets the final word on correctness."

To ensure absolute reliability, the system follows these constraints:

  • Mandatory Re-verification: No selector is displayed unless it is verified against the live DOM.
  • State Management: The extension maintains the session state to ensure continuity.
  • Precision Matching: For list-based selections, the system rejects any selector that results in over-matching or under-matching.

Mathematically, a selector SS is only accepted if: Match(S,DOMlive)=TargetSet\text{Match}(S, \text{DOM}_{\text{live}}) = \text{TargetSet}


๐ŸŽฏ Selection Modes

ModeUser ActionResultIdeal Use Case
SingleSelect one elementVerified candidates for that specific nodeButtons, inputs, unique labels
ListSelect two examples from a setA verified container selector for the entire groupTables, product grids, repeating lists

๐Ÿ’ป Development Guide

Getting Started

  • yarn install (This also triggers wxt prepare)
  • yarn dev (For Chrome) or yarn dev:firefox (For Firefox)
  • Load the unpacked extension from .output/chrome-mv3 via chrome://extensions (Developer mode enabled).

Command Reference

CommandPurpose
yarn devWatch mode for unpacked extension development
yarn compileRun tsc --noEmit for type checking
yarn testExecute Vitest unit and browser-mode tests
yarn buildCreate production-ready extension bundle
yarn build:e2eBuild variant with all_urls permissions (Internal use only)
yarn e2eRun Playwright tests against the packaged extension
yarn zipGenerate store-ready .zip archives
yarn iconsRefresh icon assets
yarn ladleLaunch isolated component previews at http://localhost:61010

Component Previews (Ladle)

The popup's React components are developed in isolation using Ladle.

  • Stories are located in stories/*.stories.tsx.
  • Configuration is found in .ladle/.
  • Since the popup relies on WXT globals, a no-op stub is provided in .ladle/wxt-globals.ts.

๐Ÿงช Testing Strategy

The project employs a three-tiered testing architecture:

  1. Unit Tests: Fast Vitest tests (Node/happy-dom) focusing on selector logic and state transformations.
  2. Browser Tests: Vitest browser-mode tests that validate candidates against a real DOM to ensure exact element set resolution.
  3. E2E Tests: Full-scale Playwright tests covering the entire flow: Pointer โ†’\rightarrow Popup โ†’\rightarrow Content Script โ†’\rightarrow Background Worker.

๐Ÿ“‚ Project Architecture

root/
โ”œโ”€โ”€ entrypoints/      # Main execution contexts
โ”‚   โ”œโ”€โ”€ background.ts # Service worker: session state & network I/O
โ”‚   โ”œโ”€โ”€ content.ts    # Content script: picker overlay & DOM testing
โ”‚   โ””โ”€โ”€ popup/        # React UI: controls and results
โ”œโ”€โ”€ lib/              # Core logic
โ”‚   โ”œโ”€โ”€ agent/        # Backend turn-taking controller
โ”‚   โ”œโ”€โ”€ content/      # Element registry & DOM inspection
โ”‚   โ”œโ”€โ”€ background/   # Context menus & CLI bridge
โ”‚   โ”œโ”€โ”€ messaging/    # Typed runtime-message protocol
โ”‚   โ”œโ”€โ”€ state/        # Schema, history, and preferences
โ”‚   โ”œโ”€โ”€ auth/         # Token handling & client
โ”‚   โ””โ”€โ”€ graphql/      # Workspace & usage queries
โ”œโ”€โ”€ tests/            # Vitest (Unit + Browser)
โ””โ”€โ”€ e2e/              # Playwright suites

For a deeper dive into the messaging layer and auth seams, refer to ARCHITECTURE.md.