--- name: browser-automation description: Local Python-based browser automation toolkit using Playwright. Provides command-line tools for navigating, interacting with, and testing web applications. Supports clicking, typing, hovering, screenshots, content extraction, and JavaScript execution. Use this skill when you need to automate browser interactions, test web applications, or extract data from web pages. license: ISC --- # Browser Automation Skill This skill provides local browser automation capabilities using Python and Playwright. All browser automation is performed locally via CLI commands. ## When to Use This Skill Use this skill when you need to: - Automate interactions with web pages (clicking, typing, navigating) - Test web application functionality - Extract content or data from web pages - Take screenshots of web pages - Execute custom JavaScript in browser context - Hover over elements to trigger UI states ## Prerequisites Before using this skill, ensure Playwright is installed: ```bash pip install playwright playwright install chromium ``` ## Available Tools All tools are implemented as subcommands in `assets/skills/browser-automation/scripts/browser_tools.py`. Each command is stateless - it launches a new browser instance, performs the action, and closes the browser. ### browser_navigate Navigate to a URL and wait for the page to load. **Usage:** ```bash python assets/skills/browser-automation/scripts/browser_tools.py browser_navigate ``` **Example:** ```bash python assets/skills/browser-automation/scripts/browser_tools.py browser_navigate https://example.com ``` ### browser_click Click an element on a page using a CSS selector or text match. **Usage:** ```bash python assets/skills/browser-automation/scripts/browser_tools.py browser_click [--text TEXT] ``` **Parameters:** - `url`: URL to navigate to - `selector`: CSS selector for the element (optional if using --text) - `--text`: (Optional) Text to match instead of using selector **Examples:** ```bash # Click by selector python assets/skills/browser-automation/scripts/browser_tools.py browser_click https://example.com "#submit-button" # Click by text python assets/skills/browser-automation/scripts/browser_tools.py browser_click https://example.com "button" --text "Submit" ``` ### browser_type Type text into an input field, with optional form submission. **Usage:** ```bash python assets/skills/browser-automation/scripts/browser_tools.py browser_type [--submit] ``` **Parameters:** - `url`: URL to navigate to - `selector`: CSS selector for the input field - `text`: Text to type - `--submit`: (Optional) Press Enter after typing **Examples:** ```bash # Type into field python assets/skills/browser-automation/scripts/browser_tools.py browser_type https://example.com "#email" "user@example.com" # Type and submit python assets/skills/browser-automation/scripts/browser_tools.py browser_type https://example.com "#search" "query" --submit ``` ### browser_screenshot Capture a screenshot of the current page. **Usage:** ```bash python assets/skills/browser-automation/scripts/browser_tools.py browser_screenshot [--full_page] ``` **Parameters:** - `url`: URL to navigate to - `path`: Output file path for the screenshot - `--full_page`: (Optional) Capture the entire scrollable page **Examples:** ```bash # Viewport screenshot python assets/skills/browser-automation/scripts/browser_tools.py browser_screenshot https://example.com /tmp/screenshot.png # Full page screenshot python assets/skills/browser-automation/scripts/browser_tools.py browser_screenshot https://example.com /tmp/full.png --full_page ``` ### browser_get_content Extract text or HTML content from the page or a specific element. **Usage:** ```bash python assets/skills/browser-automation/scripts/browser_tools.py browser_get_content [--selector SELECTOR] [--html] ``` **Parameters:** - `url`: URL to navigate to - `--selector`: (Optional) CSS selector, defaults to 'body' - `--html`: (Optional) Return HTML instead of text **Examples:** ```bash # Get all page text python assets/skills/browser-automation/scripts/browser_tools.py browser_get_content https://example.com # Get specific element text python assets/skills/browser-automation/scripts/browser_tools.py browser_get_content https://example.com --selector "#main-content" # Get HTML python assets/skills/browser-automation/scripts/browser_tools.py browser_get_content https://example.com --selector "article" --html ``` ### browser_hover Hover over an element to trigger hover states or tooltips. **Usage:** ```bash python assets/skills/browser-automation/scripts/browser_tools.py browser_hover ``` **Parameters:** - `url`: URL to navigate to - `selector`: CSS selector for the element **Example:** ```bash python assets/skills/browser-automation/scripts/browser_tools.py browser_hover https://example.com ".menu-item" ``` ### browser_evaluate Execute custom JavaScript code in the browser context. **Usage:** ```bash python assets/skills/browser-automation/scripts/browser_tools.py browser_evaluate