$npx -y skills add SpillwaveSolutions/automating-mac-apps-plugin --skill web-browser-automationComprehensive macOS browser automation using PyXA, Playwright, Selenium, and Puppeteer for desktop web testing, scraping, and workflow automation. Use when asked to "automate web browsers", "Selenium Chrome automation", "Playwright testing", "Puppeteer scraping", or "cross-browse
| 1 | # macOS Web Browser Automation Guide |
| 2 | |
| 3 | ## Table of Contents |
| 4 | 1. [Overview](#overview) |
| 5 | 2. [Browser Compatibility Matrix](#browser-compatibility-matrix) |
| 6 | 3. [PyXA Integration](#pyxa-integration) |
| 7 | 4. [Playwright Automation](#playwright-automation) |
| 8 | 5. [Selenium WebDriver](#selenium-webdriver) |
| 9 | 6. [Puppeteer Node.js](#puppeteer-nodejs) |
| 10 | 7. [Comprehensive Automation Workflows](#comprehensive-automation-workflows) |
| 11 | - [Workflow 1: Multi-Browser Tab Management](#workflow-1-multi-browser-tab-management) |
| 12 | - [Workflow 2: Automated Research and Data Collection](#workflow-2-automated-research-and-data-collection) |
| 13 | - [Workflow 3: Cross-Browser Testing Suite](#workflow-3-cross-browser-testing-suite) |
| 14 | - [Workflow 4: Web Scraping and Data Extraction](#workflow-4-web-scraping-and-data-extraction) |
| 15 | 8. [Brief Automation Patterns](#brief-automation-patterns) |
| 16 | 9. [Advanced Techniques](#advanced-techniques) |
| 17 | 10. [Troubleshooting and Validation](#troubleshooting-and-validation) |
| 18 | 11. [Security Considerations](#security-considerations) |
| 19 | 12. [Performance Optimization](#performance-optimization) |
| 20 | 13. [Integration Examples](#integration-examples) |
| 21 | |
| 22 | ## Overview |
| 23 | |
| 24 | This guide covers comprehensive web browser automation on macOS desktop, focusing on automation (not testing). We cover four major automation frameworks with practical examples for real-world scenarios. |
| 25 | |
| 26 | **PyXA Installation:** To use PyXA examples in this skill, see the installation instructions in `automating-mac-apps` skill (PyXA Installation section). |
| 27 | |
| 28 | ### Primary Automation Tools |
| 29 | |
| 30 | - **PyXA**: macOS-native Python wrapper with direct browser integration |
| 31 | - **Playwright**: Cross-platform framework with Python bindings for modern web automation |
| 32 | - **Selenium**: Industry-standard automation with ChromeDriver integration |
| 33 | - **Puppeteer**: Node.js framework for Chrome/Chromium automation |
| 34 | |
| 35 | ### Tool Selection Guide |
| 36 | |
| 37 | | Tool | Primary Use | Key Advantages | |
| 38 | |------|-------------|----------------| |
| 39 | | **PyXA** | macOS-native control | Direct OS integration, Arc spaces | |
| 40 | | **Playwright** | Cross-browser testing | Auto-waiting, mobile emulation | |
| 41 | | **Selenium** | Legacy enterprise | Mature ecosystem, wide language support | |
| 42 | | **Puppeteer** | Headless Chrome | Fast execution, PDF generation | |
| 43 | |
| 44 | See `references/browser-compatibility-matrix.md` for detailed browser support. |
| 45 | |
| 46 | ## Getting Started |
| 47 | |
| 48 | 1. **Choose your framework** based on your needs (see Tool Selection Guide above) |
| 49 | 2. **Install dependencies** for your chosen framework |
| 50 | 3. **Follow framework-specific guides** linked below |
| 51 | 4. **Review workflows** for common automation patterns |
| 52 | |
| 53 | ## Framework Guides |
| 54 | |
| 55 | ### PyXA Browser Integration |
| 56 | - **Best for**: macOS-native browser control with Arc spaces support |
| 57 | - **Installation**: `pip install PyXA` |
| 58 | - **Guide**: `references/pyxa-integration.md` |
| 59 | |
| 60 | ### Playwright Automation |
| 61 | - **Best for**: Cross-browser testing with auto-waiting |
| 62 | - **Installation**: `pip install playwright && playwright install` |
| 63 | - **Guide**: `references/playwright-automation.md` |
| 64 | |
| 65 | ### Selenium WebDriver |
| 66 | - **Best for**: Legacy enterprise automation |
| 67 | - **Installation**: `pip install selenium` |
| 68 | - **Guide**: `references/selenium-webdriver.md` |
| 69 | |
| 70 | ### Puppeteer Node.js |
| 71 | - **Best for**: Headless Chrome with PDF generation |
| 72 | - **Installation**: `npm install puppeteer` |
| 73 | - **Guide**: `references/puppeteer-automation.md` |
| 74 | |
| 75 | ## Automation Workflows |
| 76 | |
| 77 | Complete workflow examples for common automation scenarios: |
| 78 | |
| 79 | ### Multi-Browser Tab Management |
| 80 | **Guide**: `references/workflows.md#workflow-1-multi-browser-tab-management` |
| 81 | |
| 82 | ### Automated Research and Data Collection |
| 83 | **Guide**: `references/workflows.md#workflow-2-automated-research-and-data-collection` |
| 84 | |
| 85 | ### Cross-Browser Testing Suite |
| 86 | **Guide**: `references/workflows.md#workflow-3-cross-browser-testing-suite` |
| 87 | |
| 88 | ### Web Scraping and Data Extraction |
| 89 | **Guide**: `references/workflows.md#workflow-4-web-scraping-and-data-extraction` |
| 90 | |
| 91 | ## Brief Automation Patterns |
| 92 | |
| 93 | ### Browser Launch and Profile Management |
| 94 | ```python |
| 95 | # PyXA approach for Chrome |
| 96 | chrome = PyXA.Application("Google Chrome") |
| 97 | chrome.new_window("https://example.com") |
| 98 | ``` |
| 99 | |
| 100 | ### Tab Organization and Grouping |
| 101 | ```python |
| 102 | # PyXA tab filtering |
| 103 | tabs = chrome.windows()[0].tabs() |
| 104 | work_tabs = [tab for tab in tabs if "meeting" in tab.title().lower()] |
| 105 | for tab in work_tabs: |
| 106 | tab.close() |
| 107 | ``` |
| 108 | |
| 109 | ### JavaScript Injection for Content Extraction |
| 110 | ```python |
| 111 | # PyXA JavaScript execution |
| 112 | content = tab.execute_javascript("document.body.innerText") |
| 113 | links = tab.execute_javascript("Array.from(document.querySelectorAll('a')).map(a => a.href)") |
| 114 | ``` |
| 115 | |
| 116 | ### Cross-Browser Synchronization |
| 117 | `` |