#8282: Fix: Enable browser downloads via CDP Browser.setDownloadBehavior
stale
Cluster:
Browser Enhancements and Fixes
Fixes #8268
The OpenClaw browser profile couldn't download files because the required CDP command Browser.setDownloadBehavior was never called during browser launch.
Changes:
- Added resolveDownloadPath() to determine the user's Downloads folder (supports macOS, Windows, and Linux with XDG_DOWNLOAD_DIR)
- Added CDP call to Browser.setDownloadBehavior after Chrome is ready
- Downloads are now enabled with behavior: "allow" and eventsEnabled: true
- Added error handling with log warnings if CDP call fails
The fix automatically configures downloads to the user's default Downloads folder on browser launch, eliminating the need for manual CDP commands.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR enables file downloads for the OpenClaw-managed Chrome profile by issuing the CDP `Browser.setDownloadBehavior` command after launch. It adds a helper to pick a default downloads directory and wires in a one-time CDP WebSocket call once the browser’s CDP endpoint is reachable.
Overall this fits cleanly into the existing CDP readiness/launch flow in `src/browser/chrome.ts`, reusing the repo’s CDP helpers (`withCdpSocket`) rather than introducing new protocol plumbing.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge; main risk is edge-case failures in download directory resolution/creation that can keep downloads broken on some systems.
- Change is localized to browser launch and uses existing CDP socket helper; however the Linux XDG download path value may need expansion and the target directory isn’t ensured to exist before calling CDP, both of which can cause the feature to silently fail in real environments.
- src/browser/chrome.ts
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#8303: fix(browser): enable downloads via CDP Browser.setDownloadBehavior
by gavinbmoore · 2026-02-03
89.1%
#13568: Fix browser (OpenClaw-managed) launch fail by binding remote debugg...
by singlag · 2026-02-10
79.4%
#6193: fix(browser): default to openclaw profile instead of chrome extensi...
by mikezaoldyeck · 2026-02-01
77.2%
#14944: fix(browser): prefer openclaw profile in headless/noSandbox environ...
by BenediktSchackenberg · 2026-02-12
76.8%
#8614: fix(browser): detect early chromium exit to prevent startup hang
by Wren-OC · 2026-02-04
76.7%
#9020: fix(browser): skip port ownership and WS reachability checks for re...
by yepack · 2026-02-04
76.7%
#7157: docs(browser): recommend openclaw managed profile as default
by AkashaBot · 2026-02-02
73.5%
#9398: Fix browser extension install path calculation
by vishaltandale00 · 2026-02-05
73.3%
#15595: fix(browser): avoid local port conflicts for remote cdp
by TsekaLuk · 2026-02-13
73.1%
#9796: fix(cli): correct fallback path for bundled Chrome extension (#9772)
by lailoo · 2026-02-05
72.6%