A browserless HTML testing library for Python
Project description
Unbrowsed
A browserless HTML testing library for Python, inspired by testing-library.
Overview
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.
Features
- Fast HTML parsing using selectolax
- Browser-free testing of HTML content
- Query functions that encourage accessible testing practices
- Simple, Pythonic API
Installation
pip install unbrowsed
Usage
Basic Example
from 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
Development
Setup
# 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]"
Running Tests
pytest
Releasing a New Version
To release a new version:
- Update the version in
pyproject.toml - Create and push a new tag:
git tag v0.1.0 # Use appropriate version
git push origin v0.1.0
This will trigger the CI pipeline to build and publish the package to PyPI automatically.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unbrowsed-0.1.0a3.tar.gz.
File metadata
- Download URL: unbrowsed-0.1.0a3.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74bdbdfc189d827eb8c03ca21a3e37871105f2fd18370f70fd1a9e36e200ad9e
|
|
| MD5 |
af84a98c270f2c7d112466df41ba45f3
|
|
| BLAKE2b-256 |
8422fa39dc07cf623880b477af0c029ad92a56fea50ffd9053329caa2595b827
|
Provenance
The following attestation bundles were made for unbrowsed-0.1.0a3.tar.gz:
Publisher:
test.yml on valentinogagliardi/unbrowsed
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unbrowsed-0.1.0a3.tar.gz -
Subject digest:
74bdbdfc189d827eb8c03ca21a3e37871105f2fd18370f70fd1a9e36e200ad9e - Sigstore transparency entry: 177632405
- Sigstore integration time:
-
Permalink:
valentinogagliardi/unbrowsed@3bc70b25c4d3e43e0031fc572c7b75705f18c5d2 -
Branch / Tag:
refs/tags/0.1.0a3 - Owner: https://github.com/valentinogagliardi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test.yml@3bc70b25c4d3e43e0031fc572c7b75705f18c5d2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file unbrowsed-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: unbrowsed-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abf134e2d2fc55e0698a5d2f2d9fcb4cc883e4ce336434acc0bc064f9e1e7ad8
|
|
| MD5 |
12dbc3060cc4af0e04cd5375dea7df04
|
|
| BLAKE2b-256 |
ac0a003a907d3b9de24f50be9e8ab3525483c9580bd96b2d5f53c31371b9be8b
|
Provenance
The following attestation bundles were made for unbrowsed-0.1.0a3-py3-none-any.whl:
Publisher:
test.yml on valentinogagliardi/unbrowsed
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unbrowsed-0.1.0a3-py3-none-any.whl -
Subject digest:
abf134e2d2fc55e0698a5d2f2d9fcb4cc883e4ce336434acc0bc064f9e1e7ad8 - Sigstore transparency entry: 177632411
- Sigstore integration time:
-
Permalink:
valentinogagliardi/unbrowsed@3bc70b25c4d3e43e0031fc572c7b75705f18c5d2 -
Branch / Tag:
refs/tags/0.1.0a3 - Owner: https://github.com/valentinogagliardi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test.yml@3bc70b25c4d3e43e0031fc572c7b75705f18c5d2 -
Trigger Event:
push
-
Statement type: