An Interest In:
Web News this Week
- April 3, 2024
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
April 16, 2023 01:08 pm GMT
Original Link: https://dev.to/zt4ff_1/playwright-tutorial-for-beginners-8-screenshots-4h69
Playwright Tutorial for Beginners 8 - Screenshots
To screenshot, make use of page.screenshot({ path: 'screenshot/screenshot.png' })
Full page screenshots
Full page screenshot is a screenshot of a full scrollable page, as if you had a very tall screen and the page could fit it entirely.
await page.screenshot({ path: 'screenshot.png', fullPage: true });
Element screenshots
You can also take screenshots of elements too:
await page.locator('.header').screenshot({ path: 'screenshot.png' });
An example
const { test } = require('@playwright/test');test('Demo video', async ({ page }) => { await page.goto('https://playwright.dev'); await page.screenshot({ path: 'screenshot.png' });});
Original Link: https://dev.to/zt4ff_1/playwright-tutorial-for-beginners-8-screenshots-4h69
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To