Skip to main content

py-web-automation

A comprehensive Python framework for automated testing of web applications, providing clients for API testing (REST, GraphQL, gRPC, SOAP), WebSocket communication, UI testing, and database operations.

Features

  • Multiple API Protocols: REST, GraphQL, gRPC, SOAP, and WebSocket support
  • Browser Automation: Playwright-based UI testing
  • Database Testing: Support for PostgreSQL, MySQL, and SQLite with adapter pattern
  • Type Safety: Complete type annotations with 100% coverage
  • Async-First: Built on async/await for high performance
  • Request Builder: Fluent API for constructing complex HTTP requests
  • Response Validation: Fast schema validation using msgspec
  • Error Handling: Structured exception hierarchy
  • Configuration Management: Flexible configuration with environment variables and YAML support

Installation

# Using uv (recommended)
uv add py-web-automation

# Or using pip
pip install py-web-automation

Quick Start

API Testing

import asyncio
from py_web_automation import ApiClient, Config

async def main():
    config = Config(timeout=30)
    async with ApiClient("https://api.example.com", config) as api:
        result = await api.make_request("/users/1", method="GET")
        print(f"Status: {result.status_code}, Success: {result.success}")

asyncio.run(main())

UI Testing

import asyncio
from py_web_automation import UiClient, Config

async def main():
    config = Config(timeout=30)
    async with UiClient("https://example.com", config) as ui:
        await ui.setup_browser()
        await ui.page.goto("https://example.com")
        await ui.click_element("#button")
        await ui.take_screenshot("result.png")

asyncio.run(main())

Database Testing

import asyncio
from py_web_automation import DBClient, Config

async def main():
    config = Config()
    db = await DBClient.create(
        "https://example.com",
        config,
        db_type="postgresql",
        connection_string="postgresql://user:pass@localhost/db"
    )
    async with db:
        results = await db.execute_query("SELECT * FROM users WHERE id = :id", {"id": 1})
        print(results)

asyncio.run(main())

Available Clients

  • ApiClient: HTTP REST API testing
  • GraphQLClient: GraphQL API testing
  • GrpcClient: gRPC API testing
  • SoapClient: SOAP API testing
  • WebSocketClient: WebSocket communication
  • UiClient: Browser automation with Playwright
  • DBClient: Database operations with multiple backend support

Documentation

Requirements

  • Python >= 3.13
  • See pyproject.toml for dependencies

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Changelog

See CHANGELOG.md for a list of changes and version history.

Release files for py-web-automation 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-web-automation 1.0.0
File Size Uploaded
py_web_automation-1.0.0.tar.gz 32.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-web-automation 1.0.0
File Interpreter ABI Platform
py_web_automation-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 66.9 kB

Release files / py_web_automation-1.0.0.tar.gz

Download URL py_web_automation-1.0.0.tar.gz
Size 32.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ec3382ae11f26b387f4718b602718d08123cbd41b8c383a38703608fe4c070ad
BLAKE2b-256 checksum
How to use checksums
6688bb3223df2c6642ea15e2de28ff16571e79b14ab9a25efa630ead48d03b9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release files / py_web_automation-1.0.0-py3-none-any.whl

Download URL py_web_automation-1.0.0-py3-none-any.whl
Size 34.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdefa29a851b74ef3ea1fbb543783567c38fe141c1b3389d6a314f78011e48ad
BLAKE2b-256 checksum
How to use checksums
cce94c77883ca2a94eabd5f2f78fa134f2e98ca94fd8aa16c98cd30261c5d644
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page