Full-page screenshots help you capture the entire webpage in one image. This is useful to check the page layout and design visually.
Full-page screenshots in Cypress
cy.screenshot({ capture: 'fullPage' })The capture: 'fullPage' option tells Cypress to take a screenshot of the entire page, not just the visible part.
You can add a name like cy.screenshot('homepage', { capture: 'fullPage' }) to save the screenshot with a custom file name.
cy.screenshot({ capture: 'fullPage' })cy.screenshot('login-page', { capture: 'fullPage' })
cy.visit('https://example.com') cy.screenshot('example-full', { capture: 'fullPage' })
This test visits the Cypress example page and takes a full-page screenshot named 'full-page-example.png'.
describe('Full-page screenshot test', () => { it('captures the entire page', () => { cy.visit('https://example.cypress.io') cy.screenshot('full-page-example', { capture: 'fullPage' }) }) })
Full-page screenshots may take longer to capture than visible area screenshots.
Make sure the page is fully loaded before taking the screenshot to avoid missing content.
Full-page screenshots work best on desktop viewports; mobile views may crop differently.
Use cy.screenshot({ capture: 'fullPage' }) to capture the entire webpage.
Full-page screenshots help catch layout and design issues beyond the visible screen.
Always wait for the page to load fully before taking screenshots for best results.