metadata
title: Chrome Controller Pro
emoji: π
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
license: mit
app_port: 7860
Chrome Controller Pro
A professional-grade Chrome browser controller for Hugging Face Spaces with advanced automation capabilities.
π Features
- Headless Chrome Management: Start, stop, and monitor Chrome instances
- Screenshot Capture: Take high-quality screenshots of web pages
- URL Navigation: Navigate to any website with automatic protocol handling
- JavaScript Execution: Execute custom JavaScript code in the browser context
- Process Management: Robust Chrome process lifecycle management
- Persistent Profiles: Chrome user data persistence during session
π οΈ Key Improvements Over Previous Version
Fixed Issues:
- Gradio Schema Error: Resolved
TypeError: argument of type 'bool' is not iterableby using proper Gradio component initialization - Launch Configuration: Fixed localhost accessibility issues with proper server configuration
- Chrome Stability: Enhanced Chrome startup reliability with better error handling
- Resource Management: Improved process cleanup and memory management
New Features:
- JavaScript Console: Execute custom JavaScript code directly in the browser
- Tabbed Interface: Organized functionality into logical tabs
- Enhanced Status Monitoring: Real-time Chrome process status updates
- Better Error Handling: Comprehensive error messages and recovery options
- Optimized Performance: Reduced startup time and improved responsiveness
ποΈ Architecture
The application uses a class-based architecture with the ChromeController class managing:
- Chrome process lifecycle
- WebDriver connections
- Screenshot capture
- JavaScript execution
- Process monitoring
π³ Docker Configuration
The Dockerfile is optimized for:
- Minimal image size with multi-stage optimization
- Proper Chrome dependencies installation
- Security best practices with non-root user
- Health checks for reliability
π Usage Instructions
- Start Chrome: Click "π Start Chrome" to launch the browser instance
- Navigate: Enter a URL and click "π§ Navigate" to visit websites
- Screenshot: Use "πΈ Take Screenshot" to capture the current page
- Execute JS: Use the JavaScript tab to run custom code
- Monitor: Check status and manage processes as needed
π§ Technical Details
Chrome Arguments
Optimized Chrome flags for containerized environments:
- Headless mode with new engine
- Disabled GPU acceleration for CPU environments
- Security sandbox disabled for container compatibility
- Remote debugging enabled on port 9222
- Crash reporting disabled to prevent permission issues
Dependencies
gradio==4.44.0- Web interface frameworkselenium==4.25.0- Browser automationwebdriver-manager==4.0.2- ChromeDriver managementpsutil==6.0.0- Process managementPillow==10.4.0- Image processing
π¨ Troubleshooting
Common Issues:
Chrome won't start
- Check the status output for specific error messages
- Ensure sufficient memory is available
- Try stopping and restarting Chrome
Screenshots fail
- Verify Chrome is running with "π Check Status"
- Ensure the page has finished loading
- Check if the target URL is accessible
JavaScript execution errors
- Verify the JavaScript syntax
- Ensure Chrome is running and has a page loaded
- Check browser console for additional error details
Performance Tips:
- Keep Chrome running between operations for better performance
- Use the status check before taking screenshots
- Clean up processes periodically if running long sessions
π Security Notes
- Runs in a sandboxed container environment
- Uses non-root user for enhanced security
- Chrome security features are partially disabled for container compatibility
- No persistent data storage outside the session
π License
MIT License - Feel free to use and modify as needed.
π€ Contributing
This is an open-source project. Contributions, issues, and feature requests are welcome!
Built with β€οΈ for the Hugging Face Spaces community