-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (26 loc) · 827 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const puppeteer = require('puppeteer');
const fs = require('fs');
async function main() {
const browser = await puppeteer.launch({
args : [
'--disable-setuid-sandbox',
'--no-sandbox',
// '--single-process'
]
});
const page = await browser.newPage();
page.on('console', (msg) => {
for (let i = 0; i < msg.args().length; ++i) {
console.log(`${i}: ${msg.args()[i]}`);
}
});
page.on('error', err => console.log(err));
page.on('response', response => {
console.log(response.status());
console.log(response.url());
});
await page.goto('http://localhost:5000/index.html', { waitUntil : 'networkidle0' });
await page.close();
await browser.close();
}
main().then(() => process.exit(0));