安装
步骤一:新建目录puppeteerProject
步骤二:初始化项目npm init
步骤三:npm i puppeteer (此处需要下载Chromium,如果下载失败更换为cnpm)

中途会下载Chromium,大小300M
保存路径\node_modules\puppeteer\.local-chromium\win64-588429\chrome-win32

配置相关

const browser = await puppeteer.launch({
  headless: false,                                                                             // default is true  打开运行界面 
  executablePath: 'C:/Users/Administrator/AppData/Local/Google/Chrome/Application/chrome.exe'  // 在正式的chrome浏览器中运行代码
  slowMo: 250                                                                                  // slow down by 250ms
});  

相关资料:
chrome headless
https://developers.google.cn/web/updates/2017/04/headless-chrome
https://developers.google.com/web/updates/2017/04/headless-chrom

puppeteer
https://github.com/GoogleChrome/puppeteer
https://github.com/GoogleChromeLabs/puppeteer-examples
https://www.npmjs.com/package/puppeteer

chrome金丝雀版
https://www.google.com/chrome/canary/

api
https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md

Puppeteer 入门教程
http://www.r9it.com/20171106/puppeteer.html

无头浏览器Puppeteer初探
https://juejin.im/post/59e5a86c51882578bf185dba

作者 铁血 汉子 2018年9月28日
2019/06/16/02:47:46am 2018/9/28/8:50:25
0 337