메뉴
HN
Hacker News 36일 전

AI 기반 견고한 셀렉터 생성 브라우저 확장 프로그램

IMP
7/10
핵심 요약

Selector Forge는 웹 페이지의 요소를 선택하면 AI가 이를 분석해 안정적인 CSS 및 XPath 셀렉터를 생성해 주는 브라우저 확장 프로그램입니다. AI가 후보를 제안하더라도 실제 브라우저 DOM에서 최종 검증을 거치므로 오류가 적고 매우 신뢰할 수 있습니다. 주로 UI 자동화, 웹 스크래핑, E2E 테스트 작성 시 깨지기 쉬운 셀렉터로 인한 유지보수 문제를 해결하는 데 유용합니다.

번역된 본문

Selector Forge

어떤 페이지에서든 요소를 하나 선택하기만 하면 신뢰할 수 있는 셀렉터를 얻을 수 있습니다. AI가 이를 생성하고 평가한 후, 사용자에게 보여주기 전에 실시간 DOM 기반으로 재검증까지 수행합니다.

Selector Forge는 독립 실행형 브라우저 확장 프로그램(Chrome 및 Firefox, MV3 지원)으로, 현재 보고 있는 페이지에서 직접 강력한 CSS 또는 XPath 셀렉터를 만들 수 있도록 도와줍니다. 원하는 요소를 마우스로 가리키기만 하면, 확장 프로그램과 Intuned의 셀렉터 백엔드가 나머지 작업을 알아서 처리합니다. 즉, 후보 셀렉터를 제안하고 실제 페이지에서 테스트한 뒤, 정확히 매칭되지 않는 것은 모두 폐기합니다. 이는 E2E 테스트 작성, 스크래퍼 구축, 그리고 셀렉터 깨짐으로 인해 나중에 문제를 겪을 수 있는 모든 페이지 자동화에 매우 유용합니다.

설치 Chrome — Chrome 웹 스토어 Firefox — Firefox 부가 기능

작동 방식 아무 페이지나 열고 확장 프로그램을 클릭합니다. 선택 모드를 고른 후, 실제 페이지에서 요소를 직접 선택합니다. 확장 프로그램은 선택한 내용(선택된 대상, DOM 컨텍스트, 시드 후보)의 압축된 스냅샷을 캡처하여 백엔드로 전송합니다. 백엔드는 후보 셀렉터를 제안하고 순위를 매깁니다. 그런 다음 확장 프로그램이 실시간 DOM 환경에서 모든 후보를 테스트하고 그 결과를 다시 피드백합니다. 이 루프는 백엔드가 최적의 결과를 찾을 때까지 반복됩니다. 팝업에는 재검증이 완료된 셀렉터만 표시되며, 각 셀렉터에는 복사 버튼이 제공됩니다. 셀렉터가 실제로 어떤 요소와 일치하는지에 대한 최종 기준은 항상 브라우저 자체입니다. AI는 셀렉터를 제안하고 순위를 매길 뿐, 정확성에 대한 최종 결정권을 갖지 않습니다.

신뢰 경계 확장 프로그램은 루프의 연속성을 보장하기 위해 '셀렉터 생성 세션 상태'를 유지합니다. 브라우저가 진실의 원천(Source of truth)입니다. 즉, 모든 결과에 대해 재검증이 필수적입니다. AI는 셀렉터를 제안하고 순위를 매기지만, 정확성을 증명하지는 않습니다. 리스트(목록)의 경우, 검증 과정에서 의도한 전체 세트를 확인하므로 너무 많이 매칭되거나(Over-matching) 너무 적게 매칭되는(Under-matching) 셀렉터는 모두 거부됩니다. 자세한 모듈 구조, 메시징 계층, 백그라운드/콘텐츠/팝업 컨텍스트, 인증 및 CLI 연결부에 대해서는 ARCHITECTURE.md를 참조하세요.

선택 모드 싱글(Single): 버튼, 입력창, 링크, 라벨 등 하나의 특정 요소를 선택합니다. 정확한 해당 요소에 대해 검증된 셀렉터 후보를 얻게 됩니다. 리스트(List): 반복되는 집단에서 두 가지 예시를 선택합니다. 전체 집합에 대한 검증된 컨테이너 셀렉터를 얻게 되며, 저장하기 전에 미리 볼 수 있습니다.

