Generate HAR file with puppeteer.
npm install puppeteer-har-fetch
const puppeteer = require('puppeteer');
const PuppeteerHar = require('puppeteer-har');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
const har = new PuppeteerHar(page);
await har.start({ path: 'results.har' });
await page.goto('http://example.com');
await har.stop();
await browser.close();
})();
page
<Page>
options
<?Object> Optionalpath
<string> If set HAR file will be written at this pathsaveResponse
<[bool]> Save response bodies to the HAR filecaptureMimeTypes
<[Array]> An array of MIME types to capture. Defaults to "['text/html', 'application/json']". Including "*" causes all MIME types to be captured.useFetch
<[bool]> Will save response bodies using experimental Fetch domain.
- returns: <Promise>