A flexible and robust browser UI automation framework that provides essential functionality for browser-based UI automation projects.
- Browser Management: Automated browser launching and control across different operating systems
- Configuration Handling: Flexible configuration management with TOML and environment variable support
- Clipboard Integration: Easy clipboard monitoring and manipulation
- UI Integration Base: Extensible base classes for UI automation
- Cross-Platform Support: Works on Linux and macOS
pip install brui_coregit clone https://github.com/AutoByteus/brui_core.git
cd brui_core
uv syncWith uv, dev dependencies are synced by default. To sync all extras:
uv sync --all-extrasThis project utilizes uv for modern, isolated builds:
# Build with specific Python version
uv build --python 3.11This will produce the source distribution and wheel in the dist/ directory.
from brui_core.ui_integrator import UIIntegrator
async def main():
# Initialize the UI integrator
ui = UIIntegrator()
await ui.initialize()
try:
# Your automation code here
pass
finally:
# Clean up
await ui.close()
# Run with asyncio
import asyncio
asyncio.run(main())UIIntegrator now uses explicit lifecycle control only. It does not run a background keep-alive loop.
If your page is closed and you need a fresh tab, call await ui.reopen_page() explicitly.
- Python 3.11+
- Playwright (pinned in
pyproject.tomland installed automatically) - Chrome/Chromium browser installed
- Pillow, pyperclip, and other transitive dependencies installed with the package
The framework is configured using environment variables:
| Environment Variable | Description | Default |
|---|---|---|
CHROME_PROFILE_DIRECTORY |
Chrome profile to use | Profile 1 |
CHROME_REMOTE_DEBUGGING_PORT |
Remote debugging port | 9222 |
CHROME_DOWNLOAD_DIRECTORY |
Directory for downloads | (System Default) |
CHROME_USER_DATA_DIR |
User data directory for session persistence | (System Default) |
To maintain login states (cookies, local storage, cache) across different automation runs, you can configure the user_data_dir.
- Default Behavior: If
user_data_diris not set, Chrome uses your system's default user profile (e.g.,~/.config/google-chromeon Linux). This means your automation shares the same session as your personal browsing. - Custom / Isolated Session: To keep your automation isolated (or to maintain multiple distinct signed-in states), set
user_data_dirto a specific path. As long as you point to the same directory, Chrome will restore your previous session, keeping you logged in. - Chrome/Chromium 136+ Requirement: Recent Chrome and Chromium versions (136+) refuse to enable remote debugging on the default profile directory. You must set
user_data_dirto a non-default path for CDP to work.
Example (Environment Variable):
export CHROME_USER_DATA_DIR="./my-bot-profile"This repo includes a few manual smoke tests under scripts/ to verify local setup.
These are not part of automated CI.
uv run python scripts/test_browser.pyThis connects to a running Chromium instance over CDP on http://localhost:9222 and opens Google.
uv run python scripts/test_ui_integrator.pyThis initializes UIIntegrator, opens a page, and optionally writes a screenshot.
bash scripts/test_llm_server_docker.shThis waits for a local LLM server on port 51739 and Chromium on port 9222, then probes their HTTP endpoints.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository.
- Built with Playwright
- Developed by AutoByteus