A powerful AI-powered browser automation userscript with a premium retro Macintosh-inspired UI. This tool enables you to automate web browsing tasks using natural language commands, powered by OpenAI-compatible APIs.
- Natural Language Commands: Simply describe what you want to do, and the AI will figure out how to accomplish it
- Smart Element Detection: Automatically identifies interactive elements on any webpage including buttons, inputs, links, dropdowns, and rich text editors
- Multi-step Task Execution: Handles complex workflows that span multiple pages and actions
- Cross-page Navigation: Seamlessly continues tasks across page navigations and redirects
- Click: Click on buttons, links, and interactive elements
- Type: Input text into fields, textareas, and rich text editors (contenteditable)
- Scroll: Scroll the page by pixels or to specific elements
- Wait: Wait for time intervals or specific elements to appear
- Select: Choose options from dropdown menus
- Hover: Trigger hover states on elements
- Press: Simulate keyboard key presses
- Navigate: Go to specific URLs
- Clear: Clear input field contents
- Retro Macintosh Plus Aesthetic: Beautiful pixel art design inspired by classic Macintosh computers
- Cyberpunk Glow Effects: Modern neon breathing animations for a unique visual experience
- Draggable Floating Button: Convenient mini-Mac icon that can be positioned anywhere on screen
- Real-time Status Logs: Detailed, color-coded execution logs with timestamps
- Collapsible Settings Panel: Easy configuration without cluttering the interface
- A userscript manager extension:
- Tampermonkey (Recommended)
- Violentmonkey
- Greasemonkey
- Install a userscript manager extension for your browser
- Click on the userscript manager icon and select "Create a new script"
- Copy the entire contents of
ai_browser_agent.user.js - Paste into the editor and save
- The script will now run on all websites
- Click the floating Mac icon to open the control panel
- Click the "CONFIG" button to expand settings
- Configure the following:
| Setting | Description | Example |
|---|---|---|
| API Endpoint | Base URL for OpenAI-compatible API | https://api.openai.com/v1 |
| Model | AI model to use | gpt-4o, gpt-3.5-turbo, etc. |
| API Key | Your API authentication key | sk-... |
This script works with any OpenAI-compatible API endpoint:
- OpenAI API
- Azure OpenAI
- Local LLM servers (LM Studio, Ollama with OpenAI compatibility layer)
- Third-party API proxies
- Navigate to the webpage where you want to perform automation
- Click the floating Mac icon to open the panel
- Enter your task in natural language (e.g., "Search for 'machine learning' and click the first result")
- Click "EXECUTE" to start the automation
Search for "artificial intelligence" on Google
Fill in the login form with username "test@example.com" and password "demo123", then click submit
Click the "Sign Up" button and fill in the registration form
Scroll down and find the contact section, then click the email link
The floating Mac button shows real-time status:
- Static lines: Idle, waiting for commands
- Animated lines: Task in progress
The status area displays color-coded logs:
- Green: Success messages
- Blue: Action execution
- Orange: Warnings
- Red: Errors
- Gray: Debug information
The script intelligently detects and catalogs interactive elements:
- Publish/Submit buttons (for social media posting)
- Search buttons and forms
- Rich text editors (Quill, ProseMirror, TinyMCE, contenteditable)
- File upload triggers
- Standard form elements (inputs, textareas, selects)
- Custom UI components (tabs, dropdowns, checkboxes)
- Clickable elements with pointer cursor
Elements are identified using a priority-based selector strategy:
- Element ID
- Name attribute
- ARIA labels
- Data attributes
- Path-based selectors with classes and nth-child
- Prevents multiple tabs from executing the same task simultaneously
- Handles page navigation gracefully with task resumption
- Implements lock-based coordination for multi-tab scenarios
- Automatically intercepts
window.opento keep navigation in the current tab
The script requires the following Tampermonkey grants:
GM_setValue/GM_getValue: Store configuration and task stateGM_xmlhttpRequest: Make API calls to the AI serviceGM_registerMenuCommand: Register menu commands (optional)
AI response parsing failed
- Ensure your API endpoint is correct and includes the base path (e.g.,
/v1) - Verify your API key is valid
- Check that the selected model is available on your API endpoint
Element not found
- The page may have dynamic content that hasn't loaded yet
- Try adding a wait step before the action
- Some elements may be inside iframes (not currently supported)
Task doesn't continue after navigation
- Ensure the script is installed and active on the target domain
- Check browser console for any errors
- The task timeout is 5 minutes - if exceeded, the task will reset
Open your browser's developer console (F12) to see detailed logs prefixed with [AI Agent].
- Does not support interactions inside iframes
- Cannot handle CAPTCHA or complex anti-bot measures
- File upload selection requires manual user interaction
- Some highly dynamic SPAs may have timing issues
- v0.7: Current version with enhanced element detection, rich text editor support, and improved cross-page navigation
- v0.6: Previous stable version
This project is provided as-is for personal and educational use.
Contributions are welcome! Feel free to submit issues and pull requests.
- UI design inspired by classic Macintosh Plus computers
- Cyberpunk aesthetic elements for modern visual appeal
- Built with vanilla JavaScript for maximum compatibility