Skip to main content

WebTestpilot

WebTestPilot is an LLM-driven automated web testing framework for end-to-end browser testing.

This directory contains the core source code of WebTestPilot for development and maintenance.

  • pytest-webtestpilot: A pytest plugin that integrates WebTestPilot with pytest。

Installation

If you want to use WebTestPilot in your own projects, install it from PyPI:

pip install webtestpilot

WebTestPilot also provides an official pytest plugin for running test cases via pytest.

pip install pytest-webtestpilot

Below is a minimal working example demonstrating how to use WebTestPilot directly on top of Playwright.

from pathlib import Path
from playwright.sync_api import sync_playwright
from webtestpilot import WebTestPilot, Config, Session, Step

# WebTestPilot is built on top of Playwright
with sync_playwright() as p:
    # Users can:
    # 1. Connect to an existing managed or remote browser
    # 2. Enable tracing, video, or screenshots at the browser context level
    # 3. Reuse an authenticated browser session
    # ...
    browser = p.chromium.launch()
    context = browser.new_context()
    page = context.new_page()

    page.goto("https://example.com")

    # Load WebTestPilot configuration
    config = Config.load(Path("./src/config.yaml"))

    # Create a test session bound to the Playwright page
    session = Session(page=page, config=config)

    # Define test steps in natural language
    steps = [
        Step(
            action="Click the login button",
            expectation="The dashboard page is displayed",
        ),
        Step(
            action="Click the profile icon",
            expectation="The user profile menu appears",
        ),
    ]

    # Run the test steps
    WebTestPilot.run(
        session=session,
        steps=steps,
        assertion=False,  # enable to verify expectations
    )

Development

This section is only required if you are developing or modifying WebTestPilot itself.

Prerequisites

Before starting, make sure you have:

Setup

  1. Clone the repository.

  2. Set Up the Python Environment.

    cd ./webtestpilot
    # Installs all dependencies
    uv sync
    # Prepares code used for model interaction and reasoning.
    uv run baml-cli generate --from ./webtestpilot/baml_src
    
  3. Configure Environment Variables.

    We use a .env file to store configuration values and secrets (such as API keys).

    Create your own copy:

    cp .env.example .env
    

    Then open .env and edit the following fields:

    # URL of the GUI grounding model (OpenAI-compatible API)
    GUI_GROUNDING_MODEL_BASE_URL="http://localhost:8000/v1"
    
    # Name of the GUI grounding model (HuggingFace format)
    GUI_GROUNDING_MODEL_NAME="inclusionAI/UI-Venus-Ground-7B"
    
    # URL for OpenAI-compatible LLM API
    OPENAI_BASE_URL="https://api.key77qiqi.com/v1"
    
    # Your API key (ask from the course staff)
    OPENAI_API_KEY=""
    

Metadata

Release files for webtestpilot 0.1.12

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

Source distribution (sdist)

Source distribution for webtestpilot 0.1.12
File Size Uploaded
webtestpilot-0.1.12.tar.gz 51.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for webtestpilot 0.1.12
File Interpreter ABI Platform
webtestpilot-0.1.12-py3-none-any.whl Python 3 none any Details

Total release size: 113.1 kB

Release files / webtestpilot-0.1.12.tar.gz

Download URL webtestpilot-0.1.12.tar.gz
Size 51.2 kB
Tags Source
SHA-256 checksum
How to use checksums
607fa86d4c1ce6edfb124d6d1deb336852618e7fc32f68d0980f2199fc497ea9
BLAKE2b-256 checksum
How to use checksums
174c9ee0e43724df755054a365b05b20efb76204f8e8d6b711ff9df5947e401e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.8

Release files / webtestpilot-0.1.12-py3-none-any.whl

Download URL webtestpilot-0.1.12-py3-none-any.whl
Size 61.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16aaf8401f04a83a8643fff7309f16038363c467a29a0addbb977106c2ddb7ea
BLAKE2b-256 checksum
How to use checksums
7c08158d8d3506e978db24c4706a42d84ac7551f56b038f946f609a72b100437
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.8

Release history Release notifications | RSS feed

This release

0.1.12 This release

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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