zope.testbrowser
Programmable browser for functional black-box tests
What it is and what it does
zope.testbrowser is a headless browser library designed for automated testing of web applications. It wraps WebTest and BeautifulSoup4 to provide a high-level API for navigating pages, filling forms, clicking links, and inspecting responses—all without a graphical browser. It's commonly used in functional black-box tests for WSGI applications, though it can work with any HTTP-based site.
The package handles cookies, redirects, form submission (GET and POST), file uploads, and control selection by name or label. It maintains browser state across requests and provides introspection of page content. Since version 5.0, it has used WebTest internally rather than mechanize, and requires explicit WSGI app setup rather than relying on Zope's testing infrastructure.
Use it for:
- Test form submission and validation in a WSGI application without running a browser
- Automate functional tests that verify user workflows across multiple pages
- Inspect and manipulate form controls programmatically in test suites
- Verify HTTP redirects, cookies, and response headers in integration tests
- Validate HTML link targets and form structure in automated test scenarios
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
zope.testbrowser provides a programmable web browser for automated testing of web applications and sites, with support for form interaction, cookie handling, and HTTP methods.
Yes, if you are testing a WSGI application or have a clear need for headless form automation in a test suite. The package is actively maintained, has no known vulnerabilities, and integrates well with standard testing frameworks. The main condition is that you must provide or wrap your application as WSGI; it is not a general-purpose web scraper. License clarity should be confirmed for your use case.
Install
zope-testbrowser on PyPI
pip
pip install zope-testbrowseruv
uv add zope-testbrowserpoetry
poetry add zope-testbrowserInstalling zope.testbrowser
Before you install
Low friction install with a pure Python wheel. Actively maintained as of 2025-09-12 with recent Python version support (3.9–3.14). Ten runtime dependencies are all established packages; no compiled dependencies.
License in practice
Licensed under ZPL-2.1 (Zope Public License). License treatment is marked unclear in the fact sheet; review the full license terms before use in proprietary or copyleft-sensitive projects.
Quickstart
pip install zope.testbrowser
from zope.testbrowser.wsgi import Browser
browser = Browser(wsgi_app=my_app)
browser.open('http://example.com')
control = browser.getControl(name='field_name')
control.value = 'test_value'
Requires a WSGI application instance; cannot test arbitrary websites without wrapping them in WSGI. Minimum Python 3.9.
Verify before relying
- Whether ZPL-2.1 is compatible with your project's license or distribution model
- Performance characteristics when testing large forms or high-volume interactions
- Compatibility with modern JavaScript-heavy sites (package focuses on HTML/form testing)
Package facts
| License | ZPL-2.1 (unclear) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 10 — setuptools, zope.interface, zope.schema, zope.cachedescriptors, pytz, WebTest, BeautifulSoup4, SoupSieve, WSGIProxy2, legacy-cgi |
| Maintenance | actively maintained — 336 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 129,437/month — #11,671 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: zope_testbrowser-8.0-py3-none-any.whl
Keywords: headless, browser, functional, tests, WSGI, HTTP, HTML, form
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
zope.browserpageProvides ZCML directives (browser:page,…
unclear · top 15,000 on PyPI
ZopeZope is an open-source web application server…
unclear · top 15,000 on PyPI
zope.globalrequestProvides a function to retrieve the currently…
unclear · top 15,000 on PyPI
django-webtestIntegrates WebTest with Django's testing…
permissive · top 15,000 on PyPI
zope.testrunnerA test runner for Python projects with support…
unclear · top 15,000 on PyPI
zope.publisherzope.publisher handles HTTP request and…
unclear · top 15,000 on PyPI
zope.browserProvides a set of standard interfaces for…
unclear · top 15,000 on PyPI
mechanizeAutomate programmatic interaction with HTTP web…
permissive · top 15,000 on PyPI
zope.testingProvides testing utilities and frameworks for…
unclear · top 15,000 on PyPI
zope.proxyzope.proxy provides transparent wrapper objects…
unclear · top 15,000 on PyPI