AI-powered browser automation copilot for testing
Project description
Browser Copilot ๐ฏ
A streamlined browser automation framework that uses AI-powered agents to execute natural language test scenarios.
๐ฏ Getting Started in 3 Minutes
Option 1: Install from PyPI (Recommended)
# 1. Install Browser Copilot from PyPI
pip install browser-copilot-llm
# 2. Run the setup wizard (2 minutes)
browser-copilot --setup-wizard
# 3. Create a test file (test.md)
cat > test.md << 'EOF'
# My First Test
1. Go to https://www.google.com
2. Search for "Browser Copilot AI testing"
3. Click on the first result
4. Take a screenshot
EOF
# 4. Run your test!
browser-copilot test.md
Option 2: Install from Source
# 1. Clone and install
git clone https://github.com/smiao-icims/browser-copilot.git
cd browser-copilot
uv sync
# 2. Run the setup wizard
uv run browser-copilot --setup-wizard
# 3. Create and run your test
uv run browser-copilot test.md
That's it! You've just automated your first browser test. ๐
โจ Features
- ๐ค AI-Powered: Uses LLMs to understand and execute test instructions written in plain English
- ๐ฏ Simple: Write tests in markdown - no coding required
- ๐ Efficient: Single agent architecture with token optimization (20-30% reduction)
- ๐ง Flexible: Supports multiple LLM providers via ModelForge (PyPI)
- ๐ Insightful: Enhanced reports with timing, token usage, and cost analysis
- ๐ Cross-Browser: Supports Chromium, Chrome, Firefox, Safari, Edge, and WebKit
- ๐ Verbose Mode: Step-by-step debugging with dual console/file logging
- ๐ฐ Cost Optimization: Built-in token optimization to reduce API costs
- ๐ Multiple Formats: Export results as JSON, YAML, XML, JUnit, HTML, or Markdown
- ๐๏ธ Customizable: System prompts, browser settings, and optimization levels
- ๐ง Setup Wizard: Interactive configuration with arrow-key navigation
๐ Quick Start - Get Testing in 3 Minutes!
1๏ธโฃ Install Browser Copilot
Option A: Install from PyPI (Recommended)
# Install with pip
pip install browser-copilot-llm
# Or with uv (faster)
uv pip install browser-copilot-llm
Option B: Install from Source
# Clone and install
git clone https://github.com/smiao-icims/browser-copilot.git
cd browser-copilot
curl -LsSf https://astral.sh/uv/install.sh | sh # Install uv if needed
uv sync # Install dependencies
2๏ธโฃ Run Setup Wizard (2 minutes)
# If installed from PyPI:
browser-copilot --setup-wizard
# If installed from source:
uv run browser-copilot --setup-wizard
The wizard will guide you through:
- ๐ค Selecting an LLM provider (GitHub Copilot recommended - no API key!)
- ๐ Authentication setup
- ๐ Browser configuration
- โ Validation with a test prompt
3๏ธโฃ Create Your First Test
Create a file my-test.md with natural language instructions:
# My First Test
1. Navigate to https://www.wikipedia.org
2. Search for "artificial intelligence"
3. Verify the page shows results about AI
4. Take a screenshot
4๏ธโฃ Run Your Test!
# If installed from PyPI:
browser-copilot my-test.md
# If installed from source:
uv run browser-copilot my-test.md
# That's it! ๐ You've just automated your first browser test.
๐ฏ Try Our Example Tests
Note: If you installed from PyPI, first download the examples:
# Download examples curl -O https://raw.githubusercontent.com/smiao-icims/browser-copilot/main/examples/saucedemo-shopping.md curl -O https://raw.githubusercontent.com/smiao-icims/browser-copilot/main/examples/google-ai-search.md
E-commerce Shopping Flow
# Run a complete shopping cart test
browser-copilot saucedemo-shopping.md
# Or from source repository:
uv run browser-copilot examples/saucedemo-shopping.md
This example demonstrates:
- Login with test credentials
- Adding products to cart
- Checkout process with form filling
- Order confirmation
AI-Powered Search
# Test Google's AI search features
browser-copilot google-ai-search.md
# Or from source repository:
uv run browser-copilot examples/google-ai-search.md
This example shows:
- Navigating to Google
- Using AI-powered search
- Verifying AI-generated responses
- Taking screenshots of results
๐ Check out more examples in the examples/ directory!
๐ก Pro Tips for Quick Success
# Save typing with an alias
alias bp="browser-copilot" # For PyPI installation
# or
alias bp="uv run browser-copilot" # For source installation
# Run any test headless
bp your-test.md --headless
# Get beautiful HTML reports
bp your-test.md --output-format html --output-file report.html
# Save money with token optimization
bp your-test.md --compression-level high # 30% less tokens!
# Debug failing tests
bp failing-test.md --verbose --save-trace
๐ See More Examples | ๐ Full Quick Start Guide | ๐ฏ Best Practices
๐ Writing Tests
Tests are written in simple markdown format with numbered steps:
# Login Test
1. Navigate to https://example.com/login
2. Click on the email input field
3. Type "user@example.com"
4. Click on the password field
5. Type "securepassword123"
6. Click the "Login" button
7. Verify that the dashboard page is displayed
8. Take a screenshot of the dashboard
๐ Example Output
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Browser Copilot v2.0 โ
โ Simple โข Reliable โข Token Efficient โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Test Suite: login_test.md
Size: 245 chars
๐ค Provider: github_copilot
Model: gpt-4o
๐ Executing test...
Browser: chromium
Mode: Headed
--------------------------------------------------
Status: โ
PASSED
Duration: 28.3s
Steps: 15
๐ Token Usage:
Total: 12,847
Prompt: 12,214
Completion: 633
Cost: $0.0421
๐ก Token Optimization:
Reduction: 23.5%
Tokens Saved: 3,200
Cost Savings: $0.0096
Strategies: whitespace, phrases, redundancy
๐ Results saved:
- report: report_20250726_173422.md
- results: results_20250726_173422.json
๐ New Features in v2.0
๐ Enhanced Verbose Mode
# Enable detailed step-by-step logging
browser-copilot test.md --verbose
# Logs are saved to ~/.browser_copilot/logs/
# Both console and file output for debugging
๐ฐ Token Optimization
# Control optimization level
browser-copilot test.md --compression-level high # 30% reduction
browser-copilot test.md --compression-level medium # 20% reduction (default)
browser-copilot test.md --compression-level low # 10% reduction
browser-copilot test.md --no-token-optimization # Disable
๐ค Flexible Output Options
# Different output formats
browser-copilot test.md --output-format json
browser-copilot test.md --output-format yaml
browser-copilot test.md --output-format xml
browser-copilot test.md --output-format junit
browser-copilot test.md --output-format html
browser-copilot test.md --output-format markdown
# Output to file instead of console
browser-copilot test.md --output-file results.json
๐๏ธ Custom System Prompts
# Use custom instructions
browser-copilot test.md --system-prompt custom-prompt.txt
# Example prompt file:
cat > prompt.txt << EOF
You are a meticulous QA engineer.
Always take screenshots before and after actions.
Wait 2 seconds after each navigation.
EOF
๐ง Configuration Management
# Save current settings as defaults
browser-copilot test.md --provider openai --model gpt-4 --save-config
# Use custom config file
browser-copilot test.md --config my-config.json
# Environment variables (override config file)
export BROWSER_PILOT_PROVIDER=anthropic
export BROWSER_PILOT_MODEL=claude-3-opus
export BROWSER_PILOT_BROWSER=firefox
๐ง Configuration
Prerequisites
- Python 3.11+ (required by ModelForge)
- Node.js (for Playwright MCP server)
- uv - Fast Python package installer and resolver
- ModelForge configured with at least one LLM provider
Command Line Options
positional arguments:
test_scenario Test scenario file path or '-' for stdin
options:
-h, --help Show help message
--provider PROVIDER LLM provider (uses ModelForge discovery if not specified)
--model MODEL Model name (uses provider default if not specified)
--browser BROWSER Browser: chromium, chrome, firefox, safari, edge
--headless Run browser in headless mode
--viewport-width W Browser viewport width (default: 1920)
--viewport-height H Browser viewport height (default: 1080)
-v, --verbose Enable verbose output with step-by-step debugging
-q, --quiet Suppress all output except errors
--output-format FMT Output format: json, yaml, xml, junit, html, markdown
--output-file FILE Save results to file (stdout if not specified)
--system-prompt FILE Custom system prompt file
--timeout SECONDS Test execution timeout
--retry COUNT Number of retries on failure
--no-screenshots Disable screenshot capture
--no-token-optimization Disable token optimization
--config FILE Path to configuration file
--save-config Save current settings as defaults
Setting up ModelForge
# ModelForge is already installed with Browser Copilot (via model-forge-llm package)
# Just configure a provider:
# Configure a provider (e.g., GitHub Copilot)
modelforge config add --provider github_copilot --model gpt-4o
# Check configuration
modelforge config show
๐ Project Structure
browser-copilot/
โโโ browser_pilot/ # Main package
โ โโโ __init__.py
โ โโโ __main__.py # CLI entry point
โ โโโ core.py # Core automation engine
โ โโโ cli.py # Command-line interface
โ โโโ reporter.py # Report generation
โ โโโ config_manager.py # Configuration management
โ โโโ storage_manager.py # Local storage handling
โ โโโ io_handlers.py # Input/output formatting
โ โโโ verbose_logger.py # Enhanced logging
โ โโโ token_optimizer.py # Token optimization
โ โโโ test_enhancer.py # Test suite enhancement
โโโ examples/ # Example test suites
โ โโโ google-ai-search.md # Google AI search test
โ โโโ saucedemo-shopping.md # E-commerce shopping cart test
โโโ docs/ # Documentation
โ โโโ specs/ # Technical specifications
โโโ tests/ # Unit tests
๐ Local Storage
Browser Copilot stores data in platform-specific locations:
- macOS:
~/Library/Application Support/browser_pilot/ - Windows:
%LOCALAPPDATA%\browser_pilot\ - Linux:
~/.browser_copilot/
Storage structure:
~/.browser_copilot/
โโโ logs/ # Verbose execution logs
โโโ settings/ # Configuration files
โโโ reports/ # Test reports
โโโ screenshots/ # Captured screenshots
โโโ cache/ # Temporary files
โโโ memory/ # Future: persistent memory
## ๐ Learn More
- ๐ **[Quick Start Guide](docs/QUICK_START.md)** - Get running in 5 minutes
- ๐ง **[Configuration Wizard Guide](docs/WIZARD_GUIDE.md)** - Interactive setup walkthrough
- ๐ฏ **[Common Use Cases](docs/COMMON_USE_CASES.md)** - Real-world testing examples
- ๐ **[Troubleshooting Guide](docs/TROUBLESHOOTING.md)** - Solve common issues
- ๐ ๏ธ **[Configuration Guide](docs/CONFIGURATION.md)** - Advanced configuration
- ๐ **[Performance Guide](docs/PERFORMANCE.md)** - Optimization tips
## ๐ Example Test Suites
Learn from our comprehensive examples in the `examples/` directory:
### ๐ `saucedemo-shopping.md`
Complete e-commerce workflow including:
- User authentication
- Product browsing and selection
- Shopping cart management
- Multi-step checkout process
- Order confirmation
### ๐ `google-ai-search.md`
AI-powered search testing:
- Google AI mode activation
- Search query execution
- AI response validation
- Screenshot capture
- Different search scenarios
Run any example:
```bash
# With PyPI installation (after downloading examples):
browser-copilot saucedemo-shopping.md
browser-copilot google-ai-search.md --headless
# With source installation:
uv run browser-copilot examples/saucedemo-shopping.md
uv run browser-copilot examples/google-ai-search.md --headless
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
# Install with dev dependencies
uv sync --extra dev
# Run tests
uv run pytest
# Run linting
uv run ruff check .
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built with LangChain and LangGraph
- Browser automation powered by Playwright via MCP
- LLM management by ModelForge
Browser Copilot - Making browser testing as easy as writing a todo list ๐
Made with โค๏ธ by the Browser Copilot Team
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file browser_copilot-1.0.0.tar.gz.
File metadata
- Download URL: browser_copilot-1.0.0.tar.gz
- Upload date:
- Size: 322.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d03ebaa005e44401331a39daa842b9c0b67f03d86c8841c05d13f5b8b7ac6809
|
|
| MD5 |
e6e114d27c79552840271422f126961e
|
|
| BLAKE2b-256 |
7e8513a81da919dbc55495adb173a563b2e8a708bf3034226e174232be4a78d1
|
Provenance
The following attestation bundles were made for browser_copilot-1.0.0.tar.gz:
Publisher:
publish.yml on smiao-icims/browser-copilot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
browser_copilot-1.0.0.tar.gz -
Subject digest:
d03ebaa005e44401331a39daa842b9c0b67f03d86c8841c05d13f5b8b7ac6809 - Sigstore transparency entry: 321757217
- Sigstore integration time:
-
Permalink:
smiao-icims/browser-copilot@c717ad8848efea61d8e3b31ecf36d50f81ba6e0c -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/smiao-icims
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c717ad8848efea61d8e3b31ecf36d50f81ba6e0c -
Trigger Event:
release
-
Statement type:
File details
Details for the file browser_copilot-1.0.0-py3-none-any.whl.
File metadata
- Download URL: browser_copilot-1.0.0-py3-none-any.whl
- Upload date:
- Size: 79.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a681d881d457d3fa8af7d31b8651f3d8df5d22a0b4c61eb29181c124332cc071
|
|
| MD5 |
5809b85e22b25c36679fd85617a53e97
|
|
| BLAKE2b-256 |
cbc62553120e7f2fe8d21c31be28e96c6d0ed94f33ab3ccb5e935f9ccff490dd
|
Provenance
The following attestation bundles were made for browser_copilot-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on smiao-icims/browser-copilot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
browser_copilot-1.0.0-py3-none-any.whl -
Subject digest:
a681d881d457d3fa8af7d31b8651f3d8df5d22a0b4c61eb29181c124332cc071 - Sigstore transparency entry: 321757254
- Sigstore integration time:
-
Permalink:
smiao-icims/browser-copilot@c717ad8848efea61d8e3b31ecf36d50f81ba6e0c -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/smiao-icims
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c717ad8848efea61d8e3b31ecf36d50f81ba6e0c -
Trigger Event:
release
-
Statement type: