[英]How to know the chromium path used by puppeteer?
我在我的 debian 服務器上安裝了 puppeteer,我正在嘗試通過 php 使用它:
print shell_exec("node pptscript.js");
pptscript.js:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://www.google.com');
await page.screenshot({path: '/var/www/web/example.png'});
await browser.close();
})();
但它不起作用,我沒有 output。
我在某處讀到 chmoding 到 777 鉻可執行文件可以解決問題,因為用戶 www-data 無權執行它。 但我不知道它在哪里。
browser
有一個名為process()
的內部 function ,它返回一個ChildProcess 。 您可以閱讀該ChildProcess
的spawnfile
屬性。
console.log(browser.process().spawnfile);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.