Skip to content

Selenia lets you locate web elements using natural language queries, powered by LLMs (Large Language Models). It integrates with Selenium and supports local LLMs via Ollama.

Notifications You must be signed in to change notification settings

penielny/selenia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selenia

Selenium wrapper to find XPath from natural language using LLMs


🚀 Overview

Selenia lets you locate web elements using natural language queries, powered by LLMs (Large Language Models). It integrates with Selenium and supports local LLMs via Ollama.

✨ Features

  • 🔍 Find elements by describing them in plain English
  • 🤖 Pluggable LLM model clients (Ollama, OpenAI, etc.)
  • 🧪 Easy integration with Selenium WebDriver
  • 🧩 Extensible for custom model backends

📦 Installation

pip install selenia

Or from source:

pip install .

🛠️ Usage Example

from selenium import webdriver
from selenia import Selenia, OllamaServerClient, OllamaClient

#for either remote or local ollama server
driver = webdriver.Chrome()
model_client = OllamaServerClient(model_name="llama3",base_url="http://localhost:11434/api/generate")

#for local ollama 
model_client = OllamaClient(model_name="llama3")

selenia = Selenia(driver, model_client)

# Find an element by description
element = selenia.find("the search input box at the top bar")

# Find all matching elements
elements = selenia.find_all("all buttons with the text 'Submit'")

🧩 Model Clients

  • OllamaServerClient: Connects to a local Ollama server (defaults: [model_name:llama3,base_url=http://localhost:11434/api/generate])
  • OllamaClient: Uses the Ollama Python package

🧪 Running Tests

pytest tests/

📄 License

MIT


Made with ❤️ by Penielny

About

Selenia lets you locate web elements using natural language queries, powered by LLMs (Large Language Models). It integrates with Selenium and supports local LLMs via Ollama.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages