Skip to main content

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:

  1. Update the version in pyproject.toml
  2. Create and push a new tag:
git tag 0.1.0
git push origin 0.1.0

This will trigger the CI pipeline to build and publish the package to PyPI automatically.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unbrowsed-0.1.0a6.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unbrowsed-0.1.0a6-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file unbrowsed-0.1.0a6.tar.gz.

File metadata

  • Download URL: unbrowsed-0.1.0a6.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for unbrowsed-0.1.0a6.tar.gz
Algorithm Hash digest
SHA256 39ddf5b48c86a54be850fcb79e2b2c0f33933b9908c6989cc86040cea644ecd8
MD5 6f3e81b31cad02b463fa64a8bc41613e
BLAKE2b-256 041e3b439cd0d3960436fb9a8abfa401cb8b47533fcdce821c203ab27faa67aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for unbrowsed-0.1.0a6.tar.gz:

Publisher: test.yml on valentinogagliardi/unbrowsed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unbrowsed-0.1.0a6-py3-none-any.whl.

File metadata

  • Download URL: unbrowsed-0.1.0a6-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for unbrowsed-0.1.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 67bff6cba5486c064279586df90343cd9f0f51dc7ec3c8467451cbab91ec0955
MD5 2c1b5992716807900744ee3e09a4e044
BLAKE2b-256 be53c0a0567655f995b054fd48966e705a01b21d0f19b0aefd6a867f62515067

See more details on using hashes here.

Provenance

The following attestation bundles were made for unbrowsed-0.1.0a6-py3-none-any.whl:

Publisher: test.yml on valentinogagliardi/unbrowsed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page