Skip to content

Commit

Permalink
better timing sync
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasbluecrew committed Jan 31, 2024
1 parent 0338cdd commit 7cdb8e3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const url = process.argv[2];
const customUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36';
const records = [];

await page.setCacheEnabled(false);
await page.setUserAgent(customUA);

page.on('response', async response => {
Expand Down Expand Up @@ -55,8 +56,9 @@ const url = process.argv[2];
});

const recorder = new PuppeteerScreenRecorder(page);
const reportName = `report_${new Date().toUTCString()}`;
await recorder.start(`${reportName}.mp4`); // supports extension - mp4, avi, webm and mov
const startTimestamp = Date.now();
await recorder.start(`report_${startTimestamp.toString()}.mp4`); // supports extension - mp4, avi, webm and mov
console.log(`Going to ${url}`)
page.goto(url);

Expand All @@ -75,7 +77,7 @@ const url = process.argv[2];
};

const reportJson = JSON.stringify(report, null, 2);
const reportPath = `report_${startTimestamp.toString()}.json`
const reportPath = `${reportName}.json`
fs.writeFileSync(reportPath, reportJson);
console.log(`Recorded to ${reportPath}`)

Expand Down

0 comments on commit 7cdb8e3

Please sign in to comment.