当前位置: 首页 > Skill >

browser-file-uploa

browser-file-uploa

browser-file-uploa

通过 agent-browser CLI 或 Python 脚本自动化网页文件上传,支持灵活的文件路径和可选的文件输入选择器。

1.0.0 2026.11.17 114
获取Skill文件查看使用说明
作 者:苏景 许可证: 更新时间:2026.11.17
本文目录展开

Browser File Upload

Automates file uploads to web pages using agent-browser CLI.

Quick Start

Upload a file to a web page:

# Basic upload (auto-detects file input)
agent-browser open <url>
agent-browser find text 选择文件 click
agent-browser upload "#filePicker" <file-path>

# Or use the Python script
python scripts/upload_file.py <url> <file-path>

Usage Patterns

Upload to Specific Selector

When you know the file input selector:

agent-browser open https://example.com/upload
agent-browser click "#fileInput"
agent-browser upload "#fileInput" C:pathtofile.xlsx

Upload by Text Search

When file input has visible label text:

agent-browser open https://example.com/upload
agent-browser find text "上传文件" click
agent-browser upload "[type=file]" C:pathtofile.xlsx

Using Python Script

For reusable upload logic with flexible path specification:

python scripts/upload_file.py <url> <file-path> [selector] [wait_ms]

Arguments:

  • url - Target page URL
  • file-path - Path to file (supports multiple formats, see below)
  • selector - Optional CSS selector for file input
  • wait_ms - Optional wait time after page load (default: 2000)

File Path Formats

The Python script supports multiple path formats:

Format Example Description
Absolute C:Usersnamefile.xlsx Full path
Relative ./data/file.xlsx Relative to current directory
Workspace workspace/file.xlsx Relative to OPENCLAW_WORKSPACE
Env Var ${HOME}/file.xlsx Environment variable
Windows Env %USERPROFILE%file.xlsx Windows environment variable

Path Examples

# Absolute path
python scripts/upload_file.py https://example.com C:Users陈Documentsdata.xlsx

# Relative path (from workspace)
python scripts/upload_file.py https://example.com ./test.xlsx

# Workspace-relative
python scripts/upload_file.py https://example.com workspace/data/test.xlsx

# With environment variable
python scripts/upload_file.py https://example.com ${HOME}/downloads/file.xlsx

Common Selectors

Selector Description
#filePicker Common id for file inputs
[type=file] Any file input element
input[type=file] Explicit file input
.upload-zone Drop zone containers

Troubleshooting

File input not found:

  • Run agent-browser snapshot to inspect page elements
  • Look for [type=file] or file-related buttons
  • Try clicking the upload zone first

Upload fails:

  • Ensure file path is absolute
  • Check file exists: test-path <file-path>
  • Try agent-browser find text 选择文件 click first

Page not loaded:

  • Add agent-browser wait 2000 after open
  • Use agent-browser wait --load networkidle for slow pages

Related Commands

# Inspect page elements
agent-browser snapshot

# Take screenshot
agent-browser screenshot

# Find elements by text
agent-browser find text "上传"

# Click element
agent-browser click <selector>

# Upload file
agent-browser upload <selector> <file-path>

Example: Upload Excel to UU Tool

# Method 1: Direct agent-browser commands
agent-browser open https://uutool.cn/excel/
agent-browser wait 2000
agent-browser find text 选择文件 click
agent-browser upload "#filePicker" C:Users陈.openclawworkspacetest.xlsx

# Method 2: Using Python script with absolute path
python scripts/upload_file.py https://uutool.cn/excel/ C:Users陈.openclawworkspacetest.xlsx

# Method 3: Using Python script with workspace-relative path
python scripts/upload_file.py https://uutool.cn/excel/ workspace/test.xlsx

# Method 4: Using Python script with custom selector and wait time
python scripts/upload_file.py https://uutool.cn/excel/ workspace/test.xlsx "#filePicker" 3000

相关文章

更多
agent-browser 使用指南:@e 引用操作与常见问题

agent-browser 是 superpowers 仓库中的浏览器自动化 Skill,通过无头浏览器将可交互元素整理为带 @e 编号的快照,使智能体无需猜测选择器即可直接操作。该技能依赖 Playwright 驱动,适用于动态渲染页面核对、折叠面板展开等场景。使用时需注意页面重渲染会导致旧编号失效,需重新获取快照;对于静态 HTML 读取或高频抓取,直接使用 fetch 请求更为高效。

2026.11.08 397
Skill 文件
  • SKILL.md
    • Browser File Upload
    • Quick Start
    • Usage Patterns
      • Upload to Specific Selector
      • Upload by Text Search
      • Using Python Script
    • File Path Formats
      • Path Examples
    • Common Selectors
    • Troubleshooting
    • Related Commands
    • Example: Upload Excel to UU Tool
  • 项目或源文件

相关 Skill

更多
upload-file upload-file MUST be used for any browser file upload task. Provides reliable, step-by-step automation for uploading files via agent-browser CLI. Includes strict executio...
SkillHub 发布助手 SkillHub 发布助手 将自研的 WorkBuddy Skill 发布/上架到 SkillHub(BuiltinMarket 官方市场)的完整工作流。当用户说“发布 Skill”、“上架到市场”、“提交到 SkillHub”或想把自研 Skill 分享给他人安装时使用。涵盖浏览器自动化发布(agent-browser)与常见坑位(zip 专用 input 选择器、登录态复用、守护进程崩溃重试)。
Agent Browser Cli.Bak.Skip Agent Browser Cli.Bak.Skip 使用 agent-browser CLI 实现浏览器自动化,适用于签到、填表、截图、信息抓取等场景。触发条件:1)用户请求自动化浏览器操作;2)需要签到、填表或点击按钮;3)需抓取网页内容作为研究素材。
publish to all your social media! publish to all your social media! Compose and schedule cross-platform social posts on Fedica (X, LinkedIn, Threads, Mastodon, Bluesky) via agent-browser. Handles login, image upload, scheduli...
sunsetbot-watch sunsetbot-watch 全自动 sunsetbot 晚霞查询,使用 agent-browser 访问 sunsetbot.top 网站,自动解析页面,输出指定城市当天晚霞的鲜艳度和气溶胶质量。触发场景:用户需要查询某个城市今天/明天晚霞概率,查询 sunsetbot 晚霞预报。