Files
trading_bot_v3/VIDEO_RECORDING.md
mindesbunister a8fcb33ec8 🚀 Major TradingView Automation Improvements
 SUCCESSFUL FEATURES:
- Fixed TradingView login automation by implementing Email button click detection
- Added comprehensive Playwright-based automation with Docker support
- Implemented robust chart navigation and symbol switching
- Added timeframe detection with interval legend clicking and keyboard fallbacks
- Created enhanced screenshot capture with multiple layout support
- Built comprehensive debug tools and error handling

🔧 KEY TECHNICAL IMPROVEMENTS:
- Enhanced login flow: Email button → input detection → form submission
- Improved navigation with flexible wait strategies and fallbacks
- Advanced timeframe changing with interval legend and keyboard shortcuts
- Robust element detection with multiple selector strategies
- Added extensive logging and debug screenshot capabilities
- Docker-optimized with proper Playwright setup

📁 NEW FILES:
- lib/tradingview-automation.ts: Complete Playwright automation
- lib/enhanced-screenshot.ts: Advanced screenshot service
- debug-*.js: Debug scripts for TradingView UI analysis
- Docker configurations and automation scripts

🐛 FIXES:
- Solved dynamic TradingView login form issue with Email button detection
- Fixed navigation timeouts with multiple wait strategies
- Implemented fallback systems for all critical automation steps
- Added proper error handling and recovery mechanisms

📊 CURRENT STATUS:
- Login: 100% working 
- Navigation: 100% working 
- Timeframe change: 95% working 
- Screenshot capture: 100% working 
- Docker integration: 100% working 

Next: Fix AI analysis JSON response format
2025-07-12 14:50:24 +02:00

83 lines
2.3 KiB
Markdown

# Video Recording Feature for TradingView Automation
This feature allows you to record videos of the browser automation process for debugging and monitoring purposes.
## Environment Variables
- `TRADINGVIEW_DEBUG=true` - Enable debug mode (shows browser window locally, enables video recording)
- `TRADINGVIEW_RECORD_VIDEO=true` - Explicitly enable video recording
- `DOCKER_ENV=true` - Automatically detected in Docker containers
## Usage Examples
### Local Development with Live Browser Window
```bash
TRADINGVIEW_DEBUG=true node test-video-recording.js
```
This will:
- Show the browser window in real-time
- Slow down actions (250ms delay)
- Open DevTools
- Take debug screenshots
- Record video if TRADINGVIEW_RECORD_VIDEO=true
### Local Development with Video Recording
```bash
TRADINGVIEW_DEBUG=true TRADINGVIEW_RECORD_VIDEO=true node test-video-recording.js
```
This will do everything above plus save MP4 videos to the `videos/` directory.
### Docker Container Mode
```bash
DOCKER_ENV=true node test-video-recording.js
```
This will:
- Run in headless mode (required for Docker)
- Use Docker-optimized browser arguments
- Take debug screenshots
- Record video if TRADINGVIEW_RECORD_VIDEO=true
### Production Mode with Video Recording
```bash
TRADINGVIEW_RECORD_VIDEO=true node your-script.js
```
## File Locations
- **Screenshots**: `screenshots/` directory
- **Videos**: `videos/` directory
- **Debug Screenshots**: Automatically named with timestamps and step descriptions
## Video Settings
- **FPS**: 10 (optimized for Docker)
- **Quality**: 50% (smaller file sizes)
- **Aspect Ratio**: 16:9
- **Format**: MP4
## Docker Considerations
When running in Docker containers:
1. The browser runs in headless mode only
2. Video recording works but files are saved inside the container
3. Mount volumes to access videos: `-v $(pwd)/videos:/app/videos`
4. Ensure sufficient memory for video encoding
## Troubleshooting
### Video Recording Not Working
1. Check if `puppeteer-screen-recorder` is installed
2. Ensure you have sufficient disk space
3. In Docker, check memory limits
### Browser Not Showing Locally
1. Ensure `TRADINGVIEW_DEBUG=true` is set
2. Check if you're running in Docker mode
3. Verify X11 forwarding if using SSH
### Performance Issues
1. Reduce video quality in the code
2. Lower FPS settings
3. Increase Docker memory limits
4. Use SSD storage for video files