Skip to content

Repository files navigation

miniclient

CI codecov Docs PyPI Python versions License

A minimal python http client that runs JavaScript, without a browser. Meant to be used as a lightweight test client to simulate browser interactions. Embeds a V8 Runtime, DOM, and is designed to run htmx especially well.

Install

uv add miniclient

Example

The snippet below opens a page, submits a search form, clicks a "load more" button and reads the results back. All against a real in-memory DOM running JavaScript (htmx, for example). No browser involved.

from miniclient.page import Page

with Page() as page:
    page.goto("http://localhost:8000/")
    page.find("input[name=q]").fill("htmx")
    page.find("form").requestSubmit()
    page.find("#load-more").click()
    print(len(page.find_all("#results li")), "results")
    print(page.find("#results li:first-child").text)

Check the full documentation: https://marciomazza.github.io/miniclient/

About

A minimal python http client that runs JavaScript, without a browser.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages