web-form-automationAutomate web form interactions including login, file upload, text input, and form submission using Playwright. Use when user needs to automate website intera...
Install via ClawdBot CLI:
clawdbot install flyingzl/web-form-automationAutomate web form interactions reliably using Playwright with best practices for session management, file uploads, and form submission.
const { chromium } = require('playwright');
// Basic form automation
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
await page.goto('https://example.com/form');
// Upload compressed images
await page.locator('input[type="file"]').setInputFiles('/path/to/image.webp');
// Type text (triggers events properly)
await page.locator('textarea').pressSequentially('Your text', { delay: 30 });
// Submit form
await page.locator('button[type="submit"]').click({ force: true });
When user provides a JSON file with session data:
const sessionData = JSON.parse(fs.readFileSync('session.json', 'utf8'));
// Set cookies before navigating
for (const cookie of sessionData.cookies || []) {
await context.addCookies([cookie]);
}
// Set localStorage/sessionStorage
await page.evaluate((data) => {
for (const [k, v] of Object.entries(data.localStorage || {})) {
localStorage.setItem(k, v);
}
}, sessionData);
Always compress images before upload for reliability:
# Convert to webp for best compression
convert input.png output.webp
# Or resize if needed
convert input.png -resize 1024x1024 output.webp
Size comparison:
// 1. Find file inputs
const fileInputs = await page.locator('input[type="file"]').all();
// 2. Upload with waiting time
await fileInputs[0].setInputFiles('/path/to/start.webp');
await page.waitForTimeout(3000); // Wait for upload to process
await fileInputs[1].setInputFiles('/path/to/end.webp');
await page.waitForTimeout(3000);
ā Don't use fill() - doesn't trigger input events:
await textInput.fill('text'); // May not activate submit button
ā Use pressSequentially() - simulates real typing:
await textInput.pressSequentially('text', { delay: 30 });
await page.evaluate(() => {
const el = document.querySelector('textarea');
el.dispatchEvent(new Event('input', { bubbles: true }));
el.dispatchEvent(new Event('change', { bubbles: true }));
});
If button appears disabled but should be clickable:
await button.click({ force: true });
const isEnabled = await button.isEnabled();
const isVisible = await button.isVisible();
const { chromium } = require('playwright');
const fs = require('fs');
async function submitVideoForm(sessionFile, startImage, endImage, prompt) {
const browser = await chromium.launch({
headless: true,
args: ['--no-sandbox']
});
const context = await browser.newContext();
const page = await context.newPage();
// Load session if provided
if (fs.existsSync(sessionFile)) {
const session = JSON.parse(fs.readFileSync(sessionFile, 'utf8'));
// Set cookies, localStorage...
}
// Navigate
await page.goto('https://example.com/video', {
waitUntil: 'domcontentloaded'
});
await page.waitForTimeout(3000);
// Upload images (webp compressed)
const inputs = await page.locator('input[type="file"]').all();
await inputs[0].setInputFiles(startImage);
await page.waitForTimeout(3000);
await inputs[1].setInputFiles(endImage);
await page.waitForTimeout(3000);
// Select options
await page.click('text=Seedance 2.0 Fast');
await page.click('text=15s');
// Type prompt
const textarea = page.locator('textarea').first();
await textarea.pressSequentially(prompt, { delay: 30 });
await page.waitForTimeout(2000);
// Submit
await page.locator('button[class*="submit"]').click({ force: true });
// Wait and screenshot
await page.waitForTimeout(5000);
await page.screenshot({ path: 'result.png' });
await browser.close();
}
The scripts/ directory contains reusable automation scripts:
webp-compress.sh - Convert images to webp formatform-submit.js - Generic form submission templateGenerated Mar 1, 2026
Automates the submission of video generation requests on platforms like RunwayML or Pika Labs. Uploads start and end frames as compressed WebP images, selects model parameters, inputs text prompts with proper event triggering, and submits forms to queue video renders, saving manual effort for content creators.
Streamlines bulk product uploads to e-commerce sites such as Shopify or WooCommerce. Automates form filling for product details, uploads optimized product images in WebP format to reduce load times, and submits listings efficiently, enabling faster inventory management for online retailers.
Automates the process of applying to multiple job postings on career websites like LinkedIn or Indeed. Fills in personal information, uploads resumes and cover letters, and submits applications with session management to maintain login states, reducing time spent on repetitive tasks for job seekers.
Automates posting content to social media platforms such as Facebook or Instagram via their web interfaces. Uploads compressed images or videos, writes captions with simulated typing to trigger events, and schedules posts by submitting forms, aiding social media managers in batch content management.
Automates the completion of online surveys or data entry forms for research or lead generation. Inputs text responses, uploads supporting documents like images, and submits forms reliably with proper button clicks, useful for market researchers or data analysts collecting large datasets.
Offer a subscription-based service where users pay monthly to access automated form submission features. Provide templates for common platforms like e-commerce or social media, with analytics on time saved and success rates, targeting small businesses and freelancers.
Provide bespoke automation solutions for enterprises needing tailored web form interactions. Develop and deploy scripts specific to client workflows, such as video generation or product uploads, with ongoing support and maintenance contracts.
Release a free browser extension with basic automation features like form filling and image uploads, monetized through premium upgrades for advanced capabilities such as session management and batch processing. Attract individual users and upsell to teams.
š¬ Integration Tip
Integrate this skill by ensuring Playwright is installed in your environment and using the provided scripts for image compression and session management to handle complex form interactions reliably.
A fast Rust-based headless browser automation CLI with Node.js fallback that enables AI agents to navigate, click, type, and snapshot pages via structured commands.
Automate web browser interactions using natural language via CLI commands. Use when the user asks to browse websites, navigate web pages, extract data from websites, take screenshots, fill forms, click buttons, or interact with web applications.
Advanced desktop automation with mouse, keyboard, and screen control
Manage n8n workflows and automations via API. Use when working with n8n workflows, executions, or automation tasks - listing workflows, activating/deactivating, checking execution status, manually triggering workflows, or debugging automation issues.
Design and implement automation workflows to save time and scale operations as a solopreneur. Use when identifying repetitive tasks to automate, building workflows across tools, setting up triggers and actions, or optimizing existing automations. Covers automation opportunity identification, workflow design, tool selection (Zapier, Make, n8n), testing, and maintenance. Trigger on "automate", "automation", "workflow automation", "save time", "reduce manual work", "automate my business", "no-code automation".
Browser automation via Playwright MCP server. Navigate websites, click elements, fill forms, extract data, take screenshots, and perform full browser automation workflows.