Cross-platform Browser Framework for Web Automation (Windows & Linux)
Reason this release was yanked:
same as 2.0.0 but mistakenly wrongly tagged
Project description
๐ Quick Browser Framework
Cross-platform Browser Automation Framework for Windows & Linux - 64-bit optimized
A simple yet powerful Python framework for browser automation based on Selenium. Designed for cross-platform compatibility with focus on simplicity, reliability, and zero-configuration setup.
โจ Features
- ๐ง Simple API - Minimal setup code for maximum productivity
- ๐ Cross-Platform - Seamless operation on Windows (x64) and Linux (x64, ARM64)
- โก Performance Optimized - Fast startup times and efficient resource usage
- ๐ฆ Zero-Setup - Automatic Chromium and ChromeDriver management
- ๐ก๏ธ Robust - Built-in error handling and retry mechanisms
- ๐ Type-Safe - Complete type hints and robust error handling
- ๐ Auto-Update - Automatic WebDriver compatibility management
- ๐ธ Screenshot Support - Built-in screenshot functionality
- ๐ฏ Context Manager Support - Clean resource management with automatic cleanup
- ๐๏ธ Modular Architecture - Use components independently or as complete framework
๐ฆ Quick Installation
From PyPI (Recommended)
pip install quick-browser
From Gitea Registry (Development)
# From Gitea Registry
pip install --index-url https://git.noircoding.de/api/packages/NoirPi/pypi/simple/ quick-browser
# Or with requirements.txt
echo "--extra-index-url https://git.noircoding.de/api/packages/NoirPi/pypi/simple/" >> requirements.txt
echo "quick-browser>=1.1.0" >> requirements.txt
pip install -r requirements.txt
Test Installation
quick-browser-test
๐ Quick Start
Basic Usage (Recommended - Context Manager)
from quick_browser import BrowserFramework, BrowserConfig
# Simple configuration
config = BrowserConfig(
headless=False, # Show browser window
kiosk=False, # Windowed mode
show_console=True # Show download progress
)
# Context manager automatically handles setup and cleanup
with BrowserFramework(config) as browser:
# Navigate to a website
browser.navigate("https://www.google.com")
# Find and interact with elements
search_box = browser.send_keys_by_name("q", "Python automation")
search_box.submit()
# Take screenshot
browser.driver.save_screenshot("result.png")
# Direct Selenium WebDriver access
results = browser.driver.find_elements("css selector", "h3")
print(f"Found {len(results)} search results")
Legacy API (Backward Compatibility)
from browser_framework import BrowserManager
# Browser starten
browser_manager = BrowserManager()
driver = browser_manager.get_driver()
# Webseite รถffnen
driver.get("https://www.google.com")
# Element finden und interagieren
search_box = driver.find_element("name", "q")
search_box.send_keys("Python automation")
search_box.submit()
# Screenshot erstellen
driver.save_screenshot("result.png")
# Cleanup
browser_manager.cleanup()
Platform-Optimized Configuration
from quick_browser import PlatformConfigFactory
# Automatically optimized for current platform
config = PlatformConfigFactory.create_auto_config(
headless=False,
element_timeout=15
)
with BrowserFramework(config) as browser:
browser.navigate("https://example.com")
# Framework automatically handles platform differences
Advanced Configuration
from quick_browser import BrowserConfig
config = BrowserConfig(
chromium_version="120.0.6099.109", # Specific Chromium version
driver_version="120.0.6099.109", # Specific ChromeDriver version
headless=True, # Headless mode
element_timeout=30, # Custom timeouts
page_load_timeout=45,
performance_flags=[ # Custom Chrome flags
"--disable-extensions",
"--disable-gpu",
"--no-sandbox"
],
browser_prefs={ # Browser preferences
"download.default_directory": "./downloads",
"profile.default_content_settings.popups": 0
}
)
๐ Examples
The examples/ directory contains complete examples:
basic_example.py- Cross-platform browser automation with diagnosticsadvanced_scraping_example.py- Advanced scraping techniques with performance monitoring
Running Examples
# Basic example
python examples/basic_example.py
# Advanced examples
python examples/advanced_scraping_example.py
๐ ๏ธ Advanced Features
Element Interactions
from quick_browser import ElementWaiter
with BrowserFramework(config) as browser:
browser.navigate("https://example.com")
# Advanced element waiting
waiter = ElementWaiter(browser.driver, default_timeout=10)
element = waiter.wait_for_element_clickable("id", "submit-button")
# Safe clicking with timeout
success = browser.safe_click("css selector", ".important-button")
# Multiple element interactions
browser.send_keys_by_name("username", "testuser")
browser.send_keys_by_name("password", "testpass")
browser.click_by_id("login-button")
Performance Monitoring
from quick_browser import PerformanceMonitor
with BrowserFramework(config) as browser:
browser.navigate("https://example.com")
# Monitor page performance
monitor = PerformanceMonitor(browser.driver)
load_time = monitor.get_page_load_time()
memory_usage = monitor.get_memory_usage()
print(f"Page loaded in {load_time:.2f}s")
print(f"Memory usage: {memory_usage['used_heap'] / 1024 / 1024:.1f}MB")
Cross-Platform Utilities
from quick_browser import CrossPlatformUtils
with BrowserFramework(config) as browser:
browser.navigate("https://example.com")
utils = CrossPlatformUtils()
# Full page screenshot
utils.take_full_page_screenshot(browser.driver, "fullpage.png")
# Clear browser data
utils.clear_browser_data(browser.driver)
# Get comprehensive page info
page_info = utils.get_page_info(browser.driver)
print(f"Page title: {page_info['title']}")
Manual Resource Management
# Manual management for complex scenarios
browser = BrowserFramework(config)
try:
browser.setup() # Explicit setup
browser.navigate("https://example.com")
# ... your automation code ...
finally:
browser.quit() # Explicit cleanup
๐๏ธ Architecture
The framework is built with a modular architecture:
quick_browser/
โโโ core/ # Core framework orchestration
โโโ chromium/ # Chromium download and management
โโโ config/ # Configuration classes
โโโ utils/ # Utility components
โโโ exceptions/ # Custom exceptions
โโโ types/ # Type definitions
Key Components
- BrowserFramework: Main orchestrator class (new API)
- BrowserManager: Legacy compatibility class
- ChromiumManager: Handles Chromium download and setup
- DriverManager: Manages ChromeDriver compatibility
- ElementWaiter: Advanced element waiting utilities
- PerformanceMonitor: Browser performance tracking
- CrossPlatformUtils: Platform-agnostic utilities
๐ฅ๏ธ Platform Support
Windows
- Architecture: x64
- Features: Full feature support including console management
- Chrome Flags: Windows-optimized performance flags
- Dependencies: Includes
pywin32for Windows-specific features
Linux
- Architecture: x64, ARM64
- Features: Full feature support with X11 compatibility
- Chrome Flags: Linux-optimized flags including
--no-sandbox - Dependencies: No platform-specific requirements
๐ Requirements
- Python: 3.8 or higher
- Operating System: Windows 10+ or Linux (most distributions)
- Architecture: 64-bit (x64, ARM64 on Linux)
- RAM: Minimum 4GB recommended
Python Dependencies
selenium>=4.15.0
webdriver-manager>=4.0.0
requests>=2.31.0
tqdm>=4.66.0
pywin32>=306 # Windows only
๐ง CLI Tools
The framework includes practical CLI tools:
# Test framework installation
quick-browser-test
# Show help
quick-browser-test --help
๐ API Reference
๐ Complete API documentation is available in our Gitea Wiki
Quick Reference
BrowserFramework (New API)
Main orchestrator class for cross-platform browser automation.
from quick_browser import BrowserFramework, BrowserConfig
config = BrowserConfig(...)
# Context manager (recommended)
with BrowserFramework(config) as browser:
browser.navigate("https://example.com")
browser.send_keys_by_name("q", "search term")
Key Methods:
navigate(url)- Navigate with automatic optimizationssafe_click(by, value, timeout)- Safe element clickingsend_keys_by_name(name, keys, timeout)- Type-safe text input
๐ Full BrowserFramework API โ
BrowserManager (Legacy API)
Backward-compatible browser management class.
from browser_framework import BrowserManager
browser_manager = BrowserManager()
driver = browser_manager.get_driver()
# ... automation code ...
browser_manager.cleanup()
๐ Full BrowserManager API โ
Configuration
from quick_browser import BrowserConfig, PlatformConfigFactory
# Manual configuration
config = BrowserConfig(headless=False, element_timeout=20)
# Platform-optimized configuration
config = PlatformConfigFactory.create_auto_config()
Utility Components
from quick_browser import ElementWaiter, PerformanceMonitor, CrossPlatformUtils
# Advanced element operations
waiter = ElementWaiter(driver)
element = waiter.wait_for_element_clickable("id", "button")
# Performance monitoring
monitor = PerformanceMonitor(driver)
load_time = monitor.get_page_load_time()
## ๐ Troubleshooting
### Common Issues
**Browser doesn't start on Linux:**
```bash
# Install required dependencies
sudo apt-get update
sudo apt-get install -y chromium-browser xvfb
Permission errors on Linux:
# Make sure Chrome binary is executable
chmod +x /path/to/chrome
WebDriver crashes:
- Update to latest framework version
- Check Chrome/ChromeDriver compatibility
- Enable verbose logging with
log_system_info=True
Debug Mode
config = BrowserConfig(
log_system_info=True, # Enable detailed logging
show_console=True # Show browser console
)
๐ Performance
Benchmarks
- Cold Start (first run): ~45-150 seconds (includes Chromium download)
- Warm Start (cached): ~4-7 seconds
- Navigation: ~1-3 seconds per page
- Element Finding: ~100-500ms with waits
- Memory Usage: ~200-400MB per browser instance
- Context Manager Overhead: <50ms vs manual management
Download Sizes
- Chromium: ~50-200MB (platform dependent)
- ChromeDriver: ~5-15MB
- Total Cache: ~60-220MB
Optimization Tips
- Use
headless=Truefor CI/CD pipelines - Enable
profile_cleanup=Falsefor faster repeated runs - Use specific versions to avoid download overhead
- Implement element waiting instead of
time.sleep() - Use context managers for automatic resource management
๐๏ธ Development
Setup Development Environment
# Clone repository
git clone https://git.noircoding.de/NoirPi/quick-browser.git
cd quick-browser
# Create virtual environment
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux
source .venv/bin/activate
# Install development dependencies
pip install -e .[dev]
Running Tests
# All tests
pytest
# With coverage
pytest --cov=quick_browser
# Specific test
pytest tests/test_browser_framework.py
Code Quality
# Linting with Ruff
ruff check .
# Auto-fix
ruff check . --fix
# Formatting
ruff format .
# Type checking
mypy quick_browser/
Build Package
# Clean build
python -m build
# Upload to PyPI
twine upload dist/*
# Upload to Gitea
twine upload --repository gitea dist/*
๐ค Contributing
We welcome contributions! Please see our Contributing Guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ Changelog
v1.2.0 (Current)
- ๐ Cross-platform support (Windows + Linux)
- ๐ง New BrowserFramework API with context manager support
- ๐ฆ Automatic Chromium and ChromeDriver management
- ๐ ๏ธ Modular architecture with utility components
- ๐ Complete type safety and error handling
- โก Performance optimizations and monitoring tools
v1.1.0 (2025-06-02)
- โจ Initial release
- ๐ง Basic browser management
- ๐ฆ Windows 64-bit optimization
- ๐ก๏ธ Error handling
- ๐ธ Screenshot support
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
- Issues: GitHub Issues | Gitea Issues
- Documentation: Wiki | Gitea README
- Email: noirpi@noircoding.de
๐ Acknowledgments
- Built on top of Selenium WebDriver
- Uses ungoogled-chromium for privacy-focused browsing
- Cross-platform compatibility inspired by modern Python practices
- Python Community and all beta testers
Made with โค๏ธ by NoirPi
Quick Browser Framework - Because browser automation shouldn't be complicated!
Project details
Release history Release notifications | RSS feed
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 quick_browser-2.0.1.dev0.tar.gz.
File metadata
- Download URL: quick_browser-2.0.1.dev0.tar.gz
- Upload date:
- Size: 85.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05921232a68e03d1611fa08bcad2c1447a11c60914f4a0c89727877c93bc6c46
|
|
| MD5 |
689964d9a3591161ae2944efe5911091
|
|
| BLAKE2b-256 |
1ac6a613f1bc82d6eaf7a13ce4ee7de5820db489c148ecc9bda54425a9f822ac
|
File details
Details for the file quick_browser-2.0.1.dev0-py3-none-any.whl.
File metadata
- Download URL: quick_browser-2.0.1.dev0-py3-none-any.whl
- Upload date:
- Size: 86.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb8ad2dde292ad70b48cbc6cc9508fc7b4984556b6aef8aae79d433707ab0781
|
|
| MD5 |
b4ef4111eaa95ca708a1b07ceac86b21
|
|
| BLAKE2b-256 |
495e3a9eb53c892415ba055cddbfef35f8b43f55c0ab2a05e3a19c5bb2fdf973
|