π« The Pain Point
Boss: βGo to these 20 competitor websites and capture their homepage for our design meeting.β You: Open link β Wait load β Print Screen β Paste Paint β Crop. x 20. Some pages timeout, some have cookie popups.
π Agentic Solution
Headless Browser: Controls high-speed Chrome without drawing the UI (Headless), capturing pixels perfectly with smart error handling.
Key Features:
- Full Page: Captures the entire scrollable height, not just whatβs visible on screen.
- Smart Wait: Uses network idle detection instead of fixed timeouts.
- Error Recovery: Retries on timeout, logs failures, continues to next URL.
- Multi-Viewport: Supports desktop (1920x1080) and mobile (375x812) modes.
βοΈ Phase 1: Commander (Quick Fix)
For a quick investigation.
Prompt:
βI have
urls.txtwith one URL per line. Write a Node.js script using Puppeteer to:
- Smart Wait:
- Use
waitUntil: 'networkidle2'(at most 2 network connections for 500ms).- Set timeout to 30 seconds per page.
- Full Page Capture:
- Set viewport to 1920x1080 (Desktop).
- Scroll to bottom to trigger lazy-loaded images.
- Take
fullPage: truescreenshot.- Error Handling:
- If page fails (timeout, 404, SSL error), log to
error_log.txtand continue.- Retry once on timeout.
- Output: Save as
screenshots/{domain}.png.Print progress (e.g., βCaptured 1/50: example.comβ).β
Result: A folder of design references with full error handling.
ποΈ Phase 2: Architect (Permanent Tool)
For UI/UX Designers.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "Web Capture Pro" Desktop App
**Objective:** A batch website screenshot tool with mobile emulation and full-page capture.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Browser Engine: Playwright (Python) or Selenium
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Input:** URL List (Text Area) or `urls.txt` file loading.
* **Viewport:** Radio "Desktop (1920x1080)" vs "Mobile (375x812)".
* **Options:** Checkbox "Full Page Capture", "Dark Mode".
* **Action:** "Capture All".
* **Progress:** ProgressBar with "Processing X/Y".
2. **Core Logic:**
* Launch Headless Browser.
* Iterate URLs -> Go to Page -> Wait for Network Idle.
* Scroll to bottom (lazy load) -> Screenshot.
* **Threading:** Browser automation runs in background thread.
3. **Deliverables:**
* `main.py`: Complete source code.
* `requirements.txt`: Dependencies.
* **Build Instructions:**
* Windows: `pyinstaller --onefile --noconsole main.py`
* macOS: `pyinstaller --windowed --noconsole main.py`
π§ Prompt Decoding
- NetworkIdle0: Websites have lazy-loading images. If you screenshot immediately, itβs blank. This command waits until β0 network connectionsβ are active, ensuring the site is fully loaded.
- Retry Logic: Real-world sites sometimes timeout. Instead of failing the whole batch, retry once and log failures.
π οΈ Instructions
- Install Node.js.
- Copy Prompt β Paste to AI β Run generated script.
- Edit
urls.txtβ Run β Checkscreenshots/folder.