Skip to main content

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

Project description

WebTestpilot

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

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

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("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.

    # 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=""
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webtestpilot-0.1.0.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webtestpilot-0.1.0-py3-none-any.whl (47.3 kB view details)

Uploaded Python 3

File details

Details for the file webtestpilot-0.1.0.tar.gz.

File metadata

  • Download URL: webtestpilot-0.1.0.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.8

File hashes

Hashes for webtestpilot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 37b27035c19d91829694273a8027bd1972fc866fe351dc9ff556f11f9e880973
MD5 e4c6ba7665d4372697265b1f6bfc0338
BLAKE2b-256 62f40c0029301eda8d1d850d94f464c953cc501f45e14dbbbdae01a24bf10e93

See more details on using hashes here.

File details

Details for the file webtestpilot-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for webtestpilot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c70a7402b9fd3bc1550c26d3a065d833188c1b33dee8ff9fbc340720477300f5
MD5 b396d0ded4ccc40598779804ff9b44c1
BLAKE2b-256 6092e2c68450375a004eb95bfaa61a40309ddc790694348e248025a5520cbe83

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page