from playwright.sync_api import sync_playwright import os SCREENSHOTS_DIR = '/tmp/novalon-preview' os.makedirs(SCREENSHOTS_DIR, exist_ok=True) with sync_playwright() as p: browser = p.chromium.launch(headless=True) page = browser.new_page(viewport={'width': 1440, 'height': 900}) page.goto('http://localhost:3000', wait_until='load', timeout=30000) page.wait_for_timeout(3000) page.screenshot(path=f'{SCREENSHOTS_DIR}/01-hero-fullpage.png', full_page=True) sections = [ ('home', '02-hero'), ('social-proof', '03-social-proof'), ('products', '04-products'), ('challenges', '05-challenges'), ('testimonials', '06-testimonials'), ('cta', '07-cta'), ] for section_id, filename in sections: try: locator = page.locator(f'#{section_id}') if locator.count() > 0: locator.screenshot(path=f'{SCREENSHOTS_DIR}/{filename}.png') print(f'✓ Captured #{section_id}') else: print(f'✗ Section #{section_id} not found') except Exception as e: print(f'✗ Error capturing #{section_id}: {e}') page.set_viewport_size({'width': 375, 'height': 812}) page.goto('http://localhost:3000', wait_until='load', timeout=30000) page.wait_for_timeout(3000) page.screenshot(path=f'{SCREENSHOTS_DIR}/08-mobile-fullpage.png', full_page=True) print('✓ Captured mobile viewport') browser.close() print(f'\nAll screenshots saved to {SCREENSHOTS_DIR}/')