A browserless HTML testing library for Python, inspired by testing-library.
unbrowsed allows you to test HTML without spawning a browser. It provides a simple, intuitive API for querying HTML elements similar to testing-library's approach, encouraging accessible and maintainable tests.
- Fast HTML parsing with selectolax
 - Query functions that encourage accessible testing practices
 
pip install unbrowsedfrom unbrowsed import parse_html, query_by_label_text
# Parse HTML content
html = """
<form>
    <label for="username">Username</label>
    <input id="username" type="text">
    <label for="password">Password</label>
    <input id="password" type="password">
    <button type="submit">Login</button>
</form>
"""
dom = parse_html(html)
# Query elements by label text
username_input = query_by_label_text(dom, "Username")
assert username_input is not None# Clone the repository
git clone https://github.com/username/unbrowsed.git
cd unbrowsed
# Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[test]"pytestTo release a new version:
- Update the version in 
pyproject.toml - Create and push a new tag:
 
git tag 0.1.0
git push origin 0.1.0This will trigger the CI pipeline to build and publish the package to PyPI automatically.
MIT