Does your company rely on browser automation or web scraping? We have a wild offer for our early customers! Read more →

How to Access Downloads

Rebrowser fully supports file downloading, emitting Chrome DevTools Protocol (CDP) events Page.downloadProgress and Page.downloadWillBegin just as you would experience in a local browser.

How It Works

When downloading files through Rebrowser, the process differs slightly from a local browser. Files are initially stored on the remote server where your browser instance is running. After download completion, there's a brief processing period (typically under 10 seconds). Once processed, files become available through our platform's download system.

Accessing Downloaded Files

You can retrieve your downloaded files through Dashboard / Runs or our API endpoint GET /runs. Both methods will provide you with a complete download link that you can use in your scripts or browser. Also, you can use GET /downloadRunFile with guid of the file.

Important Limitations

The file size limit is 50MB. Contact support for larger file requirements.

Files are stored for 24 hours and are automatically removed after this period.

Implementation Examples

Puppeteer

Here's how to listen for events in Puppeteer:

1
2
3
4
5
6
page._client().on('Page.downloadProgress', (params) => {
  console.log('Page.downloadProgress', params)
})
page._client().on('Page.downloadWillBegin', (params) => {
  console.log('Page.downloadWillBegin', params)
})

Playwright

Playwright handles downloads differently from Puppeteer. Since it can't access the remote file system directly, standard download events (like page.on('download', ...)) won't work.

To address this limitation, Rebrowser duplicates the download events at the browser level. Here's how to listen for these events in Playwright:

1
2
3
4
5
6
7
const browserCdp = await browser.newBrowserCDPSession()
browserCdp.on('Rebrowser.downloadProgress', (params) => {
  console.log('Rebrowser.downloadProgress', params)
})
browserCdp.on('Rebrowser.downloadWillBegin', (params) => {
  console.log('Rebrowser.downloadWillBegin', params)
})

Best Practices

  • Track file downloads by listening to CDP events in your script.
  • Store the file GUID for later retrieval through our API.
  • Ensure you download files within the 24-hour window.
  • Consider file size limitations when implementing download functionality.