MCPcopy
hub / github.com/ampproject/amphtml / locateChromeExecutablePath

Function locateChromeExecutablePath

build-system/tasks/visual-diff/browser.js:26–39  ·  view source on GitHub ↗

* Attempts to locale the full executable path for Chrome/Chromium. * @return {string}

()

Source from the content-addressed store, hash-verified

24 * @return {string}
25 */
26function locateChromeExecutablePath() {
27 if (argv.executablePath) {
28 return argv.executablePath;
29 }
30 for (const executableBaseName of CHROME_BASENAMES) {
31 const executablePath = getStdout(`which ${executableBaseName}`).trim();
32 if (executablePath) {
33 return executablePath;
34 }
35 }
36 throw new Error(
37 `Could not locate Chrome/Chromium executable. Make sure it is on your $PATH (looking for any of {${CHROME_BASENAMES.join(', ')}}) or pass --executablePath to amp visual-diff`
38 );
39}
40
41/**
42 * Launches a Puppeteer controlled browser.

Callers 2

launchPercyAgentFunction · 0.85
launchBrowserFunction · 0.85

Calls 1

getStdoutFunction · 0.85

Tested by

no test coverage detected