Puppeteer • JavaScript
Puppeteer Full Page Screenshot
Comment capture a full-page screenshot using Puppeteer. Copy this code snippet for your visual regression tests.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://gentestcase.com');
await page.screenshot({ path: 'screenshot.png', fullPage: true });
await browser.close();
})();
How it works
This Puppeteer snippet opens a headless browser instance, navigates to a URL, and uses the fullPage parameter to capture the entire height of the document, not just the visible viewport.
Tired of writing Puppeteer tests manually? GenTestCase AI generates them in seconds directly from your PRDs or Jira tickets.
Tired of writing boilerplate test code?
GenTestCase uses AI to automatically generate thousands of test cases and automation scripts directly from your requirements.
Start Generating for Free