Some checks failed
Tests / Tests (push) Has been cancelled
ESLint Check / ESLint Check and Report Upload (push) Has been cancelled
Prettier Check / Format Check (push) Has been cancelled
Prettier Check / Format Code (push) Has been cancelled
ESLint Check / Build Base for Bundle Size Comparison (push) Has been cancelled
47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
const puppeteer = require('puppeteer-core');
|
|
|
|
(async () => {
|
|
const browser = await puppeteer.launch({
|
|
headless: true,
|
|
executablePath: 'C:\\Users\\xgp\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe',
|
|
args: ['--allow-file-access-from-files', '--disable-web-security']
|
|
});
|
|
|
|
const page = await browser.newPage();
|
|
|
|
page.on('response', async r => {
|
|
const s = r.status();
|
|
const url = r.url();
|
|
if (s >= 400) {
|
|
console.log('ERROR', s, url);
|
|
} else if (s >= 300) {
|
|
console.log('REDIRECT', s, url);
|
|
} else {
|
|
console.log('SUCCESS', s, url.split('/').pop());
|
|
}
|
|
});
|
|
|
|
page.on('requestfailed', req => {
|
|
console.log('REQUEST FAILED', req.failure().errorText, req.url());
|
|
});
|
|
|
|
page.on('request', req => {
|
|
console.log('REQUEST', req.url().split('/').pop());
|
|
});
|
|
|
|
page.on('console', msg => {
|
|
console.log('CONSOLE', msg.type(), msg.text());
|
|
});
|
|
|
|
await page.goto('file:///C:/Users/xgp/projects/rrweb/index.html', {
|
|
waitUntil: 'networkidle2',
|
|
timeout: 120000
|
|
});
|
|
|
|
await new Promise(r => setTimeout(r, 3000));
|
|
|
|
await browser.close();
|
|
})().catch(e => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
}); |