fix(scrape): treat --full-page-screenshot as the screenshot format

BR
21d ago
+87-3

What's wrong

--full-page-screenshot goes into the request but not into the output formats. The flag also doesn't replace a plain screenshot format. This causes two failures:

  1. firecrawl scrape https://example.com --full-page-screenshot prints only the markdown. The API returns a screenshot URL, but the CLI never shows it, so the user pays for a screenshot they never see. --screenshot works because handleScrapeCommand adds screenshot to the output formats for that flag only.
  2. firecrawl scrape https://example.com -f screenshot --full-page-screenshot sends formats: ["screenshot", {"type":"screenshot","fullPage":true}]. The v2 scrape schema has the refine You may only specify one screenshot format, so the command fails with that error.

Reproduced against a local fake /v2/scrape that applies the same one-screenshot rule:

$ firecrawl scrape https://example.com --full-page-screenshot --api-url http://127.0.0.1:38471
# Hello
$ firecrawl scrape https://example.com -f screenshot --full-page-screenshot --api-url http://127.0.0.1:38471
Error: You may only specify one screenshot format

Fix

  • executeScrape: when fullPageScreenshot is set, drop a plain screenshot entry before adding { type: 'screenshot', fullPage: true }.
  • handleScrapeCommand: count fullPageScreenshot as a screenshot when choosing the output shape, the same way --screenshot is counted. handleAllScrapeCommand already does this.

After the fix the two commands above print {"markdown":"# Hello","screenshot":"https://…"} and the formatted Screenshot: https://… block.

Tests

Two new cases in src/__tests__/commands/scrape.test.ts:

  • --format markdown,screenshot plus fullPageScreenshot sends exactly one screenshot format.
  • handleScrapeCommand with fullPageScreenshot prints the screenshot URL next to the markdown.

Both fail on main and pass with the fix. pnpm run format:check, pnpm run type-check, pnpm run build and pnpm test (642 tests) pass.


This PR was prepared with an AI coding agent (Claude). I reproduced the bug and checked the fix and tests before opening it.


Summary by cubic

Fixes --full-page-screenshot so the screenshot URL is included in CLI output instead of being silently dropped. The flag now replaces any plain screenshot output format, preventing the "You may only specify one screenshot format" API error.