Automate web form interactions including login, file upload, text input, and form submission using Playwright. Use when user needs to automate website intera...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install web-form-automation或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install web-form-automation⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/web-form-automation/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: web-form-automation description: Automate web form interactions including login, file upload, text input, and form submission using Playwright. Use when user needs to automate website interactions, upload files to web forms, fill out forms with text input, click buttons, or submit data to web applications. Supports session management via cookies, compressed image uploads (webp), and proper event triggering for reliable form submission. ---
Automate 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 template安装 Web Form Automation 后,可以对 AI 说这些话来触发它
Help me get started with Web Form Automation
Explains what Web Form Automation does, walks through the setup, and runs a quick demo based on your current project
Use Web Form Automation to automate web form interactions including login, file upload, text i...
Invokes Web Form Automation with the right parameters and returns the result directly in the conversation
What can I do with Web Form Automation in my developer & devops workflow?
Lists the top use cases for Web Form Automation, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/web-form-automation/ 目录(个人级,所有项目可用),或 .claude/skills/web-form-automation/(项目级)。重启 AI 客户端后,用 /web-form-automation 主动调用,或让 AI 根据上下文自动发现并使用。
Web Form Automation 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Web Form Automation 可免费安装使用。请查阅仓库了解许可证信息。
Automate web form interactions including login, file upload, text input, and form submission using Playwright. Use when user needs to automate website intera...
Web Form Automation 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Web Form Automation
Identifies repetitive steps in your workflow and sets up Web Form Automation to handle them automatically