개발자 빠른 시작 Node 18+ 및 Yarn이 필요합니다. yarn install # wxt prepare도 함께 실행됩니다. yarn dev # 변경 사항을 감지하여 빌드하며, Chrome에서 .output/chrome-mv3를 압축 해제된 확장 프로그램으로 로드할 수 있습니다. yarn dev:firefox # Firefox에서도 동일하게 작동합니다. 첫 번째 yarn dev 실행 후, chrome://extensions (개발자 모드 활성화 필요)에서 .output/chrome-mv3 경로의 압축 해제된 확장 프로그램을 로드하세요.

명령어 yarn dev / yarn dev:firefox: 빌드를 감시(watch)하며, 압축 해제된 확장 프로그램으로 로드 가능합니다. yarn compile: tsc --noEmit 타입 체크를 수행합니다. yarn test: Vitest를 이용해 단위 테스트 및 실제 Chromium 브라우저 프로젝트 테스트를 진행합니다. yarn build / yarn build:firefox: 배포용 확장 프로그램 번들을 생성합니다. yarn build:e2e: 호스트 권한을 가진 E2E 테스트용 변형을 빌드합니다 (이것을 배포하지 마세요). yarn e2e: build:e2e 실행 후, 패키징된 확장 프로그램 대상으로 Playwright를 실행합니다. yarn zip / yarn zip:firefox: 스토어 등록이 가능한 zip 파일을 생성합니다. yarn icons: 아이콘 에셋을 다시 생성합니다. yarn ladle: http://localhost:61010 에서 팝업 컴포넌트를 개별적으로 분리해 미리 봅니다.

컴포넌트 미리보기 (Ladle) yarn ladle은 디자인 및 리뷰를 위해 팝업의 React 컴포넌트를 격리된 상태로 제공합니다. 확장 프로그램을 다시 로드할 필요가 없고 실제 백엔드도 필요 없습니다. 스토리 파일은 stories/ (*.stories.tsx)에 있으며, Ladle 설정은 .ladle/에 있습니다. 팝업은 WXT가 주입한 browser 전역 객체를 필요로 하므로, .ladle/wxt-globals.ts가 이를 위한 빈 스텁(no-op stub)을 설치합니다. yarn ladle:build는 dist/ladle 아래에 정적 번들을 생성합니다.

테스트 레이어 단위 테스트(Unit): 셀렉터 로직, 상태 변환, 스토리지 및 결정론적 폴백(deterministic fallbacks)을 위해 빠른 Vitest 테스트(node/happy-dom)를 수행합니다. 브라우저 테스트(Browser): 실제 DOM에 대해 셀렉터 생성을 실행하는 Vitest 브라우저 모드 테스트로, 각 후보가 정확히 예상된 요소 세트로 해결되는지 증명합니다. 이것이 정확도의 기준(Oracle)이 됩니다. 두 레이어 모두 yarn test로 실행됩니다. E2E 테스트: 실제 페이지, 포인터 흐름, 팝업, 콘텐츠 스크립트 및 백그라운드 워커가 포함된 패키징된 MV3 확장 프로그램을 대상으로 Playwright를 실행합니다. yarn e2e로 실행하세요.

프로젝트 구조 entrypoints/ background.ts 백그라운드 셋업

원문 보기
원문 보기 (영어)
Selector Forge Pick an element on any page, get back a reliable selector — generated and judged by AI, then re-verified against the live DOM before you ever see it. Selector Forge is a standalone browser extension (Chrome & Firefox, MV3) that helps you build robust CSS or XPath selectors directly from the pages you're looking at. You point at what you want; the extension and Intuned 's selector backend do the rest — proposing candidates, testing them against the real page, and discarding anything that doesn't resolve correctly. It's useful for writing end-to-end tests, building scrapers, and automating any page where a brittle selector would cost you later. Install Chrome — Chrome Web Store Firefox — Firefox Add-ons How it works Open any page and click the extension. Choose a selection mode and pick element(s) directly on the live page. The extension captures a compact snapshot of your picks (selected targets, DOM context, seed candidates) and sends it to the backend. The backend proposes and ranks candidate selectors; the extension tests every candidate against the live DOM and feeds the results back. This loop repeats until the backend settles on a winner. The popup shows only re-verified selectors, each with a copy button. The browser is always the source of truth for what a selector actually matches. The AI proposes and ranks; it never gets the final word on correctness. The trust boundary The extension holds the selector-creation session state — the source of continuity for the loop. The browser is the source of truth — re-verification is mandatory for every result. The AI proposes and ranks selectors; it does not prove correctness. For lists, verification checks the full intended set, so over-matching and under-matching selectors are rejected. See ARCHITECTURE.md for the module map, the messaging layer, the background/content/popup contexts, and the auth + CLI seams. Selection modes Mode You do You get Single Pick one element Verified selector candidates for that exact element — buttons, inputs, links, labels, one-off targets. List Pick two examples from a repeating set A verified container selector for the full set, previewed before you save it. Dev quickstart Requires Node 18+ and Yarn. yarn install # also runs `wxt prepare` yarn dev # watch + load .output/chrome-mv3 in Chrome (unpacked) yarn dev:firefox # same for Firefox After the first yarn dev , load the unpacked extension from .output/chrome-mv3 at chrome://extensions (enable Developer mode). Commands Command What it does yarn dev / yarn dev:firefox Watch build, loadable as an unpacked extension yarn compile tsc --noEmit typecheck yarn test Vitest — unit + real-Chromium browser projects yarn build / yarn build:firefox Production extension bundle yarn build:e2e E2E variant with <all_urls> host permission — never ship this yarn e2e build:e2e then Playwright against the packaged extension yarn zip / yarn zip:firefox Store-ready zip yarn icons Regenerate icon assets yarn ladle Preview popup components in isolation at http://localhost:61010 Component previews (Ladle) yarn ladle serves the popup's React components in isolation for design and review — no extension reload, no real backend. Stories live in stories/ ( *.stories.tsx ); Ladle config is in .ladle/ . The popup expects WXT's injected browser global, so .ladle/wxt-globals.ts installs a no-op stub for it. yarn ladle:build produces a static bundle under dist/ladle . Testing layers Unit — fast Vitest tests (node/happy-dom) for selector logic, state transforms, storage, and deterministic fallbacks. Browser — Vitest browser-mode tests that run selector generation against a real DOM and prove each candidate resolves to exactly the expected element set. This is the correctness oracle. Both layers run under yarn test . E2E — Playwright against the packaged MV3 extension with a real page, pointer flow, popup, content script, and background worker. Run with yarn e2e . Project layout entrypoints/ background.ts background service worker — session state, agent loop, network I/O content.ts content script — picker overlay, DOM access, selector testing popup/ React popup — mode controls, results, copy actions lib/ agent/ agent loop controller (backend turn-taking) content/ picker overlay, element registry, DOM inspection background/ handlers, context menu, session wiring, CLI bridge messaging/ typed, direction-partitioned runtime-message protocol state/ session state, history, schema, preferences auth/ auth client + token handling graphql/ workspace + usage queries config.ts API base + runtime config tests/ vitest (unit + browser) e2e/ playwright against the built extension ARCHITECTURE.md module map, trust boundary, agent loop, seams Built on WXT with React for the popup. Roadmap CLI control — drive the extension from the Intuned CLI: Intuned IDE support, local agents running end-to-end tests and automations, and exposure through MCP. (Foundational wiring — the tabs permission and CDP-driven session start — is already in place.) Smart picker — a multiple mode that lets you select many elements in one flow and have the extension group them into single items and list-like sets, plus AI field detection that suggests useful fields, names, and selectors for a page automatically. Drill-down modes — precision refinement after a pick: walk the XPath/DOM tree to the element you actually meant (child span → button → row → label → parent container), move a list selection to a parent or child level, and add required examples or exclude wrong ones. Bring your own backend — today the extension talks to Intuned for authentication and selector generation. We plan to ship a small, self-hostable reference backend that drops into that seam and replaces Intuned entirely — including an open-source agent that generates and judges reliable selectors — so you can run the whole loop on your own infrastructure. Further out: selector/automation history, export to Playwright or plain JavaScript, automatic pagination detection, and cross-iframe / shadow-DOM support. Contributing Issues and pull requests are welcome. Please run yarn compile and yarn test before opening a PR. License MIT © The Metrics Shop, Inc.