石头

Web Form Automation

开发编程v1.0.0
作者:石头更新于 2026-05-17web-form-automation@clawhub_flyingzl/web-form-automation
脚本工具#Playwright

据 AlphaMoat 统计,截至 2026-10,Web Form Automation 累计下载 6,739 次、获 2 个星标,按累计下载量在本次参与排名的 10,914 个 AI 技能中排名第 4,224 位,在「开发编程」分类(1,069 个)中排名第 355 位。

列表默认按累计下载量排序,也可按星标排序;详情页排名按累计下载量计算。

累计下载
6,739
星标
2
全站下载量排名
#4,224
全站前 39% · 「开发编程」前 34%
平台累计下载星标评论
ClawHub ↗5,2471-
SkillHub ↗6,7392—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

会话管理支持从 JSON 文件恢复 cookies 与 localStorage/sessionStorage;文件上传最佳实践是先压缩图片(convert input.png output.webp,必要时 -resize 1024x1024),按主文对比原始 PNG 约 4MB、压缩 PNG 约 1MB、WebP 约 30-50KB(缩小 99%),上传后用 waitForTimeout(3000) 等待处理。文本输入应使用 pressSequentially() 而非 fill()——后者不触发 input 事件,可能无法激活提交按钮——必要时用 dispatchEvent 手动触发 input/change 事件;按钮可用 { force: true } 强制点击,并用 isEnabled()/isVisible() 检查状态。scripts/ 目录提供 webp-compress.sh 与通用提交模板 form-submit.js;故障排查覆盖按钮置灰(上传后等待 3 秒以上、用 pressSequentially)、上传超时(先压成 webp、缩小尺寸)与表单不提交(force 点击、核对选择器与必填项)。 输入文字应使用 pressSequentially(),而非 fill()。

资料发布于 2026-10-27

可以用来做什么

  • 自动登录并复用浏览器会话(cookies/localStorage)
  • 向网页表单上传压缩后的图片文件
  • 填写文本并可靠地提交表单

什么时候用

  • 需要自动化网站交互、上传文件、填写表单、点击按钮或提交数据时
  • 需要正确触发事件以保证表单可靠提交时

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

帮我把这张图压成 webp 再上传到表单
用会话文件登录后自动填写并提交这个表单
提交按钮一直置灰,帮我排查

月度数据趋势

累计下载6,739
3,0915,0507,0092026-03 · 累计下载 3,3612026-05 · 累计下载 4,2452026-07 · 累计下载 4,7402026-08 · 累计下载 4,9082026-09 · 累计下载 5,2092026-10 · 累计下载 6,73926-0326-0926-10
星标2
1222026-03 · 星标 12026-05 · 星标 22026-07 · 星标 22026-08 · 星标 22026-09 · 星标 22026-10 · 星标 226-0326-0926-10

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-106,739—2
2026-095,209—2
2026-084,908+3.5%2
2026-074,740—2
2026-054,245—2
2026-033,361—1

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

5.3 KB · ClawHub v1.0.0
---
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.
---

# Web Form Automation

Automate web form interactions reliably using Playwright with best practices for session management, file uploads, and form submission.

## Quick Start
展开全部(共 201 行)

```javascript
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 });
```

## Session Management

### Using Browser Session Data

When user provides a JSON file with session data:

```javascript
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);
```

## File Upload Best Practices

### Image Compression

Always compress images before upload for reliability:

```bash
# Convert to webp for best compression
convert input.png output.webp

# Or resize if needed
convert input.png -resize 1024x1024 output.webp
```

**Size comparison:**
- Original PNG: ~4MB
- Compressed PNG: ~1MB  
- WebP: ~30-50KB (99% smaller)

### Upload Sequence

```javascript
// 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);
```

## Text Input Best Practices

### Use pressSequentially, not fill()

❌ **Don't use fill()** - doesn't trigger input events:
```javascript
await textInput.fill('text'); // May not activate submit button
```

✅ **Use pressSequentially()** - simulates real typing:
```javascript
await textInput.pressSequentially('text', { delay: 30 });
```

### Trigger Events Manually (if needed)

```javascript
await page.evaluate(() => {
  const el = document.querySelector('textarea');
  el.dispatchEvent(new Event('input', { bubbles: true }));
  el.dispatchEvent(new Event('change', { bubbles: true }));
});
```

## Button Clicking

### Force Click When Disabled

If button appears disabled but should be clickable:

```javascript
await button.click({ force: true });
```

### Check Button State

```javascript
const isEnabled = await button.isEnabled();
const isVisible = await button.isVisible();
```

## Complete Example: Video Generation Form

```javascript
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();
}
```

## Scripts

The `scripts/` directory contains reusable automation scripts:

- `webp-compress.sh` - Convert images to webp format
- `form-submit.js` - Generic form submission template

## Troubleshooting

### Button stays gray/disabled
- Wait longer after file upload (3+ seconds)
- Ensure text input triggers events (use pressSequentially)
- Check if images are still uploading

### Upload times out
- Compress images to webp format first
- Reduce image dimensions if very large

### Form doesn't submit
- Use force: true for click
- Check button selector is correct
- Verify all required fields are filled

「开发编程」分类下的热门技能

编程大神.Skill开发编程

【全栈能力】编程大神.Skill:面向复杂真实项目的高阶全栈编程助手。不止生成代码,而是从一句目标接手陌生代码库,拆解需求、补齐实现、追到根因、完成重构、联调前后端,并把结果推进到能运行、能验证、能交付。覆盖 Web、后端、脚本、iOS、安卓、鸿蒙 ArkUI、微信小程序及其他技术栈,支持中英文工程、疑难 Bug、跨模块任务和长任务续做;用构建、日志、真实入口、设备或接口证据说明结果。仅问概念时直接回答,要求落地时持续推进到验收或明确阻塞。

↓ 1125.9万★ 82u_42bbb65f
编程专家Pro.Skill开发编程

编程专家 Pro:融合编程专家 2.0.3 工程专题与编程大神的鸿蒙 ArkTS/ArkUI、微信小程序和小游戏开发资料。用于项目实现、根因调试、审查、重构、测试、架构性能分析及多端开发验证。支持自然语言和 @专题标识,按任务读取包内知识;只问概念时直接回答。

↓ 626.9万★ 32user_47d655f0
编程专家.Skill开发编程

编程专家.Skill P8级编程助手,25年实战经验技能Skill,全栈:Java/Php网站/软件项目、API设计、Bug诊断、代码生成、代码审查、重构、测试用例、性能基准、技术选型、文档生成、任务拆解、Spec驱动、Karpathy规范、CMS二次开发、前端设计、MySQL/Mariadb、项目知识图谱,以及工程纪律层(根因调试硬闭环、阶段导航、事故复盘/SLO、威胁建模/供应链安全、生产就绪/渐进式发布、AI编码治理、面向Agent代码可读性、LLM应用安全)。支持 @标识 显式调用跳过路由。

↓ 600.7万★ 378user_741dc82b
dev-expert开发编程

编程专家.Skill P8级编程助手,25年实战经验技能Skill,全栈:Java/Php网站/软件项目、API设计、Bug诊断、代码生成、代码审查、重构、测试用例、性能基准、技术选型、文档生成、任务拆解、Spec驱动、Karpathy规范、CMS二次开发、前端设计、MySQL/Mariadb、项目知识图谱,以及工程纪律层(根因调试硬闭环、阶段导航、事故复盘/SLO、威胁建模/供应链安全、生产就绪/渐进式发布、AI编码治理、面向Agent代码可读性、LLM应用安全)。支持 @标识 显式调用跳过路由。

↓ 528.1万★ 32user_814dbe54
dev-expert-pro开发编程

编程专家 Pro:融合编程专家 2.0.3 工程专题与编程大神的鸿蒙 ArkTS/ArkUI、微信小程序和小游戏开发资料。用于项目实现、根因调试、审查、重构、测试、架构性能分析及多端开发验证。支持自然语言和 @专题标识,按任务读取包内知识;只问概念时直接回答。

↓ 104.7万★ -user_814dbe54
编程专家 Pro开发编程

编程专家 Pro:融合编程专家 2.0.3 工程专题与编程大神的鸿蒙 ArkTS/ArkUI、微信小程序和小游戏开发资料。用于项目实现、根因调试、审查、重构、测试、架构性能分析及多端开发验证。支持自然语言和 @专题标识,按任务读取包内知识;只问概念时直接回答。

↓ 98.2万★ 1user_28275a78
编程专家.Skill开发编程

编程专家.Skill P8级编程助手,25年实战经验技能Skill,全栈:Java/Php网站/软件项目、API设计、Bug诊断、代码生成、代码审查、重构、测试用例、性能基准、技术选型、文档生成、任务拆解、Spec驱动、Karpathy规范、CMS二次开发、前端设计、MySQL/Mariadb、项目知识图谱,以及工程纪律层(根因调试硬闭环、阶段导航、事故复盘/SLO、威胁建模/供应链安全、生产就绪/渐进式发布、AI编码治理、面向Agent代码可读性、LLM应用安全)。支持 @标识 显式调用跳过路由。

↓ 70.1万★ 6user_613b33ea
Github开发编程

用 gh 命令行工具查看 GitHub 上的 PR 检查、工作流运行与 API 查询的技能。

↓ 48.0万★ 714Peter Steinberger

数据月份:2026-10 · 下载/星标数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。