--- title: Browser Automation Tool emoji: 🌐 colorFrom: blue colorTo: indigo sdk: gradio sdk_version: "4.21.0" app_file: app.py pinned: false --- # Browser Automation Tool A comprehensive browser automation platform that combines the power of Gradio for web UI and FastAPI for programmatic access. This tool enables seamless web scraping, browser automation, and integration with AI agents. ## Features - 🌐 **Web Browser Automation**: Control Chrome/Chromium browsers programmatically - 📸 **Screenshot Capture**: Take screenshots of any webpage - 🔍 **Web Scraping**: Extract data from HTML content - 🤖 **AI Agent Integration**: Compatible with Model Context Protocol (MCP) - ⚡ **Real-time Streaming**: Server-Sent Events (SSE) for live updates - 🚀 **RESTful API**: FastAPI backend for programmatic access - 📱 **Web Interface**: User-friendly Gradio UI ## Quick Start ### Using the Web Interface 1. Visit the Space URL above 2. Enter a URL to navigate 3. Use built-in tools for automation ### Using the API ```python import requests # Get available sessions response = requests.get('https://your-space-url/api/sessions') sessions = response.json() # Create a new browser session session_data = { 'headless': True, 'window_size': {'width': 1920, 'height': 1080} } response = requests.post('https://your-space-url/api/sessions', json=session_data) session_id = response.json()['session_id'] # Navigate to a website requests.post(f'https://your-space-url/api/sessions/{{session_id}}/navigate', json={{'url': 'https://example.com'}}) # Take a screenshot response = requests.get(f'https://your-space-url/api/sessions/{{session_id}}/screenshot') with open('screenshot.png', 'wb') as f: f.write(response.content) ``` ## API Endpoints ### Session Management - `GET /api/sessions` - List all active sessions - `POST /api/sessions` - Create new browser session - `DELETE /api/sessions/{{session_id}}` - Close session ### Browser Control - `POST /api/sessions/{{session_id}}/navigate` - Navigate to URL - `GET /api/sessions/{{session_id}}/screenshot` - Take screenshot - `POST /api/sessions/{{session_id}}/click` - Click element - `POST /api/sessions/{{session_id}}/type` - Type text - `GET /api/sessions/{{session_id}}/get_page_source` - Get HTML ## Author **MiniMax Agent** - Advanced AI automation tools