skillfed

zope.testbrowser

Programmable browser for functional black-box tests

zope-testbrowser v8.0 129.4K downloads/30d#11,671 on PyPI21
License unclear ZPL-2.1 Active released

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-testbrowser

uv

uv add zope-testbrowser

poetry

poetry add zope-testbrowser

Installing 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

Environment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: Zope Public LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTPTopic :: Software Development :: Testing

Tags

headless browser testingautomated web testingWSGI application testingfunctional web testsform automation testingHTTP client testingprogrammatic browser control
testingwsgiheadless-browser

More WWW/HTTP packages