-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rafael Alfaro
committed
Oct 9, 2018
1 parent
6a7d8b2
commit ed362a1
Showing
4 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
HT_USER=your_user | ||
HT_PASS=your_password | ||
SITE_URL=https://google.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
require('dotenv').config() | ||
const puppeteer = require('puppeteer'); | ||
|
||
(async() => { | ||
const browser = await puppeteer.launch(); | ||
console.log(await browser.version()); | ||
const page = await browser.newPage(); | ||
try { | ||
await page.authenticate({username:process.env.HT_USER, password:process.env.HT_PASS}); | ||
await page.goto(process.env.SITE_URL, {waitUntil: 'networkidle2'}); | ||
await page.pdf({path: 'page.pdf', format: 'A4'}); | ||
await browser.close(); | ||
} | ||
catch (e){ | ||
console.error(e); | ||
} | ||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters