I want to capture what my puppeteer script does when it runs on my server. I found this package that should help me record the browser activity but I’m running into some issues.
Here’s my current setup:
const puppeteer = require('puppeteer');
const { record } = require('puppeteer-recorder');
var outputPath = 'D:\\projects\\automation\\videos\\';
startBrowser();
let mainBrowser;
async function startBrowser() {
mainBrowser = await puppeteer.launch({
headless: false,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
performLogin();
}
async function performLogin() {
try {
const newPage = await mainBrowser.newPage();
await newPage.setViewport({width: 1200, height: 800});
await record({
browser: mainBrowser,
page: newPage,
output: outputPath + 'recording.webm',
fps: 30,
frames: 30 * 10, // 10 seconds recording
prepare: function () {},
render: function () {}
});
await newPage.goto('https://www.testsite.com', {timeout: 30000})
.catch(function (err) {
throw new Error('NavigationTimeout');
});
await newPage.close();
} catch (error) {
console.log('BROWSER ERROR:');
console.log(error);
}
}
But I keep getting this error about ffmpeg not being found and stream issues. I tried installing ffmpeg but it still doesn’t work. What am I missing here?