Playwright Screenshots Videos
# Playwright Screenshots and Videos
This chapter introduces how to use Playwright for screenshots and video recording, helping you quickly locate issues when tests fail.
* * *
## page.screenshot() Screenshot
### Full Page Screenshot
## Example
// Save to file
await page.screenshot({ path:'screenshots/tutorial-homepage.png'});
// Get Buffer data (use directly, no file written)
const buffer = await page.screenshot();
### Screenshot Options
## Example
await page.screenshot({
path:'screenshots/full-page.png',
fullPage:true,// Capture entire page (not just viewport)
type:'png',// Format: 'png' (default) or 'jpeg'
quality:90,// JPEG quality (0-100, JPEG only)
clip:{// Crop area
x:0,
y:0,
width:800,
height:600,
},
animations:'disabled',// Disable CSS animations (more stable screenshots)
omitBackground:false,// Whether to hide default background
});
### Element Screenshot
## Example
// Capture specific element
YouTip