Update APPLICATION_README.md
Browse files- APPLICATION_README.md +109 -56
APPLICATION_README.md
CHANGED
|
@@ -1,70 +1,123 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
-
2. **Headless Chrome**: Optimized for containerized environments
|
| 27 |
-
3. **Screenshot Capture**: Take screenshots of web pages
|
| 28 |
-
4. **URL Navigation**: Navigate to any website
|
| 29 |
-
5. **Process Management**: Safe Chrome process handling
|
| 30 |
|
| 31 |
-
##
|
| 32 |
|
| 33 |
-
1.
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
-
|
| 42 |
-
-
|
| 43 |
-
-
|
| 44 |
|
| 45 |
-
##
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
-
##
|
| 54 |
|
| 55 |
-
|
| 56 |
-
- `selenium==4.25.0` - Browser automation
|
| 57 |
-
- `webdriver-manager==4.0.2` - ChromeDriver management
|
| 58 |
-
- `psutil==6.0.0` - Process management
|
| 59 |
-
- `Pillow==10.4.0` - Image processing
|
| 60 |
|
| 61 |
-
##
|
| 62 |
|
| 63 |
-
-
|
| 64 |
-
- Limited to headless browser operations
|
| 65 |
-
- No audio/video playback in headless mode
|
| 66 |
-
- CPU-based processing only
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
-
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Chrome Controller Pro
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
license: mit
|
| 9 |
+
app_port: 7860
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Chrome Controller Pro
|
| 13 |
+
|
| 14 |
+
A professional-grade Chrome browser controller for Hugging Face Spaces with advanced automation capabilities.
|
| 15 |
+
|
| 16 |
+
## π Features
|
| 17 |
+
|
| 18 |
+
- **Headless Chrome Management**: Start, stop, and monitor Chrome instances
|
| 19 |
+
- **Screenshot Capture**: Take high-quality screenshots of web pages
|
| 20 |
+
- **URL Navigation**: Navigate to any website with automatic protocol handling
|
| 21 |
+
- **JavaScript Execution**: Execute custom JavaScript code in the browser context
|
| 22 |
+
- **Process Management**: Robust Chrome process lifecycle management
|
| 23 |
+
- **Persistent Profiles**: Chrome user data persistence during session
|
| 24 |
+
|
| 25 |
+
## π οΈ Key Improvements Over Previous Version
|
| 26 |
+
|
| 27 |
+
### Fixed Issues:
|
| 28 |
+
1. **Gradio Schema Error**: Resolved `TypeError: argument of type 'bool' is not iterable` by using proper Gradio component initialization
|
| 29 |
+
2. **Launch Configuration**: Fixed localhost accessibility issues with proper server configuration
|
| 30 |
+
3. **Chrome Stability**: Enhanced Chrome startup reliability with better error handling
|
| 31 |
+
4. **Resource Management**: Improved process cleanup and memory management
|
| 32 |
+
|
| 33 |
+
### New Features:
|
| 34 |
+
1. **JavaScript Console**: Execute custom JavaScript code directly in the browser
|
| 35 |
+
2. **Tabbed Interface**: Organized functionality into logical tabs
|
| 36 |
+
3. **Enhanced Status Monitoring**: Real-time Chrome process status updates
|
| 37 |
+
4. **Better Error Handling**: Comprehensive error messages and recovery options
|
| 38 |
+
5. **Optimized Performance**: Reduced startup time and improved responsiveness
|
| 39 |
+
|
| 40 |
+
## ποΈ Architecture
|
| 41 |
+
|
| 42 |
+
The application uses a class-based architecture with the `ChromeController` class managing:
|
| 43 |
+
- Chrome process lifecycle
|
| 44 |
+
- WebDriver connections
|
| 45 |
+
- Screenshot capture
|
| 46 |
+
- JavaScript execution
|
| 47 |
+
- Process monitoring
|
| 48 |
+
|
| 49 |
+
## π³ Docker Configuration
|
| 50 |
+
|
| 51 |
+
The Dockerfile is optimized for:
|
| 52 |
+
- Minimal image size with multi-stage optimization
|
| 53 |
+
- Proper Chrome dependencies installation
|
| 54 |
+
- Security best practices with non-root user
|
| 55 |
+
- Health checks for reliability
|
| 56 |
+
|
| 57 |
+
## π Usage Instructions
|
| 58 |
+
|
| 59 |
+
1. **Start Chrome**: Click "π Start Chrome" to launch the browser instance
|
| 60 |
+
2. **Navigate**: Enter a URL and click "π§ Navigate" to visit websites
|
| 61 |
+
3. **Screenshot**: Use "πΈ Take Screenshot" to capture the current page
|
| 62 |
+
4. **Execute JS**: Use the JavaScript tab to run custom code
|
| 63 |
+
5. **Monitor**: Check status and manage processes as needed
|
| 64 |
+
|
| 65 |
+
## π§ Technical Details
|
| 66 |
+
|
| 67 |
+
### Chrome Arguments
|
| 68 |
+
Optimized Chrome flags for containerized environments:
|
| 69 |
+
- Headless mode with new engine
|
| 70 |
+
- Disabled GPU acceleration for CPU environments
|
| 71 |
+
- Security sandbox disabled for container compatibility
|
| 72 |
+
- Remote debugging enabled on port 9222
|
| 73 |
+
- Crash reporting disabled to prevent permission issues
|
| 74 |
+
|
| 75 |
+
### Dependencies
|
| 76 |
+
- `gradio==4.44.0` - Web interface framework
|
| 77 |
+
- `selenium==4.25.0` - Browser automation
|
| 78 |
+
- `webdriver-manager==4.0.2` - ChromeDriver management
|
| 79 |
+
- `psutil==6.0.0` - Process management
|
| 80 |
+
- `Pillow==10.4.0` - Image processing
|
| 81 |
|
| 82 |
+
## π¨ Troubleshooting
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
### Common Issues:
|
| 85 |
|
| 86 |
+
1. **Chrome won't start**
|
| 87 |
+
- Check the status output for specific error messages
|
| 88 |
+
- Ensure sufficient memory is available
|
| 89 |
+
- Try stopping and restarting Chrome
|
| 90 |
|
| 91 |
+
2. **Screenshots fail**
|
| 92 |
+
- Verify Chrome is running with "π Check Status"
|
| 93 |
+
- Ensure the page has finished loading
|
| 94 |
+
- Check if the target URL is accessible
|
| 95 |
|
| 96 |
+
3. **JavaScript execution errors**
|
| 97 |
+
- Verify the JavaScript syntax
|
| 98 |
+
- Ensure Chrome is running and has a page loaded
|
| 99 |
+
- Check browser console for additional error details
|
| 100 |
|
| 101 |
+
### Performance Tips:
|
| 102 |
+
- Keep Chrome running between operations for better performance
|
| 103 |
+
- Use the status check before taking screenshots
|
| 104 |
+
- Clean up processes periodically if running long sessions
|
| 105 |
|
| 106 |
+
## π Security Notes
|
| 107 |
|
| 108 |
+
- Runs in a sandboxed container environment
|
| 109 |
+
- Uses non-root user for enhanced security
|
| 110 |
+
- Chrome security features are partially disabled for container compatibility
|
| 111 |
+
- No persistent data storage outside the session
|
| 112 |
|
| 113 |
+
## π License
|
| 114 |
|
| 115 |
+
MIT License - Feel free to use and modify as needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
+
## π€ Contributing
|
| 118 |
|
| 119 |
+
This is an open-source project. Contributions, issues, and feature requests are welcome!
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
+
---
|
| 122 |
|
| 123 |
+
*Built with β€οΈ for the Hugging Face Spaces community*
|