bypass-macos-file-dialog
Bypass OS-native file upload dialogs in browser automation using JavaScript interception and DataTransfer injection.
skill install https://www.promptspace.in/skills/bypass-macos-file-dialogWhat it does
This skill provides a battle-tested programmatic workaround for one of the most persistent hurdles in browser automation: the OS-native file upload dialog. Whether you are using Playwright, Puppeteer, Selenium, or Claude's computer-use, clicking a file upload button typically triggers a macOS, Windows, or Linux file picker that freezes automation and requires manual intervention.
This developer-centric tool uses a JavaScript interception technique to bypass the native UI entirely. It overrides the HTMLInputElement.prototype.click method to inject file data directly into the browser's DOM using the DataTransfer API, triggering a synthetic change event that web frameworks recognize as a valid user upload.
Why use this skill
- Zero Manual Intervention: Fully automates file uploads without getting stuck on system-level popups.
- Framework Agnostic: Works seamlessly with React, Angular, Vue, Polymer (YouTube Studio), and jQuery.
- Cross-Platform: Bypasses dialogs on macOS Finder, Windows Explorer, and Linux file managers.
- Invisible to Apps: Sophisticated injection makes the programmatic upload indistinguishable from a real user action.
- Reliable Content Staging: Includes specific patterns for handling large text files, binary data via Base64, and multi-file uploads.
Supported Workflows
The skill is designed for developers building automated scrapers, content uploaders, or RPA bots. It is particularly effective for complex sites like YouTube Studio or enterprise internal tools where input.value assignment is blocked by security headers.
Use cases
- Automate YouTube subtitle uploads without manual Finder interaction
- Inject files into Puppeteer/Playwright scripts when .setInputFiles() fails
- Programmatically upload large CSV/JSON datasets to web dashboards
- Bypass security-restricted file inputs in React and Angular applications
- Upload files (text base not PDF or MP4 etc) to websites without getting blocked when MacOS file upload window appears.
Example
Prompt
Sample output preview is available after purchase.
Known limitations
Text-Based Files Only: Out of the box, the Python preparation script (prepare_injection.py) reads files using UTF-8 encoding. This means it works perfectly for text-based files (CSV, JSON, TXT, XML, scripts, sbv etc.), but will throw an encoding error if you try to process binary files like .mp4 videos, .pdf documents, or images (.jpg, .png). File Size Constraints: Because this technique works by injecting the entire file's content into the browser's memory as a JavaScript string, it is not suitable for massive files (e.g., gigabyte-sized video files). Attempting to inject extremely large files may cause the browser tab to run out of memory or crash the automation framework's DevTools protocol. Single-Shot Execution: The JavaScript interceptor is designed to consume the payload upon use (window.__pendingFile = null; after the click). If your automation needs to upload multiple files in a row, you must re-inject the new file payload before each click. Strict Execution Order: The JavaScript interceptor (interceptor.js) must be executed in the browser's DOM before the automation tool clicks the upload trigger. If the click happens first, the OS dialog will still open and block the thread.