Puppeteer node 瞬秒安装 亲测可用!
Puppeteer 最难得不是如何自动化,而是安装,这个包你就装不上,后面还看什么~~
今天看了一篇文章,非常好,走了一遍流程,瞬秒能用,赶紧放上来
- 建立目录 myPuppeteer
- npm init -y
- npm i puppeteer --ignore-scripts
- https://download-chromium.appspot.com/ 下载chrome包并解压到项目根目录 chrome-win 注意这里可能需要梯子
- demo.js
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
executablePath: 'chrome-win\\chrome.exe',
args: ['--no-sandbox'],
dumpio: false
});
const page = await browser.newPage();
await page.goto('https://www.baidu.com');
await page.screenshot({path: 'example.png'});
await browser.close();
})();
https://download-chromium.appspot.com/
vscode项目截图
Reference:
Puppeteer 安装及失败原因
https://www.cnblogs.com/zhangyaolan/p/12590028.html