BrowserProvider interface
Interface for custom browser provider implementations. Allows users to implement alternative download sources for browsers.
⚠️ IMPORTANT: Custom providers are NOT officially supported by Puppeteer.
By implementing this interface, you accept full responsibility for:
- Ensuring downloaded binaries are compatible with Puppeteer's expectations - Testing that browser launch and other features work with your binaries - Maintaining compatibility when Puppeteer or your download source changes - Version consistency across platforms if mixing sources
Puppeteer only tests and guarantees Chrome for Testing binaries.
Signature
export interface BrowserProvider
Example
class ElectronDownloader implements BrowserProvider {
supports(options: DownloadOptions): boolean {
return options.browser === Browser.CHROMEDRIVER;
}
getDownloadUrl(options: DownloadOptions): URL {
const platform = mapToPlatform(options.platform);
return new URL(
`v${options.buildId}/chromedriver-v${options.buildId}-${platform}.zip`,
'https://github.com/electron/electron/releases/download/',
);
}
getExecutablePath(options): string {
const ext = options.platform.includes('win') ? '.exe' : '';
return `chromedriver/chromedriver${ext}`;
}
}
Methods
Method | Description |
|---|---|
| getDownloadUrl(options) | Get the download URL for the requested browser. The buildId can be either an exact version (e.g., "131.0.6778.109") or an alias (e.g., "latest", "stable"). Custom providers should handle version resolution internally if they support aliases. Returns null if the buildId cannot be resolved to a valid version. The URL is not validated - download will fail later if URL doesn't exist. Can be synchronous for simple URL construction or asynchronous if version resolution/network requests are needed. |
| getExecutablePath(options) | Get the relative path to the executable within the extracted archive. |
| getName() | Get the name of this provider. Used for error messages and logging purposes. Remarks: This method is used instead of |
| supports(options) | Check if this provider supports the given browser/platform. Used for filtering before attempting downloads. Can be synchronous for quick checks or asynchronous if version resolution/network requests are needed. |