Playwright · Matcher
toHaveScreenshot
expect(page).toHaveScreenshot() waits for a stable page image and compares it with a visual snapshot. It is a Playwright Test assertion for PNG or WebP screenshots.
Last updated
- Since
- v1.23
Syntax
await expect(page).toHaveScreenshot(name);
await expect(page).toHaveScreenshot(options);In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
toHaveScreenshot(options)toMatchSnapshotTestConfig.expecttestConfig.snapshotPathTemplatemaxDiffPixelsstylePath