为什么我的浏览器无法加载 Chrome?我收到错误:
该消息是无法启动浏览器进程!生成 /Applications/GoogleChrome.app ENOENT 故障排除: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
节点版本 v13.12.0
const browser = await puppeteer.launch({executablePath:'/Applications/Google\Chrome.app'});
const page = await browser.newPage();
await page.goto('https://my.gumtree.com/login', {waitUntil: 'networkidle2'});
const myButton = await page.$('#google-sign-in-button');
myButton.click();
Run Code Online (Sandbox Code Playgroud)
如果您想使用已安装的 chronium 启动 puppeteer,则需要设置executablePath. 所以请检查chronium的确切路径。
chrome://version/在 Chrome 中浏览。executablePath.const browser = await puppeteer.launch({executablePath:'your executable Path'});
const page = await browser.newPage();
await page.goto('https://my.gumtree.com/login', {waitUntil: 'networkidle2'});
const myButton = await page.$('#google-sign-in-button');
myButton.click();Run Code Online (Sandbox Code Playgroud)