firecrawl-interact

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

firecrawl interact

firecrawl interact

Interact with scraped pages in a live browser session. Scrape a page first, then use natural language prompts or code to click, fill forms, navigate, and extract data.
在实时浏览器会话中与已爬取页面交互。首先爬取一个页面,随后即可通过自然语言提示或代码点击、填写表单、导航、提取数据。

When to use

适用场景

  • Content requires interaction: clicks, form fills, pagination, login
  • scrape
    failed because content is behind JavaScript interaction
  • You need to navigate a multi-step flow
  • Last resort in the workflow escalation pattern: search → scrape → map → crawl → interact
  • Never use interact for web searches — use
    search
    instead
  • 内容需要交互才能访问:点击、表单填写、分页、登录
  • scrape
    命令执行失败,因为内容需要通过JavaScript交互才能加载
  • 需要导航多步流程
  • 工作流升级模式的最后手段:搜索 → 爬取 → 映射 → 爬虫 → interact
  • 绝对不要使用interact执行网页搜索 —— 请使用
    search
    命令

Quick start

快速开始

bash
undefined
bash
undefined

1. Scrape a page (scrape ID is saved automatically)

1. Scrape a page (scrape ID is saved automatically)

firecrawl scrape "<url>"
firecrawl scrape "<url>"

2. Interact with the page using natural language

2. Interact with the page using natural language

firecrawl interact --prompt "Click the login button" firecrawl interact --prompt "Fill in the email field with test@example.com" firecrawl interact --prompt "Extract the pricing table"
firecrawl interact --prompt "Click the login button" firecrawl interact --prompt "Fill in the email field with test@example.com" firecrawl interact --prompt "Extract the pricing table"

3. Or use code for precise control

3. Or use code for precise control

firecrawl interact --code "agent-browser click @e5" --language bash firecrawl interact --code "agent-browser snapshot -i" --language bash
firecrawl interact --code "agent-browser click @e5" --language bash firecrawl interact --code "agent-browser snapshot -i" --language bash

4. Stop the session when done

4. Stop the session when done

firecrawl interact stop
undefined
firecrawl interact stop
undefined

Options

可选参数

OptionDescription
--prompt <text>
Natural language instruction (use this OR --code)
--code <code>
Code to execute in the browser session
--language <lang>
Language for code: bash, python, node
--timeout <seconds>
Execution timeout (default: 30, max: 300)
--scrape-id <id>
Target a specific scrape (default: last scrape)
-o, --output <path>
Output file path
OptionDescription
--prompt <text>
自然语言指令(与--code二选一使用)
--code <code>
要在浏览器会话中执行的代码
--language <lang>
代码使用的语言:bash、python、node
--timeout <seconds>
执行超时时间(默认:30秒,最大值:300秒)
--scrape-id <id>
指定目标爬取任务(默认使用最近一次爬取)
-o, --output <path>
输出文件路径

Profiles

配置文件

Use
--profile
on the scrape to persist browser state (cookies, localStorage) across scrapes:
bash
undefined
在爬取时使用
--profile
参数可在多次爬取之间持久化浏览器状态(Cookie、localStorage):
bash
undefined

Session 1: Login and save state

Session 1: Login and save state

firecrawl scrape "https://app.example.com/login" --profile my-app firecrawl interact --prompt "Fill in email with user@example.com and click login"
firecrawl scrape "https://app.example.com/login" --profile my-app firecrawl interact --prompt "Fill in email with user@example.com and click login"

Session 2: Come back authenticated

Session 2: Come back authenticated

firecrawl scrape "https://app.example.com/dashboard" --profile my-app firecrawl interact --prompt "Extract the dashboard data"

Read-only reconnect (no writes to profile state):

```bash
firecrawl scrape "https://app.example.com" --profile my-app --no-save-changes
firecrawl scrape "https://app.example.com/dashboard" --profile my-app firecrawl interact --prompt "Extract the dashboard data"

只读重连(不会写入配置文件状态):

```bash
firecrawl scrape "https://app.example.com" --profile my-app --no-save-changes

Tips

使用提示

  • Always scrape first —
    interact
    requires a scrape ID from a previous
    firecrawl scrape
    call
  • The scrape ID is saved automatically, so you don't need
    --scrape-id
    for subsequent interact calls
  • Use
    firecrawl interact stop
    to free resources when done
  • For parallel work, scrape multiple pages and interact with each using
    --scrape-id
  • 始终先执行爬取 ——
    interact
    需要来自之前
    firecrawl scrape
    调用生成的爬取ID
  • 爬取ID会自动保存,因此后续的interact调用不需要指定
    --scrape-id
  • 使用完毕后执行
    firecrawl interact stop
    释放资源
  • 如需并行工作,可先爬取多个页面,再通过
    --scrape-id
    分别与每个页面交互

See also

相关参考

  • firecrawl-scrape — try scrape first, escalate to interact only when needed
  • firecrawl-search — for web searches (never use interact for searching)
  • firecrawl-agent — AI-powered extraction (less manual control)
  • firecrawl-scrape —— 优先尝试scrape,仅在需要时升级使用interact
  • firecrawl-search —— 用于网页搜索(永远不要用interact执行搜索)
  • firecrawl-agent —— AI驱动的提取功能(手动控制更少)