Skip to content

Instantly share code, notes, and snippets.

@kjk kjk/pupdl.js
Created Nov 17, 2019

What would you like to do?
puppeteer download page (made with
'use strict';
const puppeteer = require('puppeteer');
const fs = require('fs');
(async function main() {
try {
const browser = await puppeteer.launch();
const [page] = await browser.pages();
const uri = '';
await page.goto(uri, {
waitUntil: 'networkidle2'
const data = await page.content()
//const cdp = await;
//const { data } = await cdp.send('Page.captureSnapshot', { format: 'mhtml' });
fs.writeFileSync('page.html', data);
await browser.close();
} catch (err) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.