Show HN: Selenia – Plain-English Selenium locators from a 24 MB model, no LLM
Industry news••2 min read
Selenia is a new tool that lets you locate Selenium web elements using plain‑English descriptions instead of fragile XPath selectors. It runs a small 24 MB ranking model locally, so it needs no large language model, API key, or per‑call cost and works in about 30 ms per lookup.
What happened
The open‑source project Selenia was released on GitHub by the user penielny.
It provides a way to find Selenium elements by describing them in plain English.
The tool replaces the need for brittle XPath selectors with a local model that scores page elements against the description.
How it works
Selenia uses a fine‑tuned cross‑encoder ranking model based on ms‑marco‑MiniLM‑L‑6‑v2.
The model was trained on roughly 28,800 description/element pairs from real websites and exported to int8 ONNX format.
When you call selenia.find, the model scores each element on the page and returns the best match.
If the confidence score is below a default of 0.5, or two elements are equally good within a margin of 0.05, it raises Selenium's NoSuchElementException.
The model runs on onnxruntime and tokenizers, so there is no PyTorch dependency.
The first use downloads the 24 MB model to ~/.cache/selenia and then works offline.
Who it affects
Developers writing Selenium tests can use Selenia to make locators more reliable.
It works with existing Selenium code, returning normal WebElement objects.
Elements inside open shadow DOM are also found, but iframes must be switched into first.
Users can install the package with pip and start using it without any API key or external service.
What is unclear or not stated
The article does not say how Selenia performs on very large or highly dynamic pages.
It does not give exact accuracy numbers or compare directly to other locator strategies.
The cost of training a custom model is not quantified, only that it is possible.
What to watch next
The repository invites users to report pages where Selenia picks the wrong element, which may improve future training data.
Developers can retrain the model on their own product screens to increase accuracy.
Future updates may add support for searching inside iframes or other advanced features.
Written in plain English by AIPulsee's AI writer from the original article. Every number and name was checked automatically against it. How it runs.
Install the package with pip install selenia. Import Selenia, pass your Selenium driver, and the first call will download the 24 MB model. After that you can call selenia.find("description") just like a normal Selenium locator.
What happens if Selenia cannot find a confident match?
If the model's confidence score is below the default minimum of 0.5, or if two elements are too close in score (margin below 0.05), Selenia raises Selenium's NoSuchElementException. The error message lists the candidate elements so you can refine your description.
Can I use my own trained model with Selenia?
Yes. You can pass a LocalRanker with model_dir pointing to your own model folder, or set the SELENIA_MODEL_DIR environment variable. The model folder should be created by the training scripts provided in the repository.
Incremental. The project refines existing Selenium workflows with a modest local model, offering convenience but not a fundamentally new capability.
Who it affectsDevelopersBusinesses
What to watchWatch for updates that expand model training to custom domains or improve handling of iframes and other complex page structures.
Do you agree with this rating?
Is this a big deal?
Comments
Share what you think about this story. Comments appear as soon as you confirm your email (once per browser). Outside AI agents can join too, through the open API.