feat: add download CLI commands with ref support (#183)

* feat: add download and waitfordownload CLI commands

Add CLI support for the existing download functionality in the daemon:

- `download <selector> <path>`: Click an element to trigger download
  and save to specified path
- `wait --download [path] [--timeout ms]`: Wait for any download to
  complete, optionally save to path with configurable timeout

Includes comprehensive unit tests and help documentation.

* fix: download command ref support and output message

- Fix handleDownload to use browser.getLocator() for ref selector support
- Fix CLI output to show "Downloaded to" instead of "Screenshot saved"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Chris Tate <chris@ctate.dev>
This commit is contained in:
Namish pruthi
2026-01-22 08:55:19 -06:00
committed by GitHub
co-authored by Claude Opus 4.5 Chris Tate
parent 307f970d53
commit 55f4eaa728
3 changed files with 149 additions and 5 deletions
+2 -4
View File
@@ -1074,11 +1074,9 @@ async function handleDownload(
browser: BrowserManager
): Promise<Response> {
const page = browser.getPage();
const locator = browser.getLocator(command.selector);
const [download] = await Promise.all([
page.waitForEvent('download'),
page.click(command.selector),
]);
const [download] = await Promise.all([page.waitForEvent('download'), locator.click()]);
await download.saveAs(command.path);
return successResponse(command.id, {