askrobots / dbbasic-web-native
Public
100+ copy-paste UI components in plain HTML and CSS: no dependencies, no build step.
danq9
Add canonical.html v1.0 - The single source of truth for usability standards
fb6e650
1 year ago
History
take-screenshot.py · 752 bytes · 18 lines
| 1 | #!/usr/bin/env python3 |
| 2 | from playwright.sync_api import sync_playwright |
| 3 | import os |
| 4 | import sys |
| 5 | |
| 6 | def take_screenshot(html_file='demo-saas-landing.html', output_file='demo-fixed-layout.png'): |
| 7 | with sync_playwright() as p: |
| 8 | browser = p.chromium.launch() |
| 9 | page = browser.new_page(viewport={'width': 1920, 'height': 1080}) |
| 10 | page.goto(f'file://{os.getcwd()}/{html_file}') |
| 11 | page.screenshot(path=output_file, full_page=True) |
| 12 | browser.close() |
| 13 | print(f'Screenshot saved to {output_file}') |
| 14 | |
| 15 | if __name__ == '__main__': |
| 16 | html_file = sys.argv[1] if len(sys.argv) > 1 else 'demo-saas-landing.html' |
| 17 | output_file = sys.argv[2] if len(sys.argv) > 2 else 'demo-fixed-layout.png' |
| 18 | take_screenshot(html_file, output_file) |