[英]What is default executablePath in Puppeteer?
This initialization works well even if we are not passing executablePath
in LaunchOptions
in puppeteer.launch()
即使我们没有在LaunchOptions
puppeteer.launch()
的 LaunchOptions 中传递executablePath
,这个初始化也能正常工作
const browser = await puppeteer.launch();
What is default value of executablePath
? executablePath
的默认值是多少?
The default value of the executablePath
option in the puppeteer.launch()
function is null
. puppeteer.launch()
函数中executablePath
选项的默认值为null
。 This means that Puppeteer will use the default installation of Chrome or Chromium on the system to launch the browser.这意味着 Puppeteer 将使用系统上默认安装的 Chrome 或 Chromium 来启动浏览器。
If you have multiple versions of Chrome or Chromium installed on your system, or if you want to use a specific version of the browser, you can specify the path to the executable in the 'executablePath' option.如果您的系统上安装了多个版本的 Chrome 或 Chromium,或者如果您想使用特定版本的浏览器,则可以在“executablePath”选项中指定可执行文件的路径。 For example:例如:
const browser = await puppeteer.launch({
executablePath: '/path/to/chrome'
});
If you do not specify a value for the executablePath
option, Puppeteer will try to find the default installation of Chrome or Chromium on the system.如果您没有为executablePath
选项指定值,Puppeteer 将尝试在系统上查找 Chrome 或 Chromium 的默认安装。 On Windows, this is usually C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
.在 Windows 上,这通常是C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
。 On macOS and Linux, Puppeteer will try to use the chrome or chromium executable in the PATH
.在 macOS 和 Linux 上,Puppeteer 将尝试在PATH
中使用 chrome 或 chromium 可执行文件。
The path will change based on the platform that you install puppeteer on.该路径将根据您安装 puppeteer 的平台而改变。
https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer/src/node/install.ts https://github.com/puppeteer/puppeteer/blob/main/packages/puppeteer/src/node/install.ts
has methods for finding that path.有找到那条路径的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.