Selector Forge is a browser extension designed to generate reliable CSS and XPath selectors using artificial intelligence. It is intended for developers and automation engineers who frequently work with web scraping, browser automation, or testing, aiming to simplify the process of creating robust selectors.
The primary problem Selector Forge addresses is the fragility of traditional CSS and XPath selectors. Standard methods often produce selectors that are brittle and break easily when website structures or class names are updated, leading to failed automations and time-consuming debugging. This instability is a significant pain point in web development and automation workflows.
One of the key features of Selector Forge is its AI-driven selector generation. The extension leverages AI to analyze web page elements and create selectors that are not only functional but also "semantic." This means the selectors are designed to be more resilient to changes in the page's layout or class names, unlike brittle selectors that rely heavily on specific DOM structures or transient class names.
Selector Forge can generate selectors for both single elements and arrays of elements. This capability is crucial for scenarios where multiple similar elements need to be targeted, such as extracting data from a list or table. By handling arrays, the extension streamlines the process of selecting multiple items efficiently.
The extension prioritizes stability signals when generating selectors. It considers attributes like `aria-label`, `data-testid`, and stable text content before resorting to class names. This approach ensures that the generated selectors are more likely to remain valid even after minor website updates, reducing the occurrence of unexpected failures in automated processes.
Selector Forge offers a way to recheck generated selectors after a redesign. Users can verify the validity of their selectors by rechecking them, which helps in identifying and rectifying any issues that may arise from page modifications. This feature aids in maintaining the reliability of automation scripts over time.
The product works by analyzing the DOM and using AI to construct selectors that are designed to withstand common website changes. It aims to provide selectors that are more durable than those generated by standard browser developer tools, which often produce fragile selectors like `#top > div.w-100.ph0-l.ph3.ph4-m > h1 > span`.
The primary benefit for users is the creation of more reliable and stable web automation scripts. By using resilient selectors, developers can reduce the time spent on debugging and maintenance, leading to more efficient and effective web scraping and testing processes. The semantic nature of the selectors also contributes to cleaner and more understandable automation code.
Concrete use cases for Selector Forge include building robust web scrapers that can handle dynamic websites, creating automated testing suites for web applications that are less prone to breaking due to UI changes, and developing browser automation tools that require stable element identification. It is particularly useful when dealing with websites that are frequently updated or have complex, nested DOM structures.
Selector Forge is available as a browser extension for Chrome and Firefox. It is open-source, with its code available on GitHub. The extension offers a free tier for up to 200 selectors per month, with unlimited usage available on paid plans. The team is also planning to enable coding agents to call it directly over a CLI or MCP in the future.
In summary, Selector Forge provides an AI-powered solution for generating resilient and semantic CSS and XPath selectors, significantly improving the stability and maintainability of web automation and scraping tasks.