by PromptSpace
Bypass OS-native file upload dialogs in browser automation using JavaScript interception and DataTransfer injection.
$5
One-time purchase
by PromptSpace
Bypass OS-native file upload dialogs in browser automation using JavaScript interception and DataTransfer injection.
$5
One-time purchase
⚡ Skill ready to install in Claude Code, Gemini CLI, or any MCP-compatible client. Read the install guides →
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.
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.
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.
mkdir -p ~/.claude/skills/bypass-macos-file-dialog && curl -s -X POST 'https://api.promptspace.in/api/skills/bypass-macos-file-dialog/install' | python3 -c "import sys,json; sys.stdout.write(json.load(sys.stdin).get('installInstructions') or '')" > ~/.claude/skills/bypass-macos-file-dialog/SKILL.mdFree skills install directly. Paid skills require purchase - use the download button above after buying.
Security Scanned
Passed automated security review
No special permissions declared or detected
OpenClaw, Cursor, Claude Code, Codex CLI
PromptSpace
We build AI agent skill packages for content creators. Specializing in Chinese social media automation.