Auditing
Videos
Playwright can record videos for all pages inside a Browser context, and they're saved once the browser context is closed.
Examples
const context = await browser.newContext({
recordVideo: {
dir: 'videos/',
size: { width: 800, height: 600 },
}
});
const context = await browser.newPage({
recordVideo: {
dir: 'videos/',
size: { width: 800, height: 600 },
}
});
Screeshots
Playwright can also take screenshots in any part of the code process.
Save screenshot
await page.screenshot({ path: 'capture.png' });
Save entire page
await page.screenshot({ path: 'capture.png', fullPage: true });
Save only an element
const elementHandle = await page.$('.container');
await elementHandle.screenshot({ path: 'capture.png' });