Back to Puppeteer

BrowserProvider.getExecutablePath() method

docs/browsers-api/browsers.browserprovider.getexecutablepath.md

19.2.21009 B
Original Source

BrowserProvider.getExecutablePath() method

Get the relative path to the executable within the extracted archive.

Signature

typescript
interface BrowserProvider {
  getExecutablePath(options: {
    browser: Browser;
    buildId: string;
    platform: BrowserPlatform;
  }): Promise<string> | string;
}

Parameters

<table><thead><tr><th>

Parameter

</th><th>

Type

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

options

</td><td>

{ browser: Browser; buildId: string; platform: BrowserPlatform; }

</td><td>

Browser, buildId, and platform

</td></tr> </tbody></table>

Returns:

Promise<string> | string

Relative path to the executable

Example

ts
// Electron uses simple structure
getExecutablePath() {
  return 'chromedriver/chromedriver';
}

// Custom provider with platform-specific paths
getExecutablePath(options) {
  return `binaries/${options.browser}-${options.platform}`;
}