Show HN: Selector Forge – browser extension for AI-generated resilient selectors

github.com

34 points by ahmadilaiwi 1 day ago

Hi HN, I'm Ahmad from the Intuned (https://intunedhq.com) team. Today, we're releasing and open-sourcing Selector Forge (https://selectorforge.ai/), a browser extension that generates reliable CSS/XPath selectors using AI.

You can use it to create a selector for a single element or for an array of elements. The selectors it creates are meant to be "semantic" and more resilient to page changes than what Chrome DevTool’s “Copy Selector” (and other similar extensions) give you. Those tend to hand you something brittle like `#top > div.w-100.ph0-l.ph3.ph4-m > h1 > span`, which can break with a minimal page change. Selector Forge aims for selectors that don't break as easily. Here are some selectors that Selector Forge created: `//div[@aria-label="Showing weekly downloads"]//p[@aria-live="polite"]` (item selector) and `//*[local-name()='svg' and @aria-label="Download statistics"]/following-sibling::div` (list selector).

Here is a video demo of using the extension: https://www.youtube.com/watch?v=8IjjeDQkKmo

Selector Forge on Chrome: https://chromewebstore.google.com/detail/lbendfnlmhdakbeblaj...

Selector Forge on Firefox: https://addons.mozilla.org/en-US/firefox/addon/selector-forg...

Selector Forge code: https://github.com/Intuned/selector-forge

Backstory: For the past couple of years we've been building Intuned Agent, a coding agent for building and maintaining browser automations. We quickly figured out that the most fragile part of any browser code is usually the selectors and that creating good selectors can go a long way towards improving the quality and reliability of the automation itself.

So we abstracted selector creation into its own agent, wrapped it as a tool, and let our codegen agent call it. LLMs by default don't do a great job generating good selectors, so this turned out to be really useful and improved the code our agent generates.

We recently thought that this piece (the selector agent/creation) is useful on its own (outside our platform) so we packaged it as a browser extension. That’s this post!

Selector Forge is open source, and the version in the browser stores (Chrome and Firefox) is free for up to 200 selectors/month. Unlimited usage is part of our paid plans.

We realize most developers aren't writing this kind of code by hand anymore, so the next step is exposing this functionality in a way coding agents can call directly, over a CLI or MCP. Here's our roadmap: https://github.com/Intuned/selector-forge#roadmap

Excited to hear your thoughts, questions, and feedback!

sarupbanskota 15 hours ago

Why do you think LLMs don't do a good job at generating good selectors by default?

  • ahmadilaiwi 3 hours ago

    So LLMs are not bad at generating selectors but they always need a loop to test it in + rules to produce the best selectors. When you have an llm write a playwright script for example to scrape a product page on an e-commerce, while the agent is building the script, it will check the DOM and based on that, it will generate selectors that it put inside the "page.locator" calls. In theory the selectors look great but in practice, the agent will not first shot a working selector.. This can be for few reasons like: llms can't see the whole DOM (usually html DOMs are massive), another reason would be that the llm is not running a selector matching algorithm in it's head, very similar to you giving an llm complex math problem without giving it a calculator tool or a coding tool. To fix the selector problem, few things will happen, it will start adding more and more html attributes to match the target element and it will start filling the context with useless error messages that it only needed to fix the broken selectors